/* BouwKostenPro v7.0 — Layout */

/* App shell */
.app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w); min-width: var(--sidebar-w);
    background: var(--sidebar); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; transition: width var(--t-normal), min-width var(--t-normal);
    overflow: hidden; z-index: var(--z-sticky);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); min-width: var(--sidebar-collapsed); }

.sidebar-logo {
    padding: 14px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap;
}
.sidebar-logo-icon { font-size: 22px; flex-shrink: 0; }
.sidebar-logo-text { font-size: 14px; font-weight: 900; color: var(--text1); transition: opacity var(--t-fast); }
.sidebar.collapsed .sidebar-logo-text { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-project { display: none; }

/* Project selector */
.sidebar-project {
    padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.sidebar-project select {
    width: 100%; background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--r-sm); color: var(--text1); font-size: 10px; padding: 5px 8px;
    font-family: var(--font);
}

/* Nav items */
.nav-items { flex: 1; padding: 6px 0; overflow-y: auto; }
.nav-item {
    padding: 10px 14px; display: flex; align-items: center; gap: 10px;
    cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
    border-left: 3px solid transparent; color: var(--text2); font-size: 12px;
}
.nav-item:hover { background: var(--accent-glow); color: var(--text1); }
.nav-item.active {
    background: var(--accent-glow); color: var(--text1); font-weight: 700;
    border-left-color: var(--accent);
}
.nav-item-icon { font-size: 16px; flex-shrink: 0; width: 24px; text-align: center; }
.nav-item-label { transition: opacity var(--t-fast); }
.sidebar.collapsed .nav-item-label { opacity: 0; width: 0; }
.nav-item-badge {
    margin-left: auto; font-size: 9px; font-weight: 700; background: var(--accent);
    color: #fff; padding: 1px 6px; border-radius: var(--r-pill); min-width: 18px; text-align: center;
}
.sidebar.collapsed .nav-item-badge { display: none; }

/* Sidebar footer */
.sidebar-footer {
    padding: 10px 14px; border-top: 1px solid var(--border);
    font-size: 9px; color: var(--text4); white-space: nowrap;
}
.sidebar.collapsed .sidebar-footer span { display: none; }

/* Main area */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Header */
.header {
    height: var(--header-h); min-height: var(--header-h);
    padding: 0 var(--pad-lg); display: flex; align-items: center; justify-content: space-between;
    background: var(--sidebar); border-bottom: 1px solid var(--border); gap: 8px;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 15px; font-weight: 900; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-icon {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm); cursor: pointer; color: var(--text3); transition: all var(--t-fast); position: relative;
}
.header-icon:hover { background: var(--accent-glow); color: var(--text1); }
.header-icon .badge {
    position: absolute; top: 2px; right: 2px; background: var(--red); color: #fff;
    font-size: 8px; width: 14px; height: 14px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.hamburger { display: none; }

/* Page content */
.page-content {
    flex: 1; overflow-y: auto; overflow-x: hidden;
    padding: var(--pad-lg); animation: fadeIn var(--t-fast);
}

/* Page header (breadcrumbs + help) */
.page-header { margin-bottom: var(--gap-lg); }
.breadcrumbs { font-size: 10px; color: var(--text3); margin-bottom: 4px; }
.breadcrumbs a { color: var(--text3); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 4px; }

/* Mobile bottom nav */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    height: var(--mobile-nav-h); background: var(--sidebar);
    border-top: 1px solid var(--border); z-index: var(--z-sticky);
}
.mobile-nav-items { display: flex; height: 100%; }
.mobile-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text3); transition: color var(--t-fast); gap: 2px;
}
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item-icon { font-size: 18px; }
.mobile-nav-item-label { font-size: 8px; font-weight: 600; }

/* Mobile sidebar overlay */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: var(--z-overlay); backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* Splash / Loading */
#splash {
    position: fixed; inset: 0; background: var(--bg); z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
}
#splash .spinner {
    width: 36px; height: 36px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite;
}
#splash .splash-text { font-size: 12px; color: var(--text3); font-family: var(--font); }
#splash .splash-bar {
    width: 200px; height: 3px; background: var(--border); border-radius: 3px; overflow: hidden;
}
#splash .splash-bar-fill {
    height: 100%; background: var(--accent); border-radius: 3px;
    transition: width 0.3s ease; width: 0%;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .sidebar.mobile-open {
        display: flex; position: fixed; left: 0; top: 0; bottom: 0;
        z-index: calc(var(--z-overlay) + 1); width: 240px;
        animation: slideInRight var(--t-normal);
    }
    .hamburger { display: flex; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .mobile-nav { display: block; }
    .page-content { padding: 12px; padding-bottom: calc(var(--mobile-nav-h) + 12px); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .header-title { font-size: 13px; }
    .header { padding: 0 12px; }
}
