@import url('../../../assets/css/fonts-local.css');

/* ===== GBV Design (angelehnt an neue Website) ===== */
:root {
    --font: "DM Sans", system-ui, sans-serif;
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --bg: #eef4ef;
    --bg-pattern:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(180, 210, 185, 0.45) 0%, transparent 55%),
        radial-gradient(ellipse 80% 50% at 100% 50%, rgba(200, 225, 200, 0.25) 0%, transparent 45%),
        linear-gradient(180deg, #f4faf6 0%, #eef4ef 35%, #e8f0ea 100%);
    --text: #152818;
    --muted: #4d5f4f;
    --accent: #1e5c32;
    --accent-hover: #164726;
    --accent-soft: #2f7d44;
    --border: #b8d4bf;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-border: rgba(184, 212, 191, 0.75);
    --card-shadow: 0 4px 6px -1px rgba(21, 40, 24, 0.06), 0 12px 24px -8px rgba(21, 40, 24, 0.12);

    --yes: #2f7d44;
    --no: #c62828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-pattern) !important;
    background-attachment: fixed;
    position: relative;
    padding-bottom: 4rem;
}

/* Deko komplett deaktivieren (Blumen/Pilze/Vogel) – damit es wie die Website wirkt */
.bg-decoration,
.bg-flowers,
.bg-flowers-rand,
.mushrooms-deco,
.mushrooms-deco-rand,
.bird {
    display: none !important;
}

/* Hintergrund: SVG-Blumen */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-decoration .bg-flowers {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 55%;
    opacity: 0.22;
}

.bg-decoration .bg-flowers svg {
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: contain;
    object-position: bottom;
    display: block;
}

/* Zufällig verteilte Kopien (Blumen) */
.bg-decoration .bg-flowers-rand {
    position: absolute;
    max-height: 50%;
    opacity: 0.18;
    pointer-events: none;
}

.bg-decoration .bg-flowers-rand svg {
    width: 100%;
    height: auto;
    max-height: 45vh;
    display: block;
}

/* Zufällig verteilte Kopien (Pilze) */
.mushrooms-deco-rand {
    position: fixed;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.22;
}

.mushrooms-deco-rand svg {
    display: block;
    width: 200px;
    max-width: 25vw;
    height: auto;
}

/* Pilze unten – SVG (einzelne feste Position, falls noch verwendet) */
.mushrooms-deco {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

.mushrooms-deco img,
.mushrooms-deco svg {
    display: block;
    width: 280px;
    max-width: 90vw;
    height: auto;
}

/* Vogel – SVG (inline), oben rechts auf der Karte */
.bird {
    position: absolute;
    top: -14px;
    right: 12px;
    width: 72px;
    height: auto;
    z-index: 3;
    display: block;
}

.bird svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== Layout ===== */
.container {
    position: relative;
    z-index: 2;
    max-width: 54rem;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Umfrage-Ansicht: Box darf mit mehr Terminen mitwachsen */
.container.poll-view {
    max-width: 90vw;
}

/* Erst ab 10 Terminen: Breite begrenzen, Scrollbalken */
.container.poll-many-slots {
    max-width: min(95vw, 1600px);
}

.container.poll-many-slots .table-wrap {
    overflow-x: auto;
}

.container.poll-view:not(.poll-many-slots) .table-wrap {
    overflow-x: visible;
}

.site-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.site-header h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 4vw, 2.15rem);
    font-weight: 700;
    color: var(--accent);
    text-shadow: none;
}

.subtitle {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    color: var(--muted);
}

/* Karten */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--card-shadow);
    position: relative;
}

.card h2 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    color: var(--text);
}

/* Vote- und Ergebnis-Karte: Vogel-Platz lassen */
.vote-card,
.result-card {
    padding-top: 2rem;
}

/* Formulare */
label {
    display: block;
    margin-top: 0.75rem;
    font-weight: 500;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    max-width: 320px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: #fafcf9;
}

button {
    margin-top: 1rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(180deg, var(--accent-soft) 0%, var(--accent) 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(30, 92, 50, 0.25);
}

button:hover {
    filter: brightness(1.05);
}

.form-poll input[type="text"] {
    max-width: 100%;
}

.form-poll button[type="submit"] {
    display: block;
    margin-left: auto;
    margin-top: 0.5rem;
}

/* Admin: variable Termine */
.slots-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.slots-head label { margin-top: 0; }

.btn-add {
    margin: 0;
    padding: 0.4rem 0.8rem;
    background: var(--grass-light);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.btn-add:hover {
    background: var(--grass);
}

.slots-table-wrap {
    margin: 0.75rem 0 1rem;
    overflow-x: auto;
}

.slots-table {
    width: 100%;
    max-width: 420px;
    border-collapse: collapse;
}

.slots-table th,
.slots-table td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    vertical-align: middle;
}

.slots-table th {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--card-border);
}

.slots-table .col-date { width: 50%; }
.slots-table .col-time { width: 120px; }
.slots-table .col-remove {
    width: 44px;
    text-align: center;
    vertical-align: middle;
}

.slots-table .col-remove {
    display: table-cell;
}

.slots-table input[type="date"],
.slots-table input[type="time"] {
    width: 100%;
    max-width: none;
    height: 2.25rem;
    padding: 0.35rem 0.5rem;
    box-sizing: border-box;
    line-height: 1.2;
    margin: 0;
    vertical-align: middle;
}

.slot-row-admin td {
    border-bottom: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
    height: 3.05rem;
    box-sizing: border-box;
}

.slots-table .col-remove {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.slots-table .col-remove .btn-remove {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid #c4a0a0;
    background: #fff;
    color: #8b4545;
    border-radius: 4px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
}

.btn-remove:hover {
    background: #ffe0e0;
    border-color: #8b4545;
}

.hint {
    font-size: 0.9rem;
    color: var(--text);
    opacity: 0.85;
    margin: 0.5rem 0 0;
}

/* Slots (Ja/Nein pro Termin) */
.slots-form {
    margin: 1rem 0;
}

.slot-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.slot-row .slot-label {
    flex: 1 1 200px;
    font-weight: 500;
}

.slot-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slot-options input[type="radio"] {
    width: auto;
    margin: 0;
}

.slot-options label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Nachrichten */
.msg {
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
    margin-bottom: 1rem;
}

.msg-error { background: #ffebee; color: #7a1313; border: 1px solid rgba(198, 40, 40, 0.25); }
.msg-success { background: #e8f5e9; color: #1b5e20; border: 1px solid rgba(47, 125, 68, 0.25); }
.msg-info { background: #e0e8f0; color: #2d3a5a; }

/* Umfrage-Liste Admin */
.badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.badge.open { background: #d4edda; color: #155724; }
.badge.closed { background: #f8d7da; color: #721c24; }

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    background: #c45c5c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}

.btn-small:hover { background: #a04040; }

.btn-link {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    background: #1565c0;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-link:hover {
    background: #0d47a1;
    color: #fff;
}

.form-inline.form-delete {
    display: inline;
    margin: 0;
}

.form-delete .btn-delete {
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    background: #8b4545;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-delete .btn-delete:hover {
    background: #6b3030;
}

.link {
    color: var(--accent);
    text-decoration: none;
}

.link:hover { text-decoration: underline; }

/* Umfragen als Kacheln */
.poll-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.poll-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1.25rem;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.poll-tile:hover {
    border-color: var(--grass);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.poll-tile-title {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.poll-tile .badge {
    margin-top: auto;
}

/* Doodle-Tabelle (eine übersichtliche Tabelle wie bei Doodle) */
.doodle-card {
    padding-top: 2rem;
}

.doodle-card .participant-count {
    margin: 0 0 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.table-wrap {
    margin-top: 0.5rem;
    position: relative;
}

.doodle-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.doodle-table th,
.doodle-table td {
    border: 1px solid var(--card-border);
    padding: 0.5rem 0.6rem;
    text-align: center;
    vertical-align: middle;
}

.doodle-table th {
    background: linear-gradient(180deg, rgba(47, 125, 68, 0.78) 0%, rgba(30, 92, 50, 0.95) 100%);
    color: #fff;
    font-weight: 600;
}

.doodle-table .col-name {
    text-align: left;
    min-width: 140px;
}

/* Mini-Kalender in Tabellenkopf und Zellen */
.th-with-cal {
    vertical-align: top;
}

.th-with-cal .th-date {
    display: block;
    margin-bottom: 0.25rem;
}

.cell-mini-cal {
    display: block;
    margin-bottom: 0.2rem;
}

.mini-cal {
    display: inline-block;
    width: 12.6em;
    min-width: 12.6em;
    box-sizing: border-box;
    font-size: 0.6rem;
    line-height: 1.1;
    text-align: center;
    color: #000;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 3px;
    padding: 2px 3px;
}

.doodle-table th .mini-cal {
    margin-top: 0.15rem;
}

.mini-cal-title {
    display: block;
    font-weight: 600;
    margin-bottom: 1px;
}

.mini-cal-week {
    display: none;
}

.mini-cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.mini-cal-day {
    min-width: 0;
    padding: 0 2px;
    box-sizing: border-box;
}

.mini-cal-day--highlight {
    color: #000;
    font-weight: 600;
    border: 1.5px solid #c62828;
    border-radius: 50%;
    background: transparent;
}

/* Zellen: Ja (grün mit Häkchen) / Nein (rot) */
.doodle-table td.cell-yes {
    background: #e8f5e9;
    color: #1b5e20;
    font-weight: 500;
}

.doodle-table td.cell-no {
    background: #ffebee;
    color: #c62828;
}

/* Eingabezeile: Name + Ja/Nein pro Termin */
.doodle-table tr.input-row td {
    background: #f5f9f5;
}

.doodle-table .cell-input {
    vertical-align: middle;
}

.doodle-table .cell-input .cell-options {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.doodle-table .cell-input .cell-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    white-space: nowrap;
}

.doodle-table .cell-input input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
}

.input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.doodle-table tr.input-row .col-name input[type="text"] {
    width: 100%;
    max-width: 200px;
    padding: 0.4rem 0.5rem;
}

/* Zusammenfassung pro Spalte */
.doodle-table tfoot .cell-summary {
    font-size: 0.85rem;
    background: #e8f0e8;
}

.doodle-table tfoot .sum-ja {
    color: #2e7d32;
}

.doodle-table tfoot .sum-nein {
    color: #c62828;
}

/* Balkendiagramm: Zeile in der Tabelle, jede Spalte = ein Balken */
.chart-row td {
    border-top: 1px solid rgba(0,0,0,0.06);
    vertical-align: bottom;
}

.chart-label-cell {
    font-size: 0.85rem;
    color: var(--text);
}

.cell-chart {
    padding: 0.5rem;
    text-align: center;
    vertical-align: bottom;
}

.chart-bar-cell {
    height: 100px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chart-bar {
    width: 36px;
    min-height: 6px;
    max-height: 100%;
    display: flex;
    flex-direction: column-reverse;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    background: rgba(0,0,0,0.06);
}

.chart-segment {
    width: 100%;
    min-height: 3px;
}

.chart-segment.chart-ja {
    background: var(--yes);
}

.chart-segment.chart-nein {
    background: #c62828;
}

.chart-legend {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
}

.chart-legend-ja { color: var(--yes); margin-right: 1rem; }
.chart-legend-nein { color: #c62828; }

.btn-save {
    margin-top: 1rem;
}

/* Admin: Bestehende Umfragen als Tabelle */
.admin-table-wrap {
    overflow-x: auto;
    margin-top: 0.5rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
    padding: 0.6rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.admin-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text);
}

.admin-table .col-title {
    min-width: 160px;
}

.admin-table .col-status {
    white-space: nowrap;
}

.admin-table .col-actions {
    white-space: nowrap;
}

.admin-table .col-actions .link {
    margin-left: 0.5rem;
}

.admin-table .col-edit {
    white-space: nowrap;
}

.admin-table .col-delete {
    white-space: nowrap;
}

.admin-table .form-delete {
    display: inline;
}

/* Admin-Seite */
.page-admin .card:first-of-type {
    margin-top: 0;
}

.page-admin .card label {
    display: block;
    margin-top: 0.75rem;
}

.page-admin .card label:first-of-type {
    margin-top: 0;
}

/* Admin: Teilnehmer in bearbeiteter Umfrage entfernen */
.edit-participants-title {
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.edit-participants-empty {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
}

.edit-participants-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.edit-participant {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.edit-participant:last-child {
    border-bottom: none;
}

.edit-participant-name {
    font-weight: 500;
}

.form-delete-participant {
    display: inline;
}

.btn-remove-participant {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    background: #c4a0a0;
    color: #fff;
}

.btn-remove-participant:hover {
    background: #8b4545;
}

/* ===== Mobile Abstimmung: Achsen getauscht – eine Karte pro Termin (nur Handy, beibehalten) ===== */
.doodle-mobile {
    display: none;
}

/* Mobile: Ergebnis-Box (nur auf Handy sichtbar) */
.doodle-mobile-results {
    display: none;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .container.poll-view {
        max-width: 100%;
    }

    .site-header h1 {
        font-size: 1.4rem;
    }

    .card,
    .doodle-card {
        padding: 1rem;
    }

    /* Auf Handy: Abstimm-Box (eine Karte pro Termin) anzeigen */
    .container.poll-view .doodle-mobile {
        display: block;
    }

    /* Tabelle unter dem Speichern-Button auf Handy ausblenden */
    .container.poll-view .table-wrap {
        display: none !important;
    }

    .container.poll-view .btn-save:not(.btn-save-mobile) {
        display: none;
    }

    /* Überschrift */
    .doodle-mobile-heading {
        margin: 0 0 1rem;
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
    }

    /* Erste große Box: Eintragen */
    .doodle-mobile-box {
        background: #fff;
        border: 2px solid var(--card-border);
        border-radius: 10px;
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .doodle-mobile-box-title {
        margin: 0 0 0.75rem;
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text);
    }

    .doodle-mobile-closed-hint {
        margin: 0;
        font-size: 0.95rem;
        color: #666;
    }

    .doodle-mobile-name {
        margin-bottom: 1rem;
    }

    .doodle-mobile-name .input-label {
        display: block;
        font-weight: 600;
        margin-bottom: 0.25rem;
    }

    .doodle-mobile-name input[type="text"] {
        width: 100%;
        max-width: 100%;
        padding: 0.5rem 0.6rem;
        font-size: 1rem;
        border: 1px solid var(--card-border);
        border-radius: 6px;
    }

    .doodle-mobile-slots {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }

    /* Kleine Box pro Termin (nur Termin + Ja/Nein) */
    .doodle-mobile-slot {
        background: #f5f9f5;
        border: 1px solid var(--card-border);
        border-radius: 8px;
        padding: 0.6rem 0.75rem;
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.5rem 0.75rem;
        align-items: center;
    }

    .doodle-mobile-slot-term {
        font-weight: 600;
        color: var(--text);
        font-size: 0.95rem;
    }

    .doodle-mobile-slot-choice {
        display: flex;
        gap: 0.75rem;
        align-items: center;
    }

    .doodle-mobile-slot-choice .cell-option {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        margin: 0;
        cursor: pointer;
        padding: 0.35rem 0;
        min-height: 2.5rem;
    }

    .btn-save-mobile {
        margin-top: 1rem;
        width: 100%;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    /* Zweite große Box: Abstimmungen (Balken pro Termin, Ja-Namen im Balken) */
    .doodle-mobile-results {
        display: block;
        margin-top: 1rem;
    }

    .doodle-mobile-results-title {
        margin: 0 0 0.75rem;
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text);
    }

    .doodle-mobile-results-count {
        margin: 0 0 1rem;
        font-weight: 600;
        font-size: 0.95rem;
    }

    .doodle-mobile-results-bars {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .doodle-mobile-results-bar {
        background: #c8e6c9;
        border: 1px solid #81c784;
        border-radius: 8px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: 2.5rem;
    }

    .doodle-mobile-results-bar-label {
        flex-shrink: 0;
        padding: 0.4rem 0.75rem;
        font-weight: 600;
        font-size: 0.9rem;
        color: var(--text);
        background: rgba(255,255,255,0.6);
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .doodle-mobile-results-bar-inner {
        flex: 1;
        padding: 0.5rem 0.75rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem 0.5rem;
        align-content: flex-start;
        align-items: center;
    }

    .doodle-mobile-results-bar-name {
        display: inline-block;
        padding: 0.25rem 0.5rem;
        background: #fff;
        border-radius: 4px;
        font-size: 0.9rem;
        color: #2e7d32;
        font-weight: 500;
    }

    .doodle-mobile-results-bar-empty {
        font-size: 0.9rem;
        color: #666;
        font-style: italic;
    }
}
