/* --- 1. BASIS SETUP --- */
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f6f6f3;   /* soft off-white, matching the Maturaarbeit-Begleiter / Dashboard */
    margin: 0;
    color: #1e293b;
    line-height: 1.5;
    /* Sticky-footer layout: header + content + footer stacked full height */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- 2. HEADER & NAVIGATION (Responsive) --- */
header {
    display: flex;
    justify-content: space-between; /* Logo links, Nav rechts */
    align-items: center;           /* Vertikal zentrieren */
    padding: 12px 22px;            /* unified with the rest of the suite (logo corner identical across apps) */
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
    position: relative;            /* Basis für das mobile Menü */
}

/* "Support Tools" lockup — matches the Dashboard / Maturaarbeit-Begleiter header */
.logo-container .lockup {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
}
.logo-container .logo {
    height: 36px;
    width: calc(36px * 4.66);   /* explicit width (DE viewBox 466/100) — prevents flex 'stretch' from distorting the SVG */
    flex: 0 0 auto;
    display: block;
}
html:not([lang='de']) .logo-container .logo {
    width: calc(36px * 4.81553);   /* EN viewBox 496/103 */
}
.brand-sub {
    /* left-align with the "U" of «Universität St.Gallen», not the emblem (DE logo k=1.1) */
    margin-left: calc(36px * 1.1);
    display: flex;
    flex-direction: column;
}
html:not([lang='de']) .brand-sub {
    /* EN logo (shown for any non-German UI) viewBox h=103, U at x=110 → k=1.068 */
    margin-left: calc(36px * 1.068);
}
.suite, .apptitle {
    font-family: "Gill Sans MT", "Gill Sans", Calibri, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
}
.suite {
    font-size: 14px;
    font-weight: 600;
    color: #231f20;
    line-height: 1.2;
}
.suite .sep {
    color: #6b6a66;
    font-weight: 400;
    margin: 0 0.45em;
}
.apptitle {
    font-size: 12.5px;
    font-weight: 600;
    color: #00802f;
    margin-top: 5px;
    line-height: 1.1;
}

nav { 
    display: flex; 
    gap: 25px; 
    align-items: center;
}

nav a { 
    text-decoration: none; 
    color: #333; 
    font-size: 0.9em; 
    font-weight: 500; 
    padding-bottom: 5px;
    transition: 0.2s;
    border-bottom: 2px solid transparent;
}

nav a:hover, nav a.active { 
    color: #00802f; 
    border-bottom: 2px solid #00802f; 
}

/* Der Hamburger-Button (standardmäßig versteckt) */
.menu-toggle {
    display: none; 
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    border-radius: 2px;
}

/* --- 3. CONTAINER & MARKT-INFO --- */
.container { 
    max-width: 1000px; 
    margin: 30px auto; 
    padding: 0 20px; 
}

.market-info {
    display: flex;
    justify-content: space-between;
    background: #f8fafc;
    padding: 15px 25px;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* --- 4. CHART (Fixer Platzhalter) --- */
#chart {
    display: block;
    width: 100%;
    height: 250px;
    background-color: #f8fafc;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid #f1f5f9;
}

/* --- 5. STRATEGIE GRID (KACHELN) --- */
.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.rule-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s ease;
}

.rule-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.05);
}

.switch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.switch-header h4 { margin: 0; font-size: 1.1em; }

/* --- 6. iOS SWITCH DESIGN --- */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.ios-switch input { opacity: 0; width: 0; height: 0; }

.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e2e8f0;
    transition: .3s;
    border-radius: 24px;
}

.ios-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .ios-slider { background-color: #00802f; }
input:checked + .ios-slider:before { transform: translateX(22px); }

/* --- 7. INPUTS & BUTTONS --- */
.input-group {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9em;
    color: #64748b;
}

.input-group input {
    width: 55px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 3px;
    text-align: center;
}

.btn-start {
    background: #00802f;
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    transition: 0.2s;
    width: auto;
    min-width: 200px;
}

.btn-start:hover { background: #00563e; transform: scale(1.02); }
.btn-start.running { background: #ef4444 !important; }

/* --- 8. FOOTER STATS --- */
.footer-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: #f1f5f9;
    border-radius: 10px;
}

/* --- 9. MOBILE OPTIMIERUNG (Breakpoints) --- */
@media (max-width: 850px) {
    header { padding: 10px 20px; }
    
    .menu-toggle { display: flex; } /* Hamburger einblenden */

    nav {
        display: none; /* Menü verstecken */
        flex-direction: column;
        position: absolute;
        top: 100%; 
        left: 0;
        width: 100%;
        background: white;
        border-bottom: 1px solid #eee;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
        z-index: 1000;
        gap: 0;
    }

    nav.active { display: flex; } /* Menü einblenden wenn aktiv */

    nav a {
        padding: 15px 25px;
        width: 100%;
        border-bottom: 1px solid #f8fafc;
        box-sizing: border-box;
    }

    nav a.active { border-bottom: none; border-left: 4px solid #00802f; }
}

/* --- 10. HOME-PAGE SPEZIFISCH (Kompakte Kacheln) --- */
.welcome-section {
    text-align: center;
    padding: 30px 20px;
}

.welcome-section h1 {
    color: #006b4d;
    font-size: 2.2em;
    margin-bottom: 8px;
}

.lesson-grid {
    display: grid;
    /* Kompakter: Mindestbreite 220px statt 300px */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.lesson-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 150px;
}

.lesson-card:hover {
    transform: translateY(-5px);
    border-color: #006b4d;
    box-shadow: 0 6px 15px rgba(0,0,0,0.05);
}

.lesson-card .icon {
    font-size: 2.2em;
    margin-bottom: 10px;
}

.lesson-card h3 {
    margin: 5px 0;
    font-size: 1.1em;
    color: #1e293b;
}

.lesson-card p {
    font-size: 0.85em;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
}

/* Spezial-Stil für die Final Challenge */
.challenge-highlight {
    background: #f0fdf4 !important;
    border: 2px solid #006b4d !important;
}

/* Styling für die Top 3 Plätze */
.rank-1 { 
    background-color: rgba(255, 215, 0, 0.15) !important; /* Gold Hauch */
    font-weight: bold;
    border-left: 5px solid #ffd700 !important; 
}
.rank-2 { 
    background-color: rgba(192, 192, 192, 0.15) !important; /* Silber Hauch */
    border-left: 5px solid #c0c0c0 !important; 
}
.rank-3 { 
    background-color: rgba(205, 127, 50, 0.15) !important; /* Bronze Hauch */
    border-left: 5px solid #cd7f32 !important; 
}

/* Icons für die Top 3 */
.rank-1 td:first-child::after { content: " 🥇"; }
.rank-2 td:first-child::after { content: " 🥈"; }
.rank-3 td:first-child::after { content: " 🥉"; }

/* Animation für den Erstplatzierten */
.rank-1 {
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { box-shadow: inset 0 0 5px rgba(255, 215, 0, 0.2); }
    to { box-shadow: inset 0 0 15px rgba(255, 215, 0, 0.4); }
}

/* --- 11. CHALLENGE & ADMIN ERWEITERUNGEN --- */

/* Wiederverwendung der .card für das Setup-Screen */
.setup-container {
    max-width: 450px;
    margin: 60px auto;
    text-align: center;
}

/* Spezifische Inputs für Login/Raum-Erstellung (erbt Font/Farben) */
.setup-container input[type="text"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1em;
    box-sizing: border-box;
}

/* Status-Anzeige (Server/Raum) */
.status-bar {
    font-size: 0.8em;
    color: #64748b;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444; /* Standard: Fehler/Inaktiv */
}

.status-dot.online { background: #10b981; } /* Grün */
.status-dot.waiting { background: #f59e0b; } /* Orange */

/* Buttons auf volle Breite zwingen (nur im Setup) */
.btn-block {
    width: 100%;
    display: block;
}

/* Strategie-Tags (Wiederverwendbar für Challenge-Kacheln) */
.card-tag { 
    font-size: 0.7em; 
    font-weight: bold; 
    padding: 3px 8px; 
    border-radius: 4px; 
    margin-bottom: 10px; 
    display: inline-block;
}
.tag-single { background: #e2e8f0; color: #475569; }
.tag-allin { background: #006b4d; color: white; }

/* Akzentuierung für die All-In Karten */
.rule-card.allin {
    border-left: 5px solid #006b4d;
    background: #f0fdf4;
}

/* --- 12. SITE FOOTER (LabVentures) --- */
/* Footer formatted to match the rest of the Support Tools suite
   (Gill Sans MT, 12.5px, muted grey, centred). */
.site-footer {
    margin-top: auto;                 /* sticks the footer to the bottom of the viewport on short pages */
    border-top: 1px solid #e6e7e8;    /* full-width grey divider, matching the header's bottom border */
    background: #ffffff;
    padding: 18px 22px;
    text-align: center;
    color: #6b6a66;
    font-family: "Gill Sans MT", "Gill Sans", Calibri, "Segoe UI", system-ui, Helvetica, Arial, sans-serif;
    font-size: 12.5px;
    line-height: 1.55;
}
.site-footer p { margin: 3px 0; }
.site-footer .foot-disclaimer {           /* kept, but in the suite footer style */
    max-width: 760px;
    margin: 3px auto 8px;
}
.site-footer .foot-disclaimer strong { color: #231f20; }
.site-footer a { color: #00802f; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
@media (max-width: 850px) {
    .site-footer { padding: 16px 20px; }
}

/* --- 13. LEGAL / PRIVACY PAGES --- */
.legal-page { max-width: 760px; }
.legal-page .badge {
    display: inline-block;
    background: #f0fdf4;
    color: #006b4d;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.legal-page h1 { color: #006b4d; margin: 0 0 8px; font-size: 2em; }
.legal-page .lead { color: #64748b; margin: 0 0 24px; }
.legal-page h2 { font-size: 1.15em; margin: 28px 0 8px; }
.legal-rows {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}
.legal-row {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
}
.legal-row:last-child { border-bottom: none; }
.legal-row .k { color: #64748b; font-size: 0.9em; font-weight: 600; }
.legal-muted { color: #94a3b8; }
.legal-note { display: block; color: #94a3b8; font-size: 0.85em; margin-top: 6px; }
.legal-callout {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 14px 18px;
    color: #14532d;
    margin: 0 0 12px;
}
@media (max-width: 560px) {
    .legal-row { grid-template-columns: 1fr; gap: 2px; }
}
