/* Abstimmungstool – Stil angelehnt an die Burschentag-2026-Seite */
:root {
    --bg-color: #FDFCF8;
    --text-color: #1A1A1A;
    --accent-color: #7A2020;
    --accent-soft: #F3E6E3;
    --border-color: #D4D4D4;
    --hover-bg: #F4F1EA;
    --muted: #666;
    --ok: #2F5D34;
    --ok-soft: #E8F0E4;
    --font-header: 'UnifrakturMaguntia', cursive;
    --font-body: 'Libre Baskerville', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
}

a { color: var(--accent-color); }
small { font-size: 0.8em; color: var(--muted); }
code, .mono { font-family: Consolas, 'Courier New', monospace; }
.small { font-size: 0.8rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.print-only { display: none; }

/* --- Kopfzeile --- */
.top-bar {
    width: 100%;
    min-height: 120px;
    background-color: rgba(253, 252, 248, 0.98);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    padding: 10px 20px;
}
.logo { height: 85px; width: auto; object-fit: contain; }
.adb-emblem-wrapper {
    height: 75px; width: 88px; overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center;
}
.adb-emblem { height: 100%; width: auto; display: block; object-fit: contain; object-position: left center; }
.header-title {
    font-family: var(--font-header);
    text-align: center; color: #000; text-decoration: none;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.title-main { font-size: 2.9rem; line-height: 1.0; display: block; }
.title-sub { font-size: 1.5rem; line-height: 1.4; display: block; margin-top: 4px; }

/* --- Unternavigation (Admin) --- */
.sub-nav {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 26px;
    padding: 12px 20px; border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px;
}
.sub-nav a, .sub-nav .link-btn {
    color: var(--text-color); text-decoration: none; padding: 4px 0;
    border-bottom: 2px solid transparent; font-size: inherit; letter-spacing: inherit; text-transform: inherit;
}
.sub-nav a:hover, .sub-nav .link-btn:hover { color: var(--accent-color); }
.sub-nav a.active { border-bottom-color: var(--accent-color); color: var(--accent-color); font-weight: bold; }

/* --- Container --- */
.container { max-width: 1100px; margin: 0 auto; padding: 36px 20px 0; }
.container.narrow { max-width: 680px; }
.container.wide { max-width: 1400px; }

.page-head {
    display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap;
    gap: 15px; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--border-color);
}
.page-title, .section-title {
    font-family: var(--font-header); font-weight: normal;
    font-size: 2.4rem; line-height: 1.15; color: var(--text-color);
}
.section-title { font-size: 2rem; margin-bottom: 12px; }

/* --- Karten --- */
.card {
    background-color: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    padding: 28px;
    margin-bottom: 24px;
}
.card-header {
    font-family: var(--font-header); font-weight: normal;
    font-size: 1.8rem; margin-bottom: 20px;
    border-bottom: 1px solid #eee; padding-bottom: 10px;
    color: var(--accent-color);
}
.muted-card { background: var(--hover-bg); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.two-col > .card { margin-bottom: 0; }
.two-col + .card, .two-col + section { margin-top: 24px; }

.lead { font-style: italic; color: #555; margin-bottom: 18px; font-size: 1.05rem; }
.loc-note { font-style: italic; color: var(--muted); }
.hint { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.loc-heading { margin: 25px 0 8px; font-size: 1.05rem; color: var(--accent-color); }
.section-subtitle { font-family: var(--font-header); font-weight: normal; font-size: 1.5rem; margin: 25px 0 10px; padding-top: 15px; border-top: 1px solid #eee; }
.event-date {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1.5px;
    color: var(--accent-color); display: block; font-weight: bold; margin-bottom: 5px;
}

/* --- Buttons --- */
.btn {
    display: inline-block; text-decoration: none; cursor: pointer;
    font-family: var(--font-body); color: var(--text-color); background: transparent;
    border: 1px solid var(--text-color);
    padding: 11px 26px; font-size: 0.9rem; letter-spacing: 1px; text-transform: uppercase;
    transition: all 0.25s ease; text-align: center; line-height: 1.3;
}
.btn:hover { background-color: var(--text-color); color: var(--bg-color); }
.btn-primary { background: var(--accent-color); border-color: var(--accent-color); color: #fff; }
.btn-primary:hover { background: #5a1414; border-color: #5a1414; color: #fff; }
.btn-danger { color: var(--accent-color); border-color: var(--accent-color); }
.btn-danger:hover { background: var(--accent-color); color: #fff; }
.btn-small { padding: 6px 14px; font-size: 0.72rem; }
.btn-block { display: block; width: 100%; margin-top: 18px; padding: 15px; }
.btn:disabled { opacity: 0.5; cursor: wait; }
.link-btn {
    background: none; border: none; cursor: pointer; padding: 0;
    font-family: var(--font-body); font-size: 0.85rem; color: var(--accent-color); text-decoration: underline;
}
.link-btn + .link-btn, .link-btn + form .link-btn, a.link-btn + form { margin-left: 10px; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button-row.secondary { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee; }

/* --- Formulare --- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: flex; flex-direction: column; gap: 8px; }
.form-grid .field-label { margin-top: 10px; }
.field-label { font-weight: bold; font-size: 0.9rem; }
.input {
    width: 100%; font-family: var(--font-body); font-size: 1rem;
    padding: 11px 13px; border: 1px solid var(--border-color); background: #fff; color: var(--text-color);
    border-radius: 0;
}
.input:focus { outline: 2px solid var(--accent-color); outline-offset: -1px; border-color: var(--accent-color); }
textarea.input { resize: vertical; line-height: 1.5; }
textarea.mono { font-size: 0.9rem; }
.input-code {
    font-family: Consolas, 'Courier New', monospace; font-size: 1.6rem;
    letter-spacing: 4px; text-align: center; text-transform: uppercase;
}
.input-num { width: 90px; }
.inline-field { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.inline-field .input:not(.input-num) { flex: 1; min-width: 180px; }
.inline-field .hint { margin: 0; }
.checks { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-line input { margin-top: 5px; accent-color: var(--accent-color); flex-shrink: 0; }
.form-actions { margin-top: 18px; }
.quick-fill { font-size: 0.85rem; color: var(--muted); }
.quick-fill .link-btn { margin-left: 10px; }
.locked-options { margin-left: 20px; }

/* --- Meldungen --- */
.flash { padding: 12px 18px; margin-bottom: 20px; border-left: 4px solid var(--ok); background: var(--ok-soft); }
.flash-error { border-left-color: var(--accent-color); background: var(--accent-soft); }
.flash-info { border-left-color: #8a7a4a; background: var(--hover-bg); font-size: 0.9rem; }

/* --- Status-Badges --- */
.badge {
    display: inline-block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.5px;
    padding: 3px 9px; border: 1px solid currentColor; font-weight: bold; vertical-align: middle;
}
.badge-draft { color: var(--muted); }
.badge-open { color: #fff; background: var(--accent-color); border-color: var(--accent-color); }
.badge-closed { color: var(--text-color); }

/* --- Wählerseite --- */
.voter-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 15px;
    padding: 16px 20px; margin-bottom: 24px;
    background: var(--hover-bg); border: 1px solid var(--border-color); border-left: 4px solid var(--accent-color);
}
.voter-label { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.voter-name { font-size: 1.05rem; }

.poll-card { border-left: 4px solid var(--accent-color); scroll-margin-top: 20px; }
.poll-card.is-done { border-left-color: var(--ok); }
.poll-title { font-size: 1.45rem; line-height: 1.3; margin-bottom: 8px; }
.poll-desc { color: #444; margin-bottom: 16px; }
.turnout { margin-top: 16px; font-size: 0.8rem; color: var(--muted); text-align: right; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.option {
    display: flex; align-items: center; gap: 14px; cursor: pointer;
    padding: 15px 16px; background: #fff; border: 1px solid #e3e3e3;
    border-left: 4px solid transparent; transition: all 0.2s ease;
    font-size: 1.05rem;
}
.option:hover { background: var(--hover-bg); border-color: var(--border-color); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-mark {
    flex-shrink: 0; width: 22px; height: 22px; border: 2px solid #999; border-radius: 50%;
    position: relative; transition: all 0.2s;
}
.option input[type="checkbox"] + .option-mark { border-radius: 3px; }
.option input:checked + .option-mark { border-color: var(--accent-color); background: var(--accent-color); }
.option input:checked + .option-mark::after {
    content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
    border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.option input:focus-visible + .option-mark { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.option:has(input:checked) { border-left-color: var(--accent-color); background: var(--hover-bg); border-color: var(--border-color); }
.option-abstain { font-style: italic; color: #555; margin-top: 6px; }

.done-box {
    display: flex; gap: 16px; align-items: center; padding: 16px 18px;
    background: var(--ok-soft); border: 1px solid #cfdcc9;
}
.check {
    flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--ok); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}

.link-list { list-style: none; }
.link-list li { padding: 10px 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.link-list li:last-child { border-bottom: none; }

/* --- Ergebnisse --- */
.results { margin-top: 10px; }
.result-row { margin-bottom: 16px; }
.result-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; }
.result-label { font-weight: bold; }
.result-num { white-space: nowrap; }
.result-row.is-lead .result-label { color: var(--accent-color); }
.bar { height: 12px; background: #eee; overflow: hidden; }
.bar span { display: block; height: 100%; background: #9a8f86; transition: width 0.6s ease; }
.result-row.is-lead .bar span { background: var(--accent-color); }
.result-meta { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }

/* --- Zeitleiste (wie Festfolge) --- */
.timeline { list-style: none; margin: 0 0 22px; border-left: 2px solid var(--accent-color); }
.timeline-item { position: relative; padding-left: 22px; margin-bottom: 8px; }
.timeline-item::before {
    content: ""; position: absolute; left: -6px; top: 7px;
    width: 10px; height: 10px; background-color: var(--accent-color); border-radius: 50%;
}
.timeline-time { font-weight: bold; color: #555; display: inline-block; width: 115px; }
.timeline-desc { display: inline-block; }

/* --- Admin: Liste --- */
.poll-list .card { margin-bottom: 14px; }
.poll-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 22px; border-left: 4px solid transparent; }
.poll-row.status-open { border-left-color: var(--accent-color); background: var(--hover-bg); }
.poll-row-main { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.poll-row-title { font-size: 1.2rem; font-weight: bold; color: var(--text-color); text-decoration: none; }
.poll-row-title:hover { color: var(--accent-color); }
.poll-row-meta { font-size: 0.82rem; color: var(--muted); }
.poll-row-actions { display: flex; gap: 8px; flex-shrink: 0; }
.option-list { margin-left: 22px; }
.option-list li { padding: 2px 0; }
.turnout-inline { font-family: var(--font-body); font-size: 1rem; color: var(--muted); margin-left: 8px; }

.voter-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 20px; }
.voter-status { font-size: 0.88rem; padding: 4px 0; border-bottom: 1px dotted #e3e3e3; }
.voter-status.did { color: var(--ok); }
.voter-status.not { color: #999; }
.voter-status.just { animation: justVoted 2.5s ease-out; }
@keyframes justVoted {
    0%, 30% { background: var(--ok-soft); }
    100% { background: transparent; }
}
.live-dot {
    float: right; margin-top: 12px;
    font-family: var(--font-body); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted);
}
.live-dot::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-color); margin-right: 6px; vertical-align: 1px;
    animation: livePulse 2s ease-in-out infinite;
}
.live-dot.offline::before { background: #bbb; animation: none; }
@keyframes livePulse { 50% { opacity: 0.25; } }

/* --- Hinweis auf Änderungen (Wählerseite) --- */
.update-banner {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000;
    width: calc(100% - 32px); max-width: 560px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 12px 16px; background: var(--text-color); color: var(--bg-color);
    border-left: 4px solid var(--accent-color); box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    font-size: 0.92rem; animation: fadeIn 0.4s ease;
}
.update-banner .btn { color: var(--bg-color); border-color: var(--bg-color); flex-shrink: 0; }
.update-banner .btn:hover { background: var(--bg-color); color: var(--text-color); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Listen-Editor mit Eintragsnummern --- */
.line-editor {
    --lh: 22px;
    display: flex; overflow: hidden; position: relative;
    border: 1px solid var(--border-color);
    background: linear-gradient(to right, var(--hover-bg) 0 52px, #fff 52px);
}
.line-editor:focus-within { outline: 2px solid var(--accent-color); outline-offset: -1px; }
.line-gutter {
    flex: 0 0 52px; align-self: flex-start;
    padding: 11px 8px 11px 0; border-right: 1px solid var(--border-color);
    font-family: Consolas, 'Courier New', monospace; font-size: 0.72rem; color: #999;
    text-align: right; user-select: none; line-height: var(--lh); will-change: transform;
}
.line-gutter div { height: var(--lh); }
.line-gutter div:nth-child(odd) { background: rgba(122, 32, 32, 0.05); }
.line-gutter .dupe { color: var(--accent-color); font-size: 0.6rem; text-transform: uppercase; }
.line-editor textarea {
    flex: 1; border: none; outline: none; padding-left: 10px;
    line-height: var(--lh); white-space: pre; overflow-x: auto;
    background: transparent repeating-linear-gradient(to bottom,
        rgba(122, 32, 32, 0.05) 0 var(--lh), transparent var(--lh) calc(var(--lh) * 2));
    background-position: 0 11px;
    background-attachment: local;
}
.line-editor textarea:focus { outline: none; }
.line-count { margin: -4px 0 0; }

.voter-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.voter-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border-color); }
.voter-table td { padding: 7px 8px; border-bottom: 1px solid #eee; vertical-align: middle; }
.voter-table tr:target td { background: var(--accent-soft); }
.danger-zone { border-left: 4px solid var(--accent-color); margin-top: 24px; }

/* --- QR-Codes --- */
.qr svg { display: block; width: 100%; height: auto; }
.qr-medium { width: 220px; margin: 0 auto 10px; }
.qr-large { width: 100%; max-width: 380px; margin: 0 auto; }

/* --- Projektor --- */
.display-page .container { padding-top: 24px; }
.display { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 24px; align-items: start; }
.display .card { margin-bottom: 0; }
.display-qr { text-align: center; }
.display-qr-hint { font-size: 1.2rem; margin-top: 12px; font-style: italic; }
.display-title { font-family: var(--font-header); font-weight: normal; font-size: 3.2rem; line-height: 1.1; margin: 10px 0 12px; }
.display-turnout { display: flex; align-items: baseline; gap: 14px; margin-top: 18px; }
.big-num { font-family: var(--font-header); font-size: 5.5rem; line-height: 1; color: var(--accent-color); }
.of { font-size: 1.6rem; color: var(--muted); }
.bar-turnout { height: 16px; margin-top: 10px; }
.bar-turnout span { background: var(--accent-color); }
.display-results { margin-top: 28px; padding-top: 20px; border-top: 1px solid #eee; font-size: 1.25rem; }
.display-results .bar { height: 20px; }
.display-options { font-size: 1.3rem; }

/* --- Stimmkarten --- */
.cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.vote-card {
    border: 1px dashed #aaa; padding: 16px 18px; background: #fff;
    break-inside: avoid; page-break-inside: avoid; display: flex; flex-direction: column; gap: 10px;
}
.vote-card-head { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.vote-card-logo { height: 38px; width: auto; }
.vote-card-title { font-family: var(--font-header); font-size: 1.4rem; line-height: 1; }
.vote-card-sub { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 2px; color: var(--accent-color); font-weight: bold; }
.vote-card-body { display: flex; gap: 16px; align-items: center; }
.qr-card { width: 130px; flex-shrink: 0; }
.vote-card-name { font-weight: bold; font-size: 0.95rem; line-height: 1.3; margin-bottom: 8px; }
.vote-card-code-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.vote-card-code { font-family: Consolas, 'Courier New', monospace; font-size: 1.3rem; letter-spacing: 2px; font-weight: bold; }
.vote-card-help { font-size: 0.66rem; color: #555; margin-top: 6px; line-height: 1.4; word-break: break-all; }
.vote-card-foot { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); text-align: center; border-top: 1px solid #eee; padding-top: 6px; }

/* --- Fußzeile --- */
footer {
    margin-top: 70px; padding: 36px 20px; text-align: center;
    font-size: 0.9rem; color: #888; border-top: 1px solid var(--border-color);
}
footer a { color: var(--accent-color); text-decoration: none; }
footer a:hover { color: var(--text-color); text-decoration: underline; }

/* --- Mobil --- */
@media (max-width: 900px) {
    .two-col, .display { grid-template-columns: 1fr; }
    .qr-large { max-width: 260px; }
}

@media (max-width: 800px) {
    .top-bar { min-height: 75px; gap: 12px; padding: 8px 12px; }
    .logo { height: 50px; }
    .adb-emblem-wrapper { height: 48px; width: 60px; }
    .title-main { font-size: 1.4rem; }
    .title-sub { font-size: 0.78rem; margin-top: 2px; }
    .container { padding: 22px 14px 0; }
    .card { padding: 18px; }
    .page-title { font-size: 1.9rem; }
    .section-title { font-size: 1.7rem; }
    .card-header { font-size: 1.5rem; }
    .poll-title { font-size: 1.25rem; }
    .poll-row { flex-direction: column; align-items: stretch; }
    .poll-row-actions { justify-content: flex-start; }
    .timeline-time { display: block; width: auto; }
    .sub-nav { gap: 2px 16px; font-size: 0.72rem; letter-spacing: 1px; }
    .display-title { font-size: 2.2rem; }
    .big-num { font-size: 4rem; }
    .cards-grid { grid-template-columns: 1fr; }
    footer { padding: 28px 20px; margin-top: 50px; }
}

/* --- Druck --- */
@media print {
    @page { size: A4; margin: 10mm; }
    body { background: #fff; }
    .top-bar, .sub-nav, footer, .no-print, .flash { display: none !important; }
    .print-only { display: block; }
    .container { padding: 0; max-width: none; }
    .card { box-shadow: none; border: none; padding: 0; }
    .cards-page .cards-grid { grid-template-columns: 1fr 1fr; }
    .vote-card { height: 90mm; justify-content: space-between; }
    .bar span, .badge-open, .btn-primary { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
