/* Farbschema: Rot #cc0000, Weiß, Dunkelgrau #18181b
   Schriften wie ein-mx5-event.de: Sora (Überschriften/Buttons), Lato (Fließtext) */

@font-face {
    font-family: 'Sora';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/sora-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/lato-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Lato';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/lato-700.woff2') format('woff2');
}

:root {
    --red: #cc0000;
    --red-dark: #a30000;
    --tidm: #b60b27; /* Rotton von tidm.de */
    --dark: #18181b;
    --dark-soft: #27272a;
    --white: #ffffff;
    --gray-text: #52525b;
    --gray-border: #e4e4e7;
}

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

body {
    font-family: 'Lato', 'Open Sans', sans-serif;
    background: var(--dark);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    align-items: flex-start; /* Karten oben fixiert, damit beim Flip nichts in der Höhe springt */
    justify-content: center;
    padding: clamp(3.5rem, 12vh, 7rem) 1rem 2rem;
    line-height: 1.6;
}

.wrap { width: 100%; max-width: 640px; perspective: 1400px; }
.wrap-wide { max-width: 960px; }

/* ---------- Karten & Schritte ---------- */

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.step { display: none; backface-visibility: hidden; will-change: transform; }
.step.active { display: block; }

/* Karten-Flip beim Schrittwechsel (WEITER dreht nach links, ZURÜCK nach rechts) */
@keyframes flip-out-next { from { transform: rotateY(0); }      to { transform: rotateY(-90deg); } }
@keyframes flip-in-next  { from { transform: rotateY(90deg); }  to { transform: rotateY(0); } }
@keyframes flip-out-back { from { transform: rotateY(0); }      to { transform: rotateY(90deg); } }
@keyframes flip-in-back  { from { transform: rotateY(-90deg); } to { transform: rotateY(0); } }

.flip-out-next { animation: flip-out-next 0.25s ease-in forwards; }
.flip-in-next  { animation: flip-in-next 0.25s ease-out; }
.flip-out-back { animation: flip-out-back 0.25s ease-in forwards; }
.flip-in-back  { animation: flip-in-back 0.25s ease-out; }

@media (prefers-reduced-motion: reduce) {
    .flip-out-next, .flip-in-next, .flip-out-back, .flip-in-back { animation: none; }
}

.card-center { text-align: center; }

.logo {
    display: block;
    max-width: 220px;
    width: 60%;
    margin: 0 auto 1.5rem;
}

/* Überschriften-Styling wie ein-mx5-event.de:
   Sora 700, uppercase, weiß im roten Kasten (<span>) */
h1, h2 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--white);
    line-height: 1.45;
}

h1 { font-size: 1.75rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 1.25rem; }

h1 span, h2 span {
    display: inline-block;
    padding: 2px 15px;
    background: var(--red);
    border-radius: 3px;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.accent { color: var(--red); }

.intro { color: var(--gray-text); margin-bottom: 1.75rem; }

.greeting { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--red); }

/* ---------- Fortschrittsbalken ---------- */

/* Fix am oberen Bildschirmrand, unabhängig von der Karte */
.progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--dark-soft);
    overflow: hidden;
    z-index: 100;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--red);
    transition: width 0.4s ease;
}

/* ---------- Formulare ---------- */

/* Eingabefelder wie auf ein-mx5-event.de */
textarea, .login-form input {
    width: 100%;
    padding: 0.85714em 1.35714em;
    border: 1px solid #dcdcdc;
    border-bottom-color: #cfcfcf;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.93333em;
    line-height: 1.5;
    color: inherit;
    background: var(--white);
}

textarea { resize: vertical; min-height: 140px; }

.char-count {
    text-align: right;
    font-size: 0.78rem;
    color: #98a0ab;
    margin-top: 0.35rem;
}

textarea::placeholder, .login-form input::placeholder { color: #98a0ab; }

textarea:hover, .login-form input:hover {
    border-color: #cfcfcf #cfcfcf #c5c5c5;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
}

textarea:focus, .login-form input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: none;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    border: none;
    border-radius: 3px;
    padding: 0.9rem 1.8rem;
    font-family: 'Sora', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--red-dark); }

.btn-ghost {
    background: transparent;
    color: var(--gray-text);
    border: 2px solid var(--gray-border);
}
.btn-ghost:hover { border-color: var(--dark); color: var(--dark); }

.btn-small { padding: 0.55rem 1.1rem; font-size: 0.8rem; }

.nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ---------- Einwilligungen ---------- */

.consent { margin-bottom: 1.75rem; }

.consent-question { font-weight: 600; margin-bottom: 0.75rem; }

.toggle { display: flex; gap: 0.75rem; }

.toggle-btn {
    flex: 1;
    padding: 0.8rem;
    border: 2px solid var(--gray-border);
    border-radius: 10px;
    background: var(--white);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover { border-color: var(--red); }

.toggle-btn.selected {
    background: var(--red);
    border-color: var(--red);
    color: var(--white);
}

.error-msg { color: var(--red); font-weight: 600; margin-top: 0.75rem; }

/* ---------- Sternebewertung ---------- */

.stars {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.75rem 0 0.25rem;
}

.star {
    background: none;
    border: none;
    padding: 0 0.15rem;
    font-size: 2.8rem;
    line-height: 1;
    color: #d4d4d8;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease;
}

.star:hover { transform: scale(1.15); }
.star.filled { color: var(--red); }

.stars-hint {
    text-align: center;
    min-height: 1.5em;
    color: var(--gray-text);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ---------- TidM-2027-Karte (Rotton von tidm.de) ---------- */

.sad {
    display: block;
    width: 84px;
    height: 84px;
    margin: 0 auto 1.25rem;
    animation: sad-drop 0.6s ease;
}

@keyframes sad-drop {
    from { transform: translateY(-24px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

#fireworks-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 99;
}

.tidm-card h1 span { background: var(--tidm); }

.tidm-toggle { max-width: 420px; margin: 0 auto; }

.tidm-card .toggle-btn:hover { border-color: var(--tidm); }

.tidm-card .toggle-btn.selected {
    background: var(--tidm);
    border-color: var(--tidm);
    color: var(--white);
}

.tidm-card .toggle-btn:disabled:not(.selected) { opacity: 0.45; cursor: default; }

.tidm-result {
    margin-top: 1.5rem;
    font-weight: 700;
    color: var(--tidm);
}

.tidm-link { color: var(--tidm); text-decoration: none; }
.tidm-link:hover { text-decoration: underline; }

/* ---------- Danke-Seite ---------- */

/* Material-Style-Häkchen: Kreis und Haken zeichnen sich nacheinander */
.check {
    display: block;
    width: 84px;
    height: 84px;
    margin: 0 auto 1.5rem;
}

.check-circle {
    stroke: var(--red);
    stroke-width: 3;
    stroke-dasharray: 151;
    stroke-dashoffset: 151;
    animation: draw-stroke 0.5s ease-out forwards;
}

.check-mark {
    stroke: var(--red);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    animation: draw-stroke 0.35s 0.45s ease-out forwards;
}

@keyframes draw-stroke { to { stroke-dashoffset: 0; } }

/* ---------- Admin ---------- */

.admin-body { align-items: flex-start; }

.login-card { max-width: 400px; margin: 15vh auto 0; }

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-header h1 { color: var(--white); margin: 0; }

.admin-actions { display: flex; gap: 0.75rem; }

.admin-body .btn-ghost { color: #a1a1aa; border-color: #3f3f46; }
.admin-body .btn-ghost:hover { color: var(--white); border-color: var(--white); }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat {
    background: var(--dark-soft);
    border-radius: 12px;
    padding: 1.1rem;
    text-align: center;
}

.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--red); }
.stat-label { color: #a1a1aa; font-size: 0.85rem; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.filter-bar input[type="text"],
.filter-bar select {
    padding: 0.55rem 0.9rem;
    border: 1px solid #3f3f46;
    border-radius: 3px;
    background: var(--dark-soft);
    color: var(--white);
    font: inherit;
    font-size: 0.9rem;
}

.filter-bar input[type="text"] { flex: 1 1 240px; }
.filter-bar input[type="text"]:focus,
.filter-bar select:focus { outline: none; border-color: var(--red); }
.filter-bar input::placeholder { color: #71717a; }

.delete-form { margin-left: auto; }

.delete-btn {
    background: none;
    border: 1px solid var(--gray-border);
    border-radius: 3px;
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.delete-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

.group { margin-bottom: 2rem; }

.group-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0 0.25rem 0.5rem;
}

.group-code {
    color: var(--white);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
}

.group-count { color: #a1a1aa; font-size: 0.85rem; }

.group-name {
    color: #a1a1aa;
    font-weight: 400;
    font-size: 0.95rem;
    margin-left: 0.6rem;
    letter-spacing: normal;
}

/* ---------- Teilnehmerdaten (Admin) ---------- */

.member-details {
    background: var(--dark-soft);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.member-details summary {
    cursor: pointer;
    padding: 0.8rem 1.25rem;
    color: #a1a1aa;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.member-details summary:hover { color: var(--white); }
.member-details[open] summary { color: var(--white); border-bottom: 1px solid #3f3f46; }

.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.6rem 1.5rem;
    padding: 1rem 1.25rem 1.25rem;
}

.member-row { display: flex; flex-direction: column; }
.member-row-wide { grid-column: 1 / -1; }

.member-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #71717a;
}

.member-value { color: var(--white); font-size: 0.95rem; }

.entry { padding: 1.5rem; margin-bottom: 0.75rem; }

.entry-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    color: var(--gray-text);
    font-size: 0.9rem;
}

.badge {
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-yes { background: #dcfce7; color: #166534; }
.badge-no  { background: #f4f4f5; color: var(--gray-text); }
.badge-rating { background: #fef3c7; color: #92400e; letter-spacing: 0.1em; }
.badge-open   { background: #fee2e2; color: #991b1b; }

.entry-answers dt {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--red);
    margin-top: 0.9rem;
}

.entry-answers dd { color: var(--dark); }
.entry-answers em { color: var(--gray-text); }

/* ---------- Mobil ---------- */

@media (max-width: 480px) {
    .card { padding: 1.75rem 1.25rem; }
    h1, h2 { text-align: center; }
    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.15rem; }
    .nav { flex-direction: column-reverse; }
    .nav .btn { width: 100%; }
    .card > .btn { width: 100%; } /* z.B. UMFRAGE STARTEN */
}
