/* =========================================================
   EPICA: LOGINSEITE (login.css)
   Aufbau: Kopfleiste (Einstellungen | Logo | Sprache)
           Mitte (Updates | Login + Serverliste | Info-Knöpfe)
           Fußzeile (AGB | Datenschutz | Impressum)
========================================================= */

[hidden] { display: none !important; }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---------- Grundgerüst + Hintergrund je Design ----------
   PERFORMANCE (Sep 2026): vorher background-attachment: fixed. Zusammen mit den verschwommenen Kästen
   (backdrop-filter) musste der Browser bei JEDEM Scroll-Schritt das ganze Bild neu malen und neu weichzeichnen
   -> die Loginseite ruckelte. Jetzt liegt das Bild auf einer eigenen, festen Ebene (::before), die der Browser
   einmal malt und beim Scrollen nur noch verschiebt. auth.js setzt das Bild über die Variable --lp-bg. */
.lp {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    isolation: isolate;
    background: transparent;
    color: #f3e5ab;
    font-size: 15px;
}
.lp::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-color: var(--bg-color);
    background-image: var(--lp-bg);
    background-size: cover;
    background-position: center;
    will-change: transform;
    pointer-events: none;
}
body.fantasy .lp { --lp-bg: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.55)), url('../../assets/login/fantasyhg.webp'); }
body.scifi .lp   { --lp-bg: linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.6)), url('../../assets/login/scifihg.webp'); color: #e0f7fa; }

/* Globale Button-Styles aus style.css auf der Loginseite zurücksetzen */
.lp button, .lp-modal button {
    width: auto;
    margin: 0;
    text-transform: none;
}

.lp a { color: var(--primary); }
.lp a:hover { text-decoration: underline; }
.lp :focus-visible, .lp-modal :focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.lp-muted { color: #bbb; }
.lp-small { font-size: 12px; margin: -8px 0 12px; }

/* ---------- Kopfleiste ---------- */
.lp-topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 20px;
}
.lp-top-left { justify-self: start; }
.lp-top-right { justify-self: end; }

.lp-logo img {
    display: block;
    width: 260px;
    max-width: 42vw;
    height: auto;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.8));
    transition: transform 0.2s;
}
.lp-logo:hover img { transform: scale(1.04); }

.lp-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--panel-bg);
    color: var(--primary);
    border: 1px solid var(--primary-dark);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

.lp-lang-select {
    width: auto;
    min-width: 180px;
    margin: 0;
    padding: 8px 10px;
    background: var(--panel-bg);
    color: #fff;
    border: 1px solid var(--primary-dark);
    border-radius: 6px;
    cursor: pointer;
}

/* ---------- Einstellungen ---------- */
.lp-settings {
    position: absolute;
    top: 64px;
    left: 20px;
    z-index: 50;
    width: 300px;
    max-width: calc(100vw - 40px);
    padding: 16px 18px;
    background: rgba(15, 12, 8, 0.96);
    border: 2px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
body.scifi .lp-settings { background: rgba(5, 15, 25, 0.96); }
.lp-settings h2 { margin: 0 0 12px; font-size: 18px; color: var(--primary); }
.lp-settings label { display: block; margin-bottom: 4px; font-size: 13px; }
.lp-settings select { width: 100%; margin-bottom: 14px; }
.lp-settings input[type="range"] { width: 100%; padding: 0; margin: 0 0 14px; accent-color: var(--primary); }
.lp-a11y { border: 1px solid var(--primary-dark); border-radius: 6px; padding: 8px 12px; margin: 0 0 14px; }
.lp-a11y legend { padding: 0 6px; color: var(--primary); font-size: 13px; }
.lp-a11y label { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.lp-a11y input { width: auto; margin: 0; }

/* ---------- Mitte: 3 Spalten ---------- */
.lp-main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(320px, 420px) minmax(200px, 260px);
    justify-content: center;
    align-items: start;
    gap: 28px;
    padding: 10px 20px 30px;
}

.lp-panel {
    background: var(--panel-bg);
    border: 1px solid var(--primary-dark);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
}

/* Links: Updates */
.lp-updates { padding: 14px 16px; margin-top: 40px; }
.lp-updates h2 { margin: 0 0 10px; font-size: 18px; color: var(--primary); border-bottom: 1px solid var(--primary-dark); padding-bottom: 8px; }
.lp-updates-list { max-height: 420px; overflow-y: auto; padding-right: 4px; }
.lp-update { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.lp-update:last-child { border-bottom: none; }
.lp-update h3 { margin: 0 0 6px; font-size: 15px; color: #fff; }
.lp-update-text { font-size: 13px; line-height: 1.5; color: #ddd; }
.lp-media { display: block; max-width: 100%; border-radius: 6px; margin: 6px 0; }

/* Mitte: Loginfenster */
.lp-login-box {
    position: relative;
    padding: 18px 26px 22px;
    background: rgba(20, 18, 16, 0.92);
    box-shadow: 0 10px 35px rgba(0,0,0,0.85);
}
body.fantasy .lp-login-box {
    border: 26px solid transparent;
    border-image: url('../../assets/login/umrandung_fantasy.png') 48 stretch;
    background-clip: padding-box;
    padding: 6px 10px 14px;
}
body.scifi .lp-login-box {
    background: rgba(5, 15, 25, 0.92);
    border: 2px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(0, 242, 255, 0.25), 0 10px 35px rgba(0,0,0,0.85);
}

.lp-theme-tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.lp-theme-tab {
    flex: 1;
    padding: 7px 8px;
    font-size: 13px;
    background: rgba(0,0,0,0.5);
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
}
.lp-theme-tab[aria-pressed="true"] { background: var(--primary); color: #000; border-color: var(--primary); font-weight: bold; }
.lp-theme-tab:disabled { opacity: 0.45; cursor: not-allowed; }

.lp-form h2 { margin: 4px 0 4px; font-size: 22px; text-align: center; color: var(--primary); }
.lp-hint { margin: 0 0 14px; text-align: center; font-size: 13px; color: #ccc; }
.lp-form label { display: block; margin-bottom: 4px; font-size: 13px; color: #e8dcb0; }
body.scifi .lp-form label { color: #bfeff5; }
.lp-form input[type="text"], .lp-form input[type="password"], .lp-form input[type="email"] { margin-bottom: 12px; }

.lp-check { display: flex !important; align-items: flex-start; gap: 8px; margin: 4px 0 12px !important; cursor: pointer; line-height: 1.4; }
.lp-check input { width: auto; margin: 3px 0 0; flex-shrink: 0; }

.lp-btn {
    display: block;
    width: 100% !important;
    padding: 11px 16px;
    font-size: 15px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
}
.lp-btn-main { margin-top: 4px !important; letter-spacing: 1px; }
.lp-btn-secondary { margin-top: 8px !important; background: rgba(0,0,0,0.5); color: #ddd; border: 1px solid #666; }
.lp-btn:disabled { opacity: 0.6; cursor: wait; }

.lp-links { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; text-align: center; }

.lp-msg { min-height: 0; margin: 0; font-size: 13px; border-radius: 4px; }
.lp-msg-error, .lp-msg-success { padding: 8px 10px; margin-bottom: 10px; }
.lp-msg-error { background: rgba(231, 76, 60, 0.18); border: 1px solid #e74c3c; color: #ffb3aa; }
.lp-msg-success { background: rgba(46, 204, 113, 0.18); border: 1px solid #2ecc71; color: #b6f5cf; }

/* Bot-Falle unsichtbar */
.lp-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Unter dem Login: Serverliste mit Lämpchen */
.lp-server-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--panel-bg);
    border: 1px solid var(--primary-dark);
    border-radius: 8px;
}
.lp-server-bar label { font-size: 13px; color: var(--primary); white-space: nowrap; }
.lp-server-bar select { flex: 1; margin: 0; padding: 7px; min-width: 0; }
.lp-server-status { font-size: 12px; color: #ccc; white-space: nowrap; }

.lp-lamp { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: #777; }
.lp-lamp-online { background: #2ecc71; box-shadow: 0 0 8px #2ecc71; animation: lpPulse 2s infinite; }
.lp-lamp-maintenance { background: #f39c12; box-shadow: 0 0 8px #f39c12; }
.lp-lamp-offline { background: #e74c3c; box-shadow: 0 0 8px #e74c3c; }
@keyframes lpPulse { 50% { opacity: 0.5; } }

/* Rechts: Info-Knöpfe */
.lp-info {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 40px;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}
.lp-info-btn {
    width: 100% !important;
    min-height: 64px;
    padding: 12px 18px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--primary);
    background: var(--panel-bg);
    border: 1px solid var(--primary-dark);
    border-radius: 8px;
    cursor: pointer;
    text-shadow: 0 2px 4px #000;
    transition: transform 0.15s, filter 0.15s;
}
/* Fantasy: Schild-Grafik (Motiv füllt ca. 63 % des Bildes -> vergrößert zuschneiden) */
body.fantasy .lp-info-btn {
    background: url('../../assets/login/button.png') center / 160% 175% no-repeat;
    border: none;
    color: #f3d98a;
    min-height: 72px;
}
body.scifi .lp-info-btn { border-color: var(--primary); box-shadow: inset 0 0 12px rgba(0, 242, 255, 0.2); }
.lp-info-btn:hover:not(:disabled) { transform: scale(1.04); filter: brightness(1.2); }
.lp-info-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Handy-Knopf (nur mobil sichtbar) ---------- */
.lp-mobile-toggle { display: none; }

/* ---------- Fußzeile ---------- */
.lp-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px 16px;
    background: rgba(0,0,0,0.6);
    font-size: 13px;
}
.lp-footer nav { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lp-footer small { color: #999; }

.lp-noscript { text-align: center; padding: 10px; background: #e74c3c; color: #fff; }

/* ---------- Popup ---------- */
.lp-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
}
.lp-modal-box {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px 26px;
    background: var(--bg-color, #1a1510);
    color: #eee;
    border: 2px solid var(--primary, #d4af37);
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(0,0,0,0.9);
    text-align: left;
}
.lp-modal-box h2 { margin: 0 40px 16px 0; color: var(--primary, #d4af37); }
.lp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px !important;
    height: 36px;
    padding: 0 !important;
    background: #c0392b !important;
    color: #fff !important;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}
.lp-modal-body { line-height: 1.6; }
.lp-block { margin-bottom: 20px; }
.lp-block h3 { color: var(--primary, #d4af37); margin: 0 0 8px; }
.lp-faq { border: 1px solid var(--primary-dark, #8b6508); border-radius: 6px; margin-bottom: 8px; background: rgba(255,255,255,0.03); }
.lp-faq summary { padding: 10px 14px; cursor: pointer; font-weight: bold; color: var(--primary, #d4af37); }
.lp-faq > div { padding: 0 14px 12px; }
body.lp-modal-open { overflow: hidden; }

/* ---------- Barrierefreiheit ---------- */
body.a11y-large-text .lp,
body.a11y-large-text .lp-modal { font-size: 18px; }
body.a11y-large-text .lp-form label,
body.a11y-large-text .lp-update-text,
body.a11y-large-text .lp-hint { font-size: 16px; }
body.a11y-large-text .lp input,
body.a11y-large-text .lp select { font-size: 17px; }

body.a11y-high-contrast .lp { background-image: none !important; background-color: #000 !important; color: #fff; }
body.a11y-high-contrast .lp-panel,
body.a11y-high-contrast .lp-login-box,
body.a11y-high-contrast .lp-server-bar,
body.a11y-high-contrast .lp-modal-box,
body.a11y-high-contrast .lp-settings {
    background: #000 !important;
    border: 2px solid #ffff00 !important;
    border-image: none !important;
    color: #fff;
}
body.a11y-high-contrast .lp-info-btn { background: #000 !important; border: 2px solid #ffff00 !important; color: #ffff00 !important; }
body.a11y-high-contrast .lp a,
body.a11y-high-contrast .lp-form h2,
body.a11y-high-contrast .lp-form label { color: #ffff00 !important; }
body.a11y-high-contrast .lp-muted { color: #fff !important; }

body.a11y-reduce-motion *,
body.a11y-reduce-motion *::before,
body.a11y-reduce-motion *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
    .lp *, .lp-modal * { animation: none !important; transition: none !important; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
    .lp-main { grid-template-columns: minmax(200px, 250px) minmax(300px, 400px) minmax(180px, 220px); gap: 18px; }
}

/* ---------- Handy: nur Login als Aufklapp-Menü ---------- */
@media (max-width: 860px) {
    .lp-topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 8px 10px; }
    .lp-logo { justify-self: center; }
    .lp-logo img { width: 150px; }
    .lp-icon-label { display: none; }
    .lp-lang-select { min-width: 0; max-width: 130px; font-size: 13px; }
    .lp-settings { top: 58px; left: 10px; }

    .lp-main { display: block; padding: 10px 12px 20px; }
    .lp-updates, .lp-info { display: none; }

    .lp-mobile-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100% !important;
        padding: 14px 18px;
        font-size: 16px;
        font-weight: bold;
        border-radius: 8px;
        cursor: pointer;
    }
    .lp-mobile-toggle[aria-expanded="true"] span { transform: rotate(180deg); }

    .lp-login-wrap { display: none; margin-top: 10px; }
    .lp-login-wrap.open { display: block; }

    body.fantasy .lp-login-box { border-width: 18px; }
    .lp-server-bar { flex-wrap: wrap; }
}
