*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root{
    --brand-blue: #1e6fff;
    --brand-light-blue: #4d94ff;
    --brand-neon-lime: #B6FF00;

    --brand-red: #E6304C;
    --brand-bright-red: #FF5C72;
    --brand-night-sky-blue: #4d21eb;

    --background: #0a0e14;
    --bg-card: #131924;
    --bg-elevated: #1c2330;
    --border: #232a36;

    --font: #e8ecf4;
    --font-secundary: #8b95a8;
    --muted: #4A5568;
}

body {
    font-family: 'Orbitron', sans-serif;
    /* Lange Wörter (z. B. "Datenschutzerklärung") dürfen auf schmalen Bildschirmen umbrechen */
    overflow-wrap: break-word;
    background-color: var(--background);
    color: var(--font);
    line-height: 1.6;
    /* Footer bleibt auch bei kurzen Seiten unten */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content { flex: 1; }

/* Seiten mit nur einem Formular (Login, Passwort): Karte vertikal mittig */
.content:has(> .form-page) {
    display: flex;
    align-items: center;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Valorant', sans-serif;
    hyphens: auto;
}

/* ------------------------------------- Header Styles ------------------------------------- */

.header {
    background-color: var(--bg-elevated);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    height: 50px;
}

.header a {
    color: var(--brand-dark-blue);
    text-decoration: none;
    margin: 0 1rem;
    font-weight: bold;
}

.header-cta-container {
    display: flex;
    align-items: center;
    color: var(--brand-dark-red);
}

/* Desktop: Navigation und Login-Links stehen direkt im Header */
.header-menu {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.header-menu nav { display: flex; flex-wrap: wrap; justify-content: center; flex: 1; }
.header-toggle { display: none; }
/* Reihenfolge: Logo | Menü | Glocke | Burger (Glocke ganz rechts, auf dem Handy neben dem Burger) */
.header-menu { order: 1; }
.header-toggle { order: 3; }

/* Mittlere Breiten: Navigation enger, damit sie mit Glocke in eine Zeile passt */
@media (min-width: 901px) and (max-width: 1200px) {
    .header a, .header-logout button { margin: 0 0.55rem; font-size: 0.9rem; }
    .header-logo { height: 42px; }
}

/* Mobil: Burger-Button, Menü klappt unter dem Header auf */
@media (max-width: 900px) {
    .header { position: relative; z-index: 50; padding: 0.75rem 16px; }
    .header-logo { height: 40px; }
    .bell { margin-left: auto; }
    .header-toggle {
        margin-left: 0.5rem;
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 44px;
        height: 44px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--bg-card);
        cursor: pointer;
    }
    .header-toggle span {
        display: block;
        height: 2px;
        border-radius: 2px;
        background: var(--font);
        transition: transform 0.2s ease, opacity 0.2s ease;
    }
    .header-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .header-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .header-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .header-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 16px 1rem;
        background: var(--bg-elevated);
        border-top: 1px solid var(--border);
        box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
    }
    .header-menu.is-open { display: flex; }
    .header-menu nav,
    .header-cta-container { flex-direction: column; align-items: stretch; }
    .header-menu a,
    .header-menu .header-logout button {
        display: block;
        margin: 0;
        padding: 0.8rem 0.25rem;
        border-bottom: 1px solid var(--border);
        text-align: left;
        width: 100%;
    }
    .header-cta-container { margin-top: 0.5rem; }
    .header-cta-container > :last-child,
    .header-cta-container > :last-child button { border-bottom: none; }
    .header-sep { display: none; }
    .header-logout { display: block; }
}

/* ------------------------------------- Footer Styles ------------------------------------- */

footer {
    background-color: var(--bg-elevated);
    padding: 1rem;
    text-align: center;
}

.footer-section-heading {
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--font);
    text-transform: uppercase;
    font-family: 'Valorant', sans-serif;
}

footer a {
    color: var(--brand-dark-red);
    text-decoration: none;
}

.footer-links {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1.5rem 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 700px) {
    footer { padding: 2rem 16px 1rem; }
    .footer-links {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.75rem 1rem;
        margin-bottom: 1.5rem;
    }
    .footer-column a { padding: 0.2rem 0; }
}

.footer-column {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.footer-social-icon {
    width: 16px;
    height: 16px;
}

.footer-social-link {
    color: var(--brand-dark-blue) !important;
}
/* ------------------------------------- Rank-Badge (macros/rank.html) ------------------------------------- */

.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}
.rank-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
.rank-badge--sm .rank-icon { width: 28px; height: 28px; }
.rank-badge--lg .rank-icon { width: 80px; height: 80px; }

.rank-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}
.rank-name {
    font-weight: 700;
    color: var(--font);
}
.rank-badge--lg .rank-name { font-size: 1.25rem; }
.rank-rr,
.rank-peak {
    font-size: 0.8rem;
    color: var(--font-secundary);
}
.rank-change { font-weight: 700; margin-left: 0.25rem; }
.rank-change--up { color: var(--brand-neon-lime); }
.rank-change--down { color: var(--brand-bright-red); }
.rank-peak {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.rank-peak-icon { width: 16px; height: 16px; }

/* ------------------------------------- Buttons ------------------------------------- */

.btn-row {
    margin-top: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}
.btn {
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
    background: #4D21EB;
    color: #EDEAFA;
    box-shadow: 0 0 0 rgba(77, 33, 235, 0);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(77, 33, 235, 0.45); }
.btn-secondary {
    background: rgba(10, 14, 22, 0.6);
    color: #EDEAFA;
    border-color: #3A2F6B;
}
.btn-secondary:hover {
    border-color: #B6FF00;
    color: #B6FF00;
}
.btn-danger {
    background: transparent;
    color: var(--brand-bright-red);
    border-color: rgba(230, 48, 76, 0.5);
}
.btn-danger:hover { background: rgba(230, 48, 76, 0.12); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }

/* ------------------------------------- Meldungen (flash) ------------------------------------- */

.flash-list {
    max-width: 1100px;
    margin: 1rem auto 0;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 0.9rem;
}
.flash-success { border-color: rgba(182, 255, 0, 0.5); }
.flash-error { border-color: rgba(230, 48, 76, 0.6); }
.flash-info { border-color: rgba(77, 33, 235, 0.7); }

/* ------------------------------------- Formulare ------------------------------------- */

.form-page {
    width: 100%;
    max-width: 420px;
    margin: 2rem auto;
    padding: 0 16px;
}
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
}
.form-card h1 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}
.form-hint {
    color: var(--font-secundary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}
.form-field label {
    font-size: 0.85rem;
    color: var(--font-secundary);
}
.form-field input[type="text"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--font);
    font: inherit;
}
.form-field textarea { resize: vertical; min-height: 5rem; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #4D21EB;
    box-shadow: 0 0 0 3px rgba(77, 33, 235, 0.25);
}
.field-error {
    color: var(--brand-bright-red);
    font-size: 0.8rem;
}
.form-card .btn { width: 100%; margin-top: 0.5rem; }

/* Checkbox-Liste (WTForms ListWidget) */
.checkbox-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}
.checkbox-list li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
}
.checkbox-list input { accent-color: #4D21EB; }

/* ------------------------------------- Header: eingeloggt ------------------------------------- */

.header-logout { display: inline; }
.header-logout button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
    margin: 0 1rem;
    padding: 0;
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--font-secundary);
}

/* 6-stelliger Code (2FA) */
.form-field .code-input {
    font-size: 1.6rem;
    letter-spacing: 0.4em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.form-hint--after {
    margin: 1.25rem 0 0;
    font-size: 0.8rem;
}

/* ------------------------------------- Fehlerseiten (error_pages.py) ------------------------------------- */
.error-page {
    max-width: 640px;
    margin: 0 auto;
    padding: clamp(3rem, 12vh, 7rem) 16px 5rem;
    text-align: center;
    background: var(--background);
    color: var(--font);
}
.error-code {
    margin: 0;
    font: 800 clamp(4.5rem, 22vw, 9rem)/1 "Exo 2", system-ui, sans-serif;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, #8f74ff, var(--brand-neon-lime, #b6ff00));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-page h1 { margin: 0.75rem 0 0.6rem; font-size: clamp(1.4rem, 5vw, 2rem); }
.error-page p { color: var(--font-secundary, #a9b1c3); line-height: 1.6; }
.error-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.75rem; }
