/* ============================================================
   assets/style.css – DataBoard Theme
   Light / Dark via data-bs-theme="light|dark"
   ============================================================ */

/* ---------- Schriftart (keine Google Fonts) ---------- */
@import url("https://fonts.bunny.net/css?family=instrument-sans:400,500,600,700,800&display=swap");

:root {
    --font-main: 'Instrument Sans', system-ui, sans-serif;
    --accent:         #3d8bfd;
    --accent-hover:   #2d78e8;
    --sidebar-width:  240px;
    --navbar-height:  56px;
    --radius:         8px;
    --transition:     0.2s ease;
}

/* ── LIGHT ── */
[data-bs-theme="light"] {
    --bg-body:       #f0f2f5;
    --bg-sidebar:    #ffffff;
    --bg-navbar:     #ffffff;
    --bg-card:       #ffffff;
    --text-primary:  #1a1d23;
    --text-muted:    #6b7280;
    --border-color:  #e5e7eb;
    --sidebar-hover: #f3f6ff;
    --sidebar-active:#eef3ff;
    --sidebar-active-text: var(--accent);
    --shadow:        0 1px 4px rgba(0,0,0,.08);
    --shadow-lg:     0 4px 20px rgba(0,0,0,.10);
}

/* ── DARK ── */
[data-bs-theme="dark"] {
    --bg-body:       #0f1117;
    --bg-sidebar:    #161b27;
    --bg-navbar:     #161b27;
    --bg-card:       #1e2333;
    --text-primary:  #e8eaf0;
    --text-muted:    #8b92a5;
    --border-color:  #2a3045;
    --sidebar-hover: #1f2640;
    --sidebar-active:#1f2d4a;
    --sidebar-active-text: #6ea8fe;
    --shadow:        0 1px 4px rgba(0,0,0,.35);
    --shadow-lg:     0 4px 20px rgba(0,0,0,.5);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: background var(--transition), color var(--transition);
}

/* ============================================================
   Navbar
   ============================================================ */
.app-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    background: var(--bg-navbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 1rem;
    z-index: 1000;
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition);
}

.app-navbar .brand {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.app-navbar .brand i {
    color: var(--accent);
    font-size: 1.2rem;
}
.app-navbar .brand span { color: var(--accent); }

.navbar-spacer { flex: 1; }

/* Sidebar Toggle Button (Mobile) */
#sidebarToggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    transition: background var(--transition), color var(--transition);
}
#sidebarToggle:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* User Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* ============================================================
   Layout: Wrapper
   ============================================================ */
.app-wrapper {
    display: flex;
    padding-top: var(--navbar-height);
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.app-sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0.75rem;
    z-index: 900;
    transition: transform var(--transition), background var(--transition), border-color var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Scrollbar */
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-track { background: transparent; }
.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Section Labels */
.sidebar-section {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}
.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.25rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Nav Items */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.52rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    position: relative;
}
.sidebar-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: color var(--transition);
}
.sidebar-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
}
.sidebar-item.active {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
}
.sidebar-item.active i { color: var(--sidebar-active-text); }

/* Badge inside nav item */
.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    background: var(--accent);
    color: #fff;
    padding: 1px 7px;
    border-radius: 20px;
    font-weight: 600;
}

/* Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Push logout to bottom */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================================
   Main Content
   ============================================================ */
.app-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    min-width: 0;
    transition: margin-left var(--transition);
}

/* ============================================================
   Cards
   ============================================================ */
.db-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.db-card:hover { box-shadow: var(--shadow-lg); }

/* ============================================================
   Accent Button
   ============================================================ */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 600;
}
.btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* ============================================================
   Sidebar Toggle (alle Breakpoints)
   ============================================================ */

/* Sidebar collapsed: auf Desktop nach links schieben + Content-Margin entfernen */
.app-sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}
.app-wrapper.sidebar-collapsed .app-content {
    margin-left: 0;
}

/* Overlay (Desktop + Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 850;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   Mobile Responsive
   ============================================================ */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .app-content {
        margin-left: 0;
    }
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.3px;
}
.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.2rem 0 0 0;
}

/* ============================================================
   Stat Cards (Dashboard)
   ============================================================ */
.stat-card {
    padding: 1.25rem 1.5rem;
}
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.stat-trend {
    font-size: 0.8rem;
    font-weight: 500;
}

/* ============================================================
   Transition on theme switch
   ============================================================ */
*, *::before, *::after {
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: 0.15s;
    transition-timing-function: ease;
}
/* But NOT for animations or transforms */
.sidebar-item, .theme-toggle, #sidebarToggle, .app-sidebar {
    transition: all var(--transition);
}
