/* === MAIN LAYOUT & APP SHELL === */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* App Root Container */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- APP HEADER --- */
.app-header {
    height: 70px;
    background-color: var(--dark-anthracite);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    border-bottom: 1px solid var(--dark-border);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 42px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.header-center {
    flex-grow: 1;
    max-width: 500px;
    margin: 0 20px;
}

.header-search-bar {
    position: relative;
    width: 100%;
}

.header-search-bar input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background-color: #4A5561;
    border: 1px solid var(--dark-border);
    border-radius: var(--border-radius-lg);
    color: var(--text-white);
    font-size: 0.9em;
    outline: none;
    transition: var(--transition-normal);
}

.header-search-bar input::placeholder {
    color: var(--text-light);
}

.header-search-bar input:focus {
    background-color: #5A6673;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px var(--accent-red-light);
}

.header-search-bar .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Header Icon Buttons */
.header-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-white);
    font-size: 1.1em;
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.header-icon-btn:hover {
    background-color: #4A5561;
}

.badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 9px;
    height: 9px;
    background-color: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--dark-anthracite);
}

/* Mandanten Switcher Button */
.tenant-switch-btn {
    background-color: #4A5561;
    border: 1px solid var(--dark-border);
    color: var(--text-white);
    padding: 8px 14px;
    border-radius: var(--border-radius);
    font-size: 0.85em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tenant-switch-btn:hover {
    background-color: #5A6673;
}

/* User Avatar Badge (Top Right - Initials) */
.user-avatar-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-circle);
    background-color: var(--accent-red);
    color: var(--text-white);
    font-weight: 700;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--text-white);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform var(--transition-fast);
}

.user-avatar-badge:hover {
    transform: scale(1.06);
    background-color: var(--accent-red-hover);
}

/* --- APP BODY & DESKTOP SIDEBAR --- */
.app-body {
    display: flex;
    flex-grow: 1;
    min-height: calc(100vh - 70px);
}

.app-sidebar {
    width: 250px;
    background-color: var(--dark-anthracite);
    border-right: 1px solid var(--dark-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #CCCCCC;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    position: relative;
}

.nav-item:hover {
    background-color: #4A5561;
    color: var(--text-white);
}

.nav-item.active {
    background-color: var(--accent-red);
    color: var(--text-white);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background-color: var(--accent-red);
    color: var(--text-white);
    font-size: 0.75em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 0 20px;
    border-top: 1px solid var(--dark-border);
    padding-top: 16px;
}

.system-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8em;
    color: #AAAAAA;
}

.status-dot.online {
    width: 8px;
    height: 8px;
    background-color: var(--status-success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--status-success);
}

/* --- INITIAL LKW LOADING SCREEN --- */
.initial-loader-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    width: 100%;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.loader-truck-video {
    width: 320px;
    max-width: 90vw;
    min-height: 120px;
    height: auto;
    margin-bottom: 20px;
    object-fit: contain;
    border-radius: var(--border-radius);
    display: block;
    animation: truckDriveMotion 2s infinite ease-in-out;
}

@keyframes truckDriveMotion {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.02); }
}

.loader-text {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.loading-dots span {
    animation: bouncingDots 1.4s infinite ease-in-out both;
    display: inline-block;
    font-weight: 700;
    color: var(--accent-red);
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bouncingDots {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

/* --- MAIN CONTENT AREA --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: var(--bg-color);
    max-width: 100%;
    overflow-y: auto;
}

/* --- MOBILE BOTTOM NAVIGATION (Joblinx Style) --- */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background-color: var(--dark-anthracite);
    border-top: 1px solid var(--dark-border);
    display: none; /* Standardmäßig ausblenden auf dem Desktop */
    align-items: center;
    justify-content: space-around;
    z-index: var(--z-mobile-nav);
    box-shadow: var(--shadow-mobile-nav);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #CCCCCC;
    text-decoration: none;
    font-size: 0.75em;
    font-weight: 500;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    flex: 1;
    height: 100%;
    transition: var(--transition-fast);
}

.mobile-nav-item i {
    font-size: 1.25em;
}

.mobile-nav-item.active {
    color: var(--accent-red);
}

/* Hamburger Icon Animation inside Mobile Nav */
.hamburger-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 18px;
}

.hamburger-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #CCCCCC;
    border-radius: 2px;
}

/* Mobiles "Mehr"-Menü Drawer Overlay */
.mobile-more-menu {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background-color: var(--dark-anthracite);
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    padding: 24px;
    z-index: calc(var(--z-mobile-nav) + 10);
    transition: bottom var(--transition-normal);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
}

.mobile-more-menu.active {
    bottom: 0;
}

.mobile-more-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--dark-border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.mobile-more-header .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-white);
}

.mobile-more-header .avatar-circle {
    width: 40px;
    height: 40px;
    background-color: var(--accent-red);
    color: var(--text-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.mobile-more-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-white);
    text-decoration: none;
    font-size: 0.95em;
    border-radius: var(--border-radius);
    background: #4A5561;
}

.btn-danger-text {
    color: var(--status-danger) !important;
}

/* Responsive Rules */
.desktop-only { display: flex; }
.mobile-only { display: none; }

@media (max-width: 900px) {
    .app-sidebar { display: none !important; }
    .mobile-bottom-nav { display: flex !important; }
    .header-center { display: none; }
    .main-content { padding: 20px 16px 85px 16px; }
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
}