/* 1. GLOBALE & DESKTOP STYLES (Feste Browsergame-Ansicht) */
body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #020508;
    background-image: url('../../pics/background/bg.png');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    color: #e0e0e0;
    overflow: hidden;
    /* Verhindert das Scrollen der Hauptseite am Desktop */
}

/* Der Header bleibt oben fixiert */
header {
    background: rgba(10, 20, 30, 0.82);
    padding: 15px 25px;
    display: flex;
    justify-content: space-around;
    border-bottom: 2px solid #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.4);
    z-index: 100;
    flex: 0 0 auto;
}

/* Nav / Main / Aside gleiche Zeilenhöhe; kein äußeres Vertikal-Scroll (verhindert Doppel-Scrollbar mit Iframe) */
.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    flex-direction: row;
    align-items: stretch;
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    left: 10px;
    top: 86px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #00d4ff;
    background: rgba(10, 20, 30, 0.92);
    color: #00d4ff;
    font-size: 1.2rem;
    cursor: pointer;
}

.mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
}

/* Linke Navigation (Breite fixiert) */
nav {
    flex: 0 0 240px;
    background: rgba(10, 20, 30, 0.82);
    border-right: 1px solid #00d4ff;
    padding: 10px;
    padding-bottom: 2cm;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #468faf #020508;
}

/* Mittlerer Bereich: Flex-Spalte — Scroll nur im Iframe-Dokument oder in #contentInline */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.65);
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

main > iframe {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    border: none;
    display: block;
}

#contentInline {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #468faf #020508;
}

/* Rechte Seitenleiste (Breite fixiert) */
aside {
    flex: 0 0 220px;
    background: rgba(10, 20, 30, 0.82);
    border-left: 1px solid #00d4ff;
    padding: 10px;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* WICHTIG: Erzwingt die vertikale Stapelung */
    gap: 15px;
    /* Abstand zwischen Planetenliste und System-Log */
    scrollbar-width: thin;
    scrollbar-color: #468faf #020508;
}

nav::-webkit-scrollbar,
aside::-webkit-scrollbar,
#contentInline::-webkit-scrollbar {
    width: 4px;
}

nav::-webkit-scrollbar-track,
aside::-webkit-scrollbar-track,
#contentInline::-webkit-scrollbar-track {
    background: #020508;
}

nav::-webkit-scrollbar-thumb,
aside::-webkit-scrollbar-thumb,
#contentInline::-webkit-scrollbar-thumb {
    background: #468faf;
    border-radius: 10px;
}

nav::-webkit-scrollbar-thumb:hover,
aside::-webkit-scrollbar-thumb:hover,
#contentInline::-webkit-scrollbar-thumb:hover {
    background: #00d4ff;
}

.planet-list-container {
    display: block;
    /* Verhält sich wie ein normaler Block unter dem Titel */
    width: 100%;
}

/* --- UI ELEMENTE --- */

.res {
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px #00d4ff;
    font-family: 'Courier New', monospace;
    font-size: 1.1em;
}

.aside-title {
    color: #ffcc00;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
    border-bottom: 1px solid #00d4ff33;
    padding-bottom: 5px;
}

.admin-tools-box {
    margin-top: 12px;
    border: 1px solid #00d4ff33;
    border-radius: 6px;
    background: rgba(7, 14, 22, 0.85);
    padding: 8px;
}

.admin-tools-box .aside-title {
    margin-top: 0;
    margin-bottom: 8px;
}

.admin-tools-box > a {
    display: block;
    color: #00ffcc;
    background: rgba(17, 34, 51, 0.55);
    border: 1px solid #1b263b;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: 0.2s ease;
}

.admin-tools-box > a:hover {
    border-color: #00d4ff;
    background: #162d44;
}

.admin-tools-box > a:last-child {
    margin-bottom: 0;
}

.planet-card {
    background: #112233;
    border: 1px solid #468faf;
    padding: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    text-decoration: none;
    color: #e0e0e0;
    display: block;
    transition: 0.3s;
}

.planet-card:hover {
    border-color: #00d4ff;
    background: #162d44;
}

.planet-card.active {
    border-left: 4px solid #00ffcc;
    background: #1b3651;
}

.planet-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px;
}

.planet-card__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.planet-card__head .p-resources {
    margin-top: 0;
    flex-shrink: 0;
}

.p-name {
    display: block;
    font-weight: bold;
    font-size: 0.9em;
    color: #00ffcc;
}

.p-coords {
    font-size: 0.75em;
    color: #888;
    font-family: monospace;
}

.p-resources {
    display: block;
    text-align: right;
    font-size: 0.72rem;
    color: #9fd3c7;
    line-height: 1.25;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.p-resources__line {
    display: block;
    text-align: right;
}

/* Menü Kategorien (Akkordeon-Stil) */
.menu-category {
    margin-bottom: 10px;
    border: 1px solid #00d4ff33;
}

.category-title {
    background: #112233;
    padding: 12px;
    font-weight: bold;
    color: #ffcc00;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.nav-content {
    max-height: 0;
    opacity: 0;
    transition: 0.4s ease;
    background: #070e16;
    overflow: hidden;
}

.menu-category.active .nav-content {
    max-height: 500px;
    opacity: 1;
}

.nav-content a {
    display: block;
    color: #00ffcc;
    padding: 10px 20px;
    text-decoration: none;
    border-bottom: 1px solid #1b263b;
    font-size: 0.9em;
}

/* Badges & Animationen */
.badge {
    display: inline-block;
    background: linear-gradient(135deg, #ff0000 0%, #a30000 100%);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: 12px;
    animation: pulseBadge 2s infinite;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.version-badge {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.5);
    /* Halbtransparentes Schwarz */
    color: #080b2c;
    /* Dein Blau-Ton */
    font-family: monospace;
    font-size: 0.75em;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #00d4ff33;
    z-index: 9999;
    /* Damit es immer ganz oben liegt */
    pointer-events: none;
    /* Man kann durchklicken, falls was darunter liegt */
    letter-spacing: 1px;
}

/* Positionierung dezent in der Ecke */
.footer-info {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    /* Minimaler Abstand */
}

/* Kleinerer, dunklerer Badge-Stil */
.badge-item {
    display: inline-block;
    padding: 1px 6px;
    /* Sehr kompakt */
    background-color: #002d5a;
    /* Klassisches Dunkelblau */
    border: 1px solid #001a35;
    border-radius: 3px;
    font-family: sans-serif;
    font-size: 10px;
    /* Kleinere Schrift */
    color: rgba(255, 255, 255, 0.9);
    /* Leicht transparentes Weiß für edlen Look */
    text-decoration: none;
    white-space: nowrap;
    text-align: right;
}

/* Spezifisch für den Link */
.dsgvo-link {
    cursor: pointer;
    transition: all 0.2s ease;
}

.dsgvo-link:hover {
    background-color: #004080;
    /* Etwas helleres Blau beim Hover */
    color: #ffffff !important;
}

@keyframes pulseBadge {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Expeditions-Kommando: Hinweis auf kürzliche Rückkehr (siehe expedition_nav_alert in game.php) */
.nav-content a.nav-expedition-pulse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    animation: navExpeditionGlow 2.2s ease-in-out infinite;
}

.nav-content a.nav-expedition-pulse .expedition-nav-badge {
    animation: pulseBadge 2s infinite;
}

@keyframes navExpeditionGlow {

    0%,
    100% {
        color: #00ffcc;
        box-shadow: inset 0 0 0 1px rgba(46, 204, 113, 0.25);
        background: rgba(46, 204, 113, 0.06);
    }

    50% {
        color: #7dffb3;
        box-shadow: inset 0 0 12px rgba(46, 204, 113, 0.45), 0 0 14px rgba(0, 212, 255, 0.2);
        background: rgba(46, 204, 113, 0.14);
    }
}

.nav-content a.active-page {
    color: #b8f7ff !important;
    background: linear-gradient(
        90deg,
        rgba(0, 212, 255, 0.28) 0%,
        rgba(0, 212, 255, 0.08) 55%,
        rgba(0, 212, 255, 0.02) 100%
    );
    border-left: 3px solid #5ce1ff;
    padding-left: 15px;
    /* Optisches Einrücken */
    font-weight: bold;
    text-shadow: 0 0 12px rgba(0, 240, 255, 0.55), 0 0 22px rgba(0, 180, 255, 0.25);
    box-shadow:
        inset 0 0 18px rgba(0, 212, 255, 0.18),
        0 0 14px rgba(0, 212, 255, 0.22);
}

.nav-content a.active-page:not(.nav-expedition-pulse) {
    animation: navActivePulse 2.8s ease-in-out infinite;
}

@keyframes navActivePulse {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(0, 240, 255, 0.45), 0 0 18px rgba(0, 180, 255, 0.2);
        box-shadow:
            inset 0 0 14px rgba(0, 212, 255, 0.14),
            0 0 12px rgba(0, 212, 255, 0.18);
    }

    50% {
        text-shadow: 0 0 18px rgba(200, 255, 255, 0.75), 0 0 32px rgba(0, 212, 255, 0.38);
        box-shadow:
            inset 0 0 26px rgba(0, 212, 255, 0.26),
            0 0 22px rgba(0, 212, 255, 0.38);
    }
}

/* Debug-Overlay für Bereichsprüfung */
.debug-layout .debug-region {
    position: relative;
    outline: 2px dashed rgba(255, 255, 255, 0.45);
    outline-offset: -2px;
}

.debug-layout .debug-region::after {
    content: attr(data-debug-label);
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 10001;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 3px;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    pointer-events: none;
}

.debug-layout .debug-header::after { background: rgba(0, 170, 255, 0.85); }
.debug-layout .debug-main-container::after { background: rgba(120, 120, 120, 0.85); }
.debug-layout .debug-nav::after { background: rgba(173, 216, 230, 0.85); color: #000; }
.debug-layout .debug-main::after { background: rgba(0, 200, 120, 0.85); color: #000; }
.debug-layout .debug-aside::after { background: rgba(255, 180, 0, 0.9); color: #000; }
.debug-layout .debug-footer::after { background: rgba(160, 100, 255, 0.9); }

/* 2. RESPONSIVE BREAKPOINTS (Desktop bleibt Standard) */
@media (max-width: 1200px) {
    nav {
        flex-basis: 220px;
    }

    aside {
        flex-basis: 200px;
    }

    .nav-content a {
        padding: 9px 14px;
        font-size: 0.85em;
    }
}

@media (max-width: 992px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .main-container { flex-direction: column; overflow: visible; }

    aside {
        flex: 0 0 auto;
        width: auto;
        border-left: none;
        border-bottom: 1px solid #00d4ff33;
        max-height: none;
    }

    nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(82vw, 320px);
        max-width: 320px;
        border-right: 1px solid #00d4ff;
        border-bottom: none;
        z-index: 1001;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.35);
        overflow-y: auto;
    }

    #main-nav.open {
        transform: translateX(0);
    }

    .mobile-nav-backdrop:not([hidden]) {
        display: block;
    }

    .mobile-nav-backdrop[hidden] {
        display: none;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        top: 12px;
    }

    main {
        order: 1;
        min-height: 62vh;
    }

    aside {
        order: 2;
    }

    #contentFrame {
        min-height: 780px !important;
    }

    .footer-info {
        position: static;
        align-items: flex-start;
        margin-top: 12px;
    }
}

@media (max-width: 768px) {
    header {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 14px;
        padding: 10px 12px;
    }

    .top-res-header .mine-res {
        font-size: 0.88em;
    }

    nav,
    aside {
        padding: 8px;
    }

    .category-title {
        padding: 10px;
        font-size: 0.85rem;
    }

    .nav-content a {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .planet-card {
        padding: 10px;
    }

    .p-name {
        font-size: 0.95em;
    }

    .p-coords {
        font-size: 0.9em;
    }

    .p-resources {
        font-size: 0.66rem;
    }

    #contentFrame {
        min-height: 700px !important;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }

    header {
        padding: 8px 10px;
    }

    .top-res-header .mine-res {
        font-size: 0.78em;
    }

    .main-container {
        gap: 0;
    }

    .menu-category {
        margin-bottom: 8px;
    }

    .nav-content a {
        padding: 10px;
        font-size: 0.85rem;
    }

    .badge {
        margin-left: 8px;
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    #contentFrame {
        min-height: 640px !important;
    }
}
