/* ============================================================
   TimeSecPlan – KLASSISCHE Navigation (header_klassisch.php)
   Wird statt nav.css geladen, wenn unter Einstellungen →
   Darstellung „Klassische Navigation verwenden“ aktiv ist.
   Inhalt: die früheren Regeln aus style.css und mobile.css.
   ============================================================ */

/* ============================================================
   HEADER UND NAVIGATION
   ============================================================ */
.main-header {background-color:#2c3e50; box-shadow:0 2px 10px rgba(0,0,0,0.15); position:sticky; top:0; z-index:9999; font-family:'Segoe UI', Arial, sans-serif;}
.header-container {max-width:80%; margin:0 auto; display:flex; justify-content:space-between; align-items:center; padding:0 20px; height:65px;}
/* Navigations-Struktur */
.nav-bar {height:100%;}
.nav-menu {list-style:none; margin:0; padding:0; display:flex; height:100%; align-items:center;}
.nav-menu > li {position:relative; height:100%; display:flex; align-items:center;}
.nav-menu > li > a,
.dropdown-trigger {color:#ecf0f1; text-decoration:none; padding:0 20px; height:100%; display:flex; align-items:center; font-weight:500; font-size:15px; transition:background 0.2s, color 0.2s; cursor:pointer;}
.nav-menu > li:hover > a,
.dropdown-trigger:hover {background-color:#34495e; color:#3498db;}
/* Dropdown-Logik */
.dropdown-menu {position:absolute; top:65px; left:0; background-color:#ffffff; min-width:240px; box-shadow:0 8px 16px rgba(0,0,0,0.15); list-style:none; padding:10px 0; margin:0; border-radius:0 0 6px 6px; border-top:3px solid #3498db; opacity:0; visibility:hidden; transform:translateY(10px); transition:opacity 0.2s, transform 0.2s, visibility 0.2s;}
.dropdown-menu li a {color:#2c3e50; padding:12px 20px; text-decoration:none; display:block; font-size:14px; font-weight:400; transition:background 0.15s, color 0.15s;}
.dropdown-menu li a:hover {background-color:#f8fafc; color:#3498db; padding-left:25px;}
.dropdown:hover .dropdown-menu {opacity:1; visibility:visible; transform:translateY(0);}
/* Rechte Zone: Benutzer und Logout */
.user-status-zone {display:flex; align-items:center; gap:15px;}
.session-timer {font-size:13px; font-weight:bold; color:#bdc3c7; font-variant-numeric:tabular-nums; white-space:nowrap; padding:4px 8px; border-radius:20px; cursor:help; transition:background 0.2s, color 0.2s;}
/* Letzte 2 Minuten gelb, letzte Minute rot */
.session-timer--warn {color:#2c3e50; background:#f1c40f;}
.session-timer--alarm {color:#fff; background:#e74c3c; animation:pulse 1s infinite;}
.user-badge {font-size:12px; font-weight:bold; padding:5px 10px; border-radius:20px; color:white;}
.user-badge.admin { background-color:#e74c3c; }
.user-badge.subcontractor { background-color:#f39c12; }
/* Diese drei Rollen hatten bisher keine Farbe und damit keine erkennbare Plakette */
.user-badge.dispatcher { background-color:#2980b9; }
.user-badge.view { background-color:#7f8c8d; }
.user-badge.employee { background-color:#27ae60; }
.btn-logout {color:#95a5a6; text-decoration:none; font-size:14px; padding:8px 12px; border:1px solid #7f8c8d; border-radius:4px; transition:all 0.2s;}
.btn-logout:hover {color:#ffffff; background-color:#c0392b; border-color:#c0392b;}
/* Wechsel zur neuen Ansicht (nav_ansicht.php) */
.nav-ansicht-form {margin:0;}
.btn-ansicht {color:#dfe6ee; background:transparent; font-size:14px; padding:8px 12px; border:1px solid #7f8c8d; border-radius:4px; cursor:pointer; white-space:nowrap; font-family:inherit;}
.btn-ansicht:hover {color:#ffffff; background-color:#2980b9; border-color:#2980b9;}
@media (max-width: 768px) { .btn-ansicht {padding:5px 8px; font-size:12px;} }
/* Hamburger-Button (auf dem Desktop ausgeblendet) */
.menu-toggle {display:none; flex-direction:column; justify-content:space-between; width:30px; height:21px; background:transparent; border:none; cursor:pointer; padding:0; z-index:10000;}
.menu-toggle span {width:100%; height:3px; background-color:#ffffff; border-radius:2px; transition:all 0.3s ease-in-out;}
/* Animation zum "X", wenn aktiv */
.menu-toggle.toggle-active span:nth-child(1) {transform:translateY(9px) rotate(45deg);}
.menu-toggle.toggle-active span:nth-child(2) {opacity:0;}
.menu-toggle.toggle-active span:nth-child(3) {transform:translateY(-9px) rotate(-45deg);}

/* ------------------------------------------------------------
   Navigation auf Smartphones und Tablets
   (weitere mobile Korrekturen stehen in mobile.css)
   ------------------------------------------------------------ */
@media (max-width:992px) {
    .menu-toggle {display:flex;}
    .header-container {justify-content:space-between;}
    /* Versteckt die Navigation standardmäßig außerhalb des Bildschirms */
    .nav-bar {position:absolute; top:65px; left:0; width:100%; background-color:#2c3e50; flex-direction:column; align-items:stretch; max-height:0; overflow:hidden; transition:max-height 0.3s ease-in-out; box-shadow:0 4px 10px rgba(0,0,0,0.2);}
    /* Wird per JavaScript vergeben, um das Menü auszurollen */
    .nav-bar.nav-active {max-height:90vh; overflow-y:auto;}
    .nav-menu {flex-direction:column; width:100%; gap:0;}
    .nav-menu > li {width:100%; border-bottom:1px solid #34495e;}
    .nav-menu > li > a,
    .dropdown-trigger {padding:15px 20px; width:100%; box-sizing:border-box; justify-content:space-between;}
    /* Mobiles Dropdown-Verhalten: per Klick einblenden */
    .dropdown-menu {position:relative; top:0; width:100%; background-color:#1a252f; box-shadow:none; border-top:none; border-left:4px solid var(--primary); border-radius:0; display:none; transform:none; opacity:1; visibility:visible; padding:5px 0;}
    .dropdown.dropdown-active .dropdown-menu {display:block;}
    .dropdown-menu li a {color:#ecf0f1; padding:12px 35px;}
    .user-status-zone {width:100%; padding:20px; box-sizing:border-box;}
}

/* Kleine Laptops */
@media (max-width: 1200px) {
    .header-container {
        max-width: 95%;
    }
}

/* Tablets und mobiles Menü (ab hier greift der Hamburger) */
@media (max-width: 992px) {
    header.main-header {
        padding: 0 12px;
    }

    .header-container {
        max-width: 100%;
        padding: 0;
        height: 60px;
        flex: 1 1 auto;
    }

    /* Menü öffnet immer direkt unter dem Header – unabhängig von dessen Höhe.
       Die feste Angabe top:65px lag sonst mitten im Header. */
    .nav-bar {
        top: 100%;
    }

    /* Die Höhenangaben aus der Desktop-Navigation (height:100%) beziehen sich
       mobil auf den 60px hohen Header. Dadurch wurde das aufgeklappte Menü auf
       Header-Höhe abgeschnitten – es muss mit seinem Inhalt wachsen. */
    .nav-bar,
    .nav-menu,
    .nav-menu>li,
    .nav-menu>li>a,
    .dropdown-trigger {
        height: auto;
    }

    /* Untermenü gehört unter seinen Eintrag, nicht daneben:
       die Listenpunkte sind auf dem Desktop Flex-Zeilen. */
    .nav-menu>li {
        flex-direction: column;
        align-items: stretch;
    }

    /* width:100% plus 4px Rahmen ergäbe sonst 4px Überbreite */
    .dropdown-menu {
        box-sizing: border-box;
    }

    /* Rolle und Logout bleiben kompakt neben dem Hamburger stehen */
    .user-status-zone {
        width: auto;
        padding: 0;
        margin-left: auto;
        gap: 8px;
        flex-shrink: 0;
    }

    .btn-logout {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Smartphones */
@media (max-width: 768px) {
    .header-logo {
        font-size: 15px;
    }

    .user-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    .btn-logout {
        padding: 5px 8px;
        font-size: 12px;
    }
}

@media print {
    .page-timesheet .btn-logout { display:none !important; }
}
