/* =========================================
 * apklausa.css — Community Poll Page
 * Bold editorial design — Viktorina.live
 * ========================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { font-family: var(--font-primary); min-height: 100vh; background-color: var(--color-bg-primary); }

/* ─── Layout ──────────────────────────────────────────── */

.header-wrapper { position: sticky; top: 0; z-index: 9; flex-shrink: 0; }
.footer-wrapper { position: fixed; bottom: 0; width: 100%; }

main.main-content {
    padding: 0;
    max-width: none;
    display: flex;
    width: 100%;
    align-items: stretch;
}

.poll-left {
    width: 55%;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem 1.25rem 1.75rem;
    gap: 0.75rem;
    overflow-y: auto;
}

.poll-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.75rem 1.25rem 0.75rem;
    gap: 0.65rem;
    min-width: 0;
}

@media (max-width: 1300px) { .poll-left { width: 57%; } }

@media (max-width: 1024px) {
    main.main-content { flex-direction: column; align-items: center; padding: 0.5rem 1rem; }
    .poll-left, .poll-right { width: 100%; max-width: 700px; padding: 0.6rem 0; }
}

/* ─── Vote Card ───────────────────────────────────────── */

.poll-card {
    background: var(--color-bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-border-default);
    border-radius: 1.25rem;
    padding: 1.75rem 2rem 1.5rem;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.poll-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(232,184,75,0.55) 50%, transparent 100%);
}

.poll-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--primitive-gold-600);
    background: rgba(232,184,75,0.08);
    border: 1px solid rgba(232,184,75,0.22);
    border-radius: 2rem;
    padding: 0.2rem 0.65rem;
    margin-bottom: 0.85rem;
}

.poll-badge-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--primitive-gold-600);
    animation: blink 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.25; transform: scale(0.65); }
}

/* Question row: question text + deadline badge side by side */
.poll-question-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.poll-question {
    font-family: 'Syne', var(--font-primary);
    font-size: clamp(1.05rem, 2.2vw, 1.75rem);
    font-weight: 800;
    color: var(--color-text-primary);
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    flex: 1;
}

/* Deadline badge */
.poll-deadline {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-default);
    border-radius: 2rem;
    padding: 0.18rem 0.55rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.poll-deadline--urgent {
    color: #f43f5e;
    background: rgba(244,63,94,0.08);
    border-color: rgba(244,63,94,0.3);
}

.poll-author {
    font-size: 0.73rem;
    color: var(--color-text-tertiary);
    margin-bottom: 1.4rem;
    letter-spacing: 0.02em;
}

.poll-author strong { color: var(--color-text-secondary); font-weight: 600; }
.poll-vote-count    { font-variant-numeric: tabular-nums; }

/* ─── YES / NO buttons ───────────────────────────────── */

.poll-vote-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 1.2rem;
}

.poll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: 'Syne', var(--font-primary);
    font-size: clamp(0.78rem, 1.3vw, 1rem);
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.75rem 0;
    border-radius: 0.55rem;
    border: none;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.poll-btn:active { transform: scale(0.97) !important; }

.poll-btn-yes {
    background: linear-gradient(135deg, #22d3a4 0%, #0ea57d 100%);
    color: #04211a;
    box-shadow: 0 2px 14px rgba(34,211,164,0.18);
}

.poll-btn-yes:hover:not(.poll-btn--voted) {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(34,211,164,0.38);
}

.poll-btn-no {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-default);
}

.poll-btn-no:hover:not(.poll-btn--voted) {
    transform: translateY(-2px);
    background: rgba(244,63,94,0.1);
    border-color: rgba(244,63,94,0.45);
    color: #fda4af;
    box-shadow: 0 4px 18px rgba(244,63,94,0.14);
}

/* Voted state — dim slightly, show checkmark overlay, disable cursor */
.poll-btn--voted {
    cursor: default;
    opacity: 0.7;
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.poll-btn-yes.poll-btn--voted { outline-color: #22d3a4; opacity: 0.9; }
.poll-btn-no.poll-btn--voted  { outline-color: #f43f5e; color: #f43f5e; opacity: 0.9; }

/* ─── Vote result bars ───────────────────────────────── */

.poll-bar-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.28rem;
}

.poll-bar-pct {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    transition: all 0.6s ease;
}

.poll-bar-pct.yes { color: #22d3a4; }
.poll-bar-pct.no  { color: #f43f5e; }

.poll-bar-track {
    display: flex;
    height: 5px;
    border-radius: 3px;
    background: var(--color-bg-secondary);
    overflow: hidden;
}

.poll-bar-yes {
    height: 100%;
    background: linear-gradient(90deg, #22d3a4, #0ecfb0);
    box-shadow: 0 0 7px rgba(34,211,164,0.5);
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.poll-bar-no {
    height: 100%;
    background: linear-gradient(90deg, #f43f5e, #fb7185);
    transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.poll-empty {
    color: var(--color-text-tertiary);
    font-size: 0.85rem;
    text-align: center;
    padding: 2.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* ─── History section (LEFT panel, below active card) ── */

.poll-history {
    background: var(--color-bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border-default);
    border-radius: 0.9rem;
    overflow: hidden;
    flex-shrink: 0;
}

.poll-history-head {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid var(--color-border-default);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.poll-history-list {
    max-height: 28vh;
    overflow-y: auto;
    padding: 0.3rem 0.5rem;
}

.poll-history-list::-webkit-scrollbar       { width: 3px; }
.poll-history-list::-webkit-scrollbar-track { background: transparent; }
.poll-history-list::-webkit-scrollbar-thumb { background: var(--color-border-default); border-radius: 2px; }

.poll-history-item {
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid var(--color-border-subtle);
}

.poll-history-item:last-child { border-bottom: none; }

.poll-history-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.poll-history-q {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    line-height: 1.35;
    flex: 1;
}

.poll-history-winner {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 2rem;
    border: 1px solid;
    flex-shrink: 0;
}

.poll-history-winner.yes {
    color: #22d3a4;
    background: rgba(34,211,164,0.08);
    border-color: rgba(34,211,164,0.3);
}

.poll-history-winner.no {
    color: #f43f5e;
    background: rgba(244,63,94,0.08);
    border-color: rgba(244,63,94,0.3);
}

.poll-history-bar-track {
    display: flex;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
    background: var(--color-bg-secondary);
    margin-bottom: 0.3rem;
}

.poll-history-bar-yes {
    height: 100%;
    background: #22d3a4;
    flex-shrink: 0;
}

.poll-history-bar-no {
    height: 100%;
    background: #f43f5e;
    flex-shrink: 0;
}

.poll-history-foot {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.poll-history-pcts,
.poll-history-votes,
.poll-history-date {
    font-size: 0.62rem;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.poll-history-date { margin-left: auto; }

/* ─── Right panel ─────────────────────────────────────── */

.poll-form-wrap { display: contents; }

.poll-user-strip {
    display: flex;
    gap: 0.45rem;
    padding: 0.5rem 0.65rem;
    background: var(--color-bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border-default);
    border-radius: 0.65rem;
}

.poll-user-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 0.25rem 0.35rem;
    border-radius: 0.35rem;
    border: 1px solid rgba(232,184,75,0.18);
    background: rgba(232,184,75,0.04);
    min-width: 0;
}

.poll-user-label {
    font-size: 0.57rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    margin-bottom: 0.15rem;
    white-space: nowrap;
}

.poll-user-label i { color: var(--primitive-gold-600); font-size: 0.54rem; margin-right: 0.2rem; }

.poll-user-val {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.poll-user-val--mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }

/* Suggestion form */
.poll-form-card {
    background: var(--color-bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border-default);
    border-radius: 0.75rem;
    padding: 0.75rem 0.85rem 0.8rem;
}

.poll-form-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 0.45rem;
    cursor: help;
    transition: color 0.15s;
}

.poll-form-label:hover { color: var(--primitive-gold-600); }
.poll-form-label i { color: var(--primitive-gold-600); }

.poll-textarea {
    width: 100%;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-default);
    border-radius: 0.4rem;
    padding: 0.45rem 0.55rem;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 52px;
    max-height: 110px;
    display: block;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.poll-textarea::placeholder { color: var(--color-text-tertiary); font-size: 0.78rem; }

.poll-textarea:focus {
    outline: none;
    border-color: var(--primitive-gold-600);
    box-shadow: 0 0 0 2px rgba(232,184,75,0.12);
}

.poll-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.poll-form-hint { font-size: 0.6rem; color: var(--color-text-tertiary); }

.poll-submit {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.42rem 1rem;
    background: var(--gradient-gold);
    color: var(--color-text-inverse);
    font-family: var(--font-primary);
    font-size: 0.71rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border: none;
    border-radius: 0.35rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.poll-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,184,75,0.32); }
.poll-submit:active { transform: scale(0.97); }

/* Suggestions list */
.poll-list-card {
    background: var(--color-bg-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-border-default);
    border-radius: 0.75rem 0 0 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.poll-list-head {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--color-border-default);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--color-text-tertiary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.poll-list-scroll {
    overflow-y: auto;
    flex: 1;
    max-height: 36vh;
    padding: 0.3rem;
}

.poll-list-scroll::-webkit-scrollbar          { width: 3px; }
.poll-list-scroll::-webkit-scrollbar-track    { background: transparent; }
.poll-list-scroll::-webkit-scrollbar-thumb    { background: var(--color-border-default); border-radius: 2px; }

/* ─── AJAX-injected suggestion entries ───────────────── */

.vote-container { display: flex; flex-direction: column; }

.vote-entry {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.38rem 0.5rem;
    border-radius: 0.35rem;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.vote-entry + .vote-entry { border-top: 1px solid var(--color-border-subtle); }
.vote-entry:hover { background: rgba(255,255,255,0.025); border-color: var(--color-border-subtle); }

.vote-details {
    display: flex;
    flex-direction: column;
    min-width: 52px;
    max-width: 72px;
    font-size: 0.61rem;
    color: var(--color-text-tertiary);
    font-family: var(--font-primary);
    padding: 0; border: none;
    flex-shrink: 0;
    line-height: 1.55;
}

.vote-details strong { color: var(--color-text-secondary); font-weight: 600; }
.vote-pop { color: #22d3a4; font-size: 0.6rem; font-weight: 600; }

.vote-suggestion {
    flex: 1;
    font-size: 0.79rem;
    color: var(--color-text-secondary);
    font-family: var(--font-primary);
    padding: 0;
    word-break: break-word;
    line-height: 1.4;
}

.vote-suggestion strong { display: none; }

.vote-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    flex-shrink: 0;
}

.vote-yes, .vote-no, .vote-activate {
    padding: 0.17rem 0.48rem;
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    border-radius: 0.22rem;
    cursor: pointer;
    border: 1px solid;
    transition: all 0.12s;
    font-family: var(--font-primary);
    white-space: nowrap;
}

.vote-yes {
    background: rgba(34,211,164,0.07);
    color: #22d3a4;
    border-color: rgba(34,211,164,0.25);
}

.vote-yes:hover { background: rgba(34,211,164,0.16); border-color: rgba(34,211,164,0.6); transform: scale(1.05); }

.vote-no {
    background: rgba(244,63,94,0.07);
    color: #f43f5e;
    border-color: rgba(244,63,94,0.25);
}

.vote-no:hover { background: rgba(244,63,94,0.16); border-color: rgba(244,63,94,0.6); transform: scale(1.05); }

/* Admin activate button */
.vote-activate {
    background: rgba(232,184,75,0.08);
    color: var(--primitive-gold-600);
    border-color: rgba(232,184,75,0.3);
}

.vote-activate:hover {
    background: rgba(232,184,75,0.18);
    border-color: rgba(232,184,75,0.7);
    transform: scale(1.05);
}

.vote-activate:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ─── Tooltip ─────────────────────────────────────────── */

.tooltip {
    position: absolute;
    z-index: 9999;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border-default);
    color: var(--color-text-primary);
    font-family: var(--font-primary);
    padding: 0.8rem 1.1rem;
    border-radius: 0.5rem;
    font-size: 0.78rem;
    text-align: center;
    line-height: 1.85;
    max-width: 240px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    pointer-events: none;
}

.yellow-span { color: var(--primitive-gold-600); }

/* ─── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
    .poll-user-strip  { flex-wrap: wrap; }
    .poll-user-field  { flex: 0 0 calc(33.33% - 0.3rem); }
    .poll-vote-btns   { gap: 0.4rem; }
    .poll-btn         { padding: 0.65rem 0; }
    .poll-list-scroll, .poll-history-list { max-height: 26vh; }
}

@media (max-width: 500px) {
    .poll-card         { padding: 1.2rem 1rem 1rem; }
    .poll-question     { font-size: 1.05rem; }
    .poll-btn          { font-size: 0.76rem; padding: 0.6rem 0; }
    .poll-question-row { flex-direction: column; gap: 0.4rem; }
    .poll-deadline     { align-self: flex-start; }
}

@media (max-width: 380px) {
    .poll-btn            { font-size: 0.68rem; }
    .poll-user-field     { flex: 0 0 calc(50% - 0.25rem); }
    .poll-user-field:last-child { flex: 0 0 100%; }
}
