/* ===========================================================================
   CST26 Sales Quiz – Basis-Stylesheet
   =========================================================================== */

/* --- Schriften (Vodafone) ------------------------------------------------ */
/* Einheitliche Familie "Vodafone" mit Gewichten */
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_Lt.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_Bk.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_Md.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_SBd.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_Bd.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vodafone';
    src: url('../fonts/Vodafone_XBd.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* Standard-Font (Vodafone Book) – auch direkt per Name nutzbar */
@font-face {
    font-family: 'vodafonebook';
    src: url('../fonts/Vodafone_Bk.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'vodafoneregular';
    src: url('../fonts/Vodafone_Rg.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* --- Reset / Grundlagen -------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f4f5f7;
    --color-surface: #ffffff;
    --color-text: #1a1a1a;
    --color-muted: #6b7280;
    --color-primary: #e60000;      /* Vodafone-Rot als Akzent */
    --color-ok: #16a34a;
    --color-error: #dc2626;
    --radius: 10px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --max-width: 960px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'vodafonebook', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Layout-Hilfen ------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

/* --- Header / Footer ----------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-surface);
    box-shadow: var(--shadow);
    padding-block: 0.75rem;
}

.brand {
    font-size: 1.25rem;
    color: var(--color-primary);
    white-space: nowrap;
}

.brand:link,
.brand:visited {
    color: var(--color-primary);
}

.brand:hover {
    color: var(--color-primary);
}

.brand strong {
    color: var(--color-text);
}

.site-footer {
    margin-top: auto;
    padding-block: 1.5rem;
    color: var(--color-muted);
    text-align: center;
}

/* --- Seiteninhalt -------------------------------------------------------- */
.page {
    padding-block: 2rem;
}

/* --- Hero ---------------------------------------------------------------- */
.hero {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    margin-block: 0;
}

.hero-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hero-head h1 {
    margin-bottom: 0;
}

.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 0.75rem;
}

.hero p {
    color: var(--color-muted);
    margin-bottom: 1rem;
}

/* --- Status-Badge -------------------------------------------------------- */
.status {
    margin-top: 1.5rem;
    font-weight: 500;
    color: var(--color-text);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
}

.badge--ok {
    background: var(--color-ok);
}

.badge--error {
    background: var(--color-error);
}

/* --- Header-Inhalt / Icon-Menü ------------------------------------------- */
.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.icon-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    color: var(--color-muted);
    /* Button-Defaults zurücksetzen (icon-btn wird für <a> UND <button> genutzt) */
    background: none;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:link,
.icon-btn:visited {
    color: var(--color-muted);
}

.icon-btn:hover,
.icon-btn:focus-visible {
    background: #f3f4f6;
    color: var(--color-primary);
    outline: none;
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* Tooltip (zeigt bei Hover/Fokus, was das Icon bedeutet) */
.icon-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 6px);
    right: 50%;
    transform: translateX(50%) translateY(4px);
    background: var(--color-text);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

.icon-btn:hover::after,
.icon-btn:focus-visible::after {
    opacity: 1;
    transform: translateX(50%) translateY(0);
}

/* Letztes Icon: Tooltip nach innen schieben, damit es nicht abgeschnitten wird */
.icon-nav .icon-btn:last-child::after {
    right: 0;
    transform: translateX(0) translateY(4px);
}

.icon-nav .icon-btn:last-child:hover::after,
.icon-nav .icon-btn:last-child:focus-visible::after {
    transform: translateX(0) translateY(0);
}

.tag-admin {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    vertical-align: middle;
}

/* Rollen-Pills (gleich breit, zentriert) */
.role-pill {
    display: inline-block;
    min-width: 92px;
    text-align: center;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.role-pill--admin {
    background: var(--color-primary);
}

.role-pill--user {
    background: #9ca3af;
}

/* --- Auth-Seiten (Login / Setup) ----------------------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-block: 2rem;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}

.auth-alt {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* Button-Reihe nebeneinander */
.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* Kleine Zähler-Badge (z. B. offene Registrierungen) */
.badge-count {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

/* --- Formulare ----------------------------------------------------------- */
.form {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-input {
    font: inherit;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 1rem;
    background: #fff;
    color: var(--color-text);
}

.form-input:focus {
    outline: none;
    border-color: #9ca3af;
    background: #eef0f2;
}

/* Label-Zeile mit Info-Icon */
.label-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
}

.label-row .form-label {
    margin-bottom: 0;
}

.info {
    position: relative;
    display: inline-flex;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-muted);
    cursor: pointer;
}

.info-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.info-icon:hover {
    color: var(--color-primary);
}

.info-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: -6px;
    transform: translateY(4px);
    width: max-content;
    max-width: 250px;
    background: var(--color-text);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 0.55rem 0.7rem;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 20;
}

.info:hover .info-bubble,
.info-icon:focus + .info-bubble {
    opacity: 1;
    transform: translateY(0);
}

.form-error {
    background: #fef2f2;
    color: var(--color-error);
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.1rem;
    display: inline-block;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.btn--primary:link,
.btn--primary:visited {
    color: #fff;
}

.btn--primary:hover {
    background: #c20000;
    color: #fff;
}

/* --- Links --------------------------------------------------------------- */
a:link,
a:visited {
    color: #444444;
    text-decoration: none;
}

a:hover {
    color: #d42c1f;
}

/* --- Farbklassen (Vodafone-Palette) -------------------------------------- */
.turquoise    { color: #00697C; }
.aquablue     { color: #00B0CA; }
.aubergine    { color: #5E2750; }
.redviolet    { color: #9C2AA0; }
.springgreen  { color: #A8B400; }
.freshorange  { color: #EB6100; }
.lemonyellow  { color: #FECB00; }
.slategrey    { color: #25282B; }
.grey         { color: #4A4D4E; }
.vodafonered  { color: #E60000; }
.vodafonedarkred { color: #820000; }

/* --- Alerts (Flash-Nachrichten) ------------------------------------------ */
.alert {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert--success {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.alert--error {
    background: #fef2f2;
    color: var(--color-error);
    border-color: #fecaca;
}

/* --- Karten -------------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.75rem;
}

.card-title {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
}

/* Karten-Kopf mit Titel links und Icon rechts */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}

.card-head .card-title {
    margin-bottom: 0;
}

/* Aufklappbare Karte (<details>) */
.card--collapsible {
    padding: 0;
    overflow: hidden;
    transition: opacity 0.15s ease;
}

.card--collapsible:not([open]) {
    opacity: 0.6;
}

.card--collapsible:hover {
    opacity: 1;
}

.card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.75rem;
    cursor: pointer;
    list-style: none;
}

.card-summary::-webkit-details-marker {
    display: none;
}

.card-summary .card-title {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

/* Aktions-Icons im Registrierungs-Kopf */
.reg-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.card-body {
    padding: 0 1.75rem 1.75rem;
}

/* Plus-Icon im Aufklapp-Kopf: dreht sich beim Öffnen zum × */
.summary-icon {
    transition: transform 0.2s ease, color 0.15s ease;
}

/* Kein Hover-Hintergrund und keine (leere) Tooltip-Box am Summary-Icon */
.summary-icon::after {
    display: none;
}

.summary-icon:hover,
.summary-icon:focus-visible {
    background: transparent;
}

details[open] > .card-summary .summary-icon {
    transform: rotate(45deg);
}

/* --- Segmented Control (Links-Rechts-Auswahl) ---------------------------- */
.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #eef0f2;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.segmented label {
    flex: 1;
    cursor: pointer;
}

.segmented input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.segmented span {
    display: block;
    text-align: center;
    padding: 0.55rem 0.75rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-muted);
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented input:checked + span {
    background: #fff;
    color: var(--color-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.segmented input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(230, 0, 0, 0.15);
}

/* --- Karten als Link (Admin-Hub) ----------------------------------------- */
.card--link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card--link:link,
.card--link:visited {
    color: inherit;
}

.card--link:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    color: inherit;
}

.card-stat {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.1;
}

.card-desc {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* --- Buttons (Varianten) ------------------------------------------------- */
.btn--danger {
    background: var(--color-error);
    color: #fff;
}

.btn--danger:hover {
    background: #b91c1c;
    color: #fff;
}

.btn--ok {
    background: var(--color-ok);
    color: #fff;
}

.btn--ok:hover {
    background: #15803d;
    color: #fff;
}

.btn--ghost {
    background: #f3f4f6;
    color: var(--color-muted);
}

.btn--ghost:link,
.btn--ghost:visited {
    color: var(--color-muted);
}

.btn--ghost:hover {
    background: #e5e7eb;
    color: var(--color-text);
}

.btn--small {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

/* Icon-only Button (runde Bubble, z. B. Papierkorb) */
.btn--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem;
    border-radius: 999px;
    line-height: 0;
}

.btn--icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* --- Tabellen ------------------------------------------------------------ */
.table-wrap {
    overflow-x: auto;
}

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

.table th,
.table td {
    text-align: left;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
}

.table-actions {
    text-align: right;
}

.text-muted {
    color: var(--color-muted);
    font-weight: 400;
}

/* Werkzeugleiste über der Tabelle (Suche + Filter) */
.table-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input.table-search {
    width: 240px;
    max-width: 50vw;
}

.filter {
    position: relative;
}

.icon-btn--active {
    background: #fdecec;
    color: var(--color-primary);
}

.filter-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 190px;
    max-height: 300px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 0.35rem;
    display: none;
    z-index: 30;
}

.filter-menu.open {
    display: block;
}

.filter-menu button {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    background: none;
    border: none;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
}

.filter-menu button:hover {
    background: #f3f4f6;
}

.filter-menu button.active {
    background: #fdecec;
    color: var(--color-primary);
    font-weight: 600;
}

/* Inline-Bearbeitung in Tabellen (z. B. Shop) */
.shop-form {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-input--inline {
    margin-bottom: 0;
    padding: 0.35rem 0.55rem;
    min-width: 120px;
    width: 140px;
}

/* --- Antwort-Eingabe (Fragen anlegen) ------------------------------------ */
.answer-row {
    display: flex;
    align-items: stretch;   /* Toggle so hoch wie das Textfeld */
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.answer-input {
    flex: 1;
    margin-bottom: 0;
}

/* Richtig-Schalter: Knopf rutscht nach rechts und wird grün */
.answer-switch {
    display: flex;
    cursor: pointer;
}

.answer-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch {
    position: relative;
    width: 74px;
    background: #e5e7eb;
    border-radius: 8px;
    transition: background-color 0.18s ease, box-shadow 0.15s ease;
}

.switch-knob {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    color: transparent;
    transition: transform 0.18s ease, background-color 0.15s ease, color 0.15s ease;
}

.switch-knob svg {
    width: 18px;
    height: 18px;
}

.answer-switch input:checked + .switch {
    background: #c7f0d8;
}

.answer-switch input:checked + .switch .switch-knob {
    transform: translateX(100%);
    background: var(--color-ok);
}

.answer-switch input:focus-visible + .switch {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

/* --- Fragen-Liste (aufklappbar) ------------------------------------------ */
.q-item {
    border-bottom: 1px solid #e5e7eb;
}

.q-item:last-of-type {
    border-bottom: none;
}

.q-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0;
    cursor: pointer;
    list-style: none;
}

.q-summary::-webkit-details-marker {
    display: none;
}

.q-text {
    flex: 1;
    min-width: 0;
    font-weight: 400;
}

.q-edit,
.q-delete {
    flex-shrink: 0;
}

.q-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-muted);
    transition: transform 0.2s ease;
}

.q-item[open] .q-chevron {
    transform: rotate(180deg);
}

.answer-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-bottom: 0.85rem;
}

.answer-list li {
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.answer-ok {
    background: #ecfdf5;
    color: #047857;
}

.answer-no {
    background: #f3f4f6;
    color: var(--color-muted);
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 600px) {
    .container {
        padding-inline: 1rem;
    }

    .brand {
        font-size: 1.05rem;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .page {
        padding-block: 1.25rem;
    }

    .hero {
        padding: 1.5rem;
    }

    .auth-card {
        padding: 1.5rem;
    }
}

/* Touch-Geräte: kein Hover -> Tooltip per :active kurz zeigen */
@media (hover: none) {
    .icon-btn:active::after {
        opacity: 1;
        transform: translateX(50%) translateY(0);
    }

    .icon-nav .icon-btn:last-child:active::after {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}
