/* ===== CSS VARIABLES / THEMES ===== */
:root, [data-theme="light"] {
    --bg: #F5F3EE;
    --surface: #FFFFFF;
    --surface-alt: #FAF8F5;
    --border: #E2DDD5;
    --text: #2C2825;
    --text-muted: #7A746B;
    --accent: #1A5276;
    --accent-light: #D4E6F1;
    --accent-soft: #EBF5FB;
    --danger: #C0392B;
    --danger-light: #FADBD8;
    --success: #27AE60;
    --success-light: #D5F5E3;
    --warning: #E67E22;
    --warning-light: #FDEBD0;
    --purple: #7D3C98;
    --purple-light: #E8DAEF;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    --header-bg: #FFFFFF;
    --sidebar-bg: #FFFFFF;
}

[data-theme="dark"] {
    --bg: #1A1A1E;
    --surface: #242428;
    --surface-alt: #2A2A2F;
    --border: #3A3A40;
    --text: #E8E6E1;
    --text-muted: #9A9590;
    --accent: #5DADE2;
    --accent-light: #1A3A4F;
    --accent-soft: #1A2F3F;
    --danger: #E74C3C;
    --danger-light: #4A1A1A;
    --success: #2ECC71;
    --success-light: #1A3A2A;
    --warning: #F39C12;
    --warning-light: #3A2F1A;
    --purple: #BB8FCE;
    --purple-light: #2A1F3A;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    --header-bg: #242428;
    --sidebar-bg: #242428;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    transition: background 0.2s, color 0.2s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ===== HEADER ===== */
.header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: 56px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    transition: background 0.2s;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-brand {
    font-size: 1.15rem; font-weight: 700; color: var(--text);
    text-decoration: none; letter-spacing: -0.01em;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.header-version { font-size: 0.75rem; color: var(--text-muted); }
.header-user { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.header-logout {
    color: var(--text-muted); display: flex; align-items: center;
    padding: 4px; border-radius: 4px;
}
.header-logout:hover { color: var(--danger); background: var(--danger-light); text-decoration: none; }
.sidebar-toggle {
    display: none; background: none; border: none; color: var(--text);
    padding: 4px; border-radius: 4px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 10px; font-size: 1rem;
    color: var(--text); display: flex; align-items: center;
}
[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0;
    width: 240px; background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto; z-index: 90;
    transition: transform 0.25s ease, background 0.2s;
}
.sidebar-content { padding: 12px 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 8px;
    color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
    text-decoration: none; border: none; background: none; width: 100%;
    text-align: left; transition: all 0.15s;
}
.nav-item:hover { color: var(--text); background: var(--surface-alt); text-decoration: none; }
.nav-item.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }
.nav-group-items { display: none; padding-left: 16px; }
.nav-group.open .nav-group-items { display: block; }
.nav-chevron { margin-left: auto; transition: transform 0.2s; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-sub { font-size: 0.85rem; padding: 8px 14px; }
.nav-separator { height: 1px; background: var(--border); margin: 8px 14px; }

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    height: 60px; background: var(--header-bg);
    border-top: 1px solid var(--border);
    z-index: 100; justify-content: space-around; align-items: center;
}
.bottom-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--text-muted); font-size: 0.65rem; text-decoration: none;
    padding: 4px 8px; border-radius: 8px; transition: color 0.15s;
}
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:hover { color: var(--text); text-decoration: none; }

/* ===== OVERLAY ===== */
.sidebar-overlay {
    display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 85;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 240px; margin-top: 56px;
    padding: 24px; min-height: calc(100vh - 56px);
    max-width: 1200px;
}
.main-content-full { margin-left: 0; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ===== FLASH MESSAGES ===== */
.flash-messages { margin-bottom: 16px; }
.flash {
    padding: 10px 16px; border-radius: 8px; font-size: 0.9rem; margin-bottom: 8px;
}
.flash-error { background: var(--danger-light); color: var(--danger); }
.flash-success { background: var(--success-light); color: var(--success); }
.flash-info { background: var(--accent-light); color: var(--accent); }

/* ===== CARDS ===== */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px; box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.card-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 4px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-status-idee { background: var(--purple-light); color: var(--purple); }
.badge-status-aktiv { background: var(--success-light); color: var(--success); }
.badge-status-wartend { background: var(--warning-light); color: var(--warning); }
.badge-status-pausiert { background: var(--surface-alt); color: var(--text-muted); }
.badge-status-erledigt { background: var(--success-light); color: var(--success); }
.badge-status-verworfen { background: var(--danger-light); color: var(--danger); }
.badge-priority-hoch { background: var(--danger-light); color: var(--danger); }
.badge-priority-mittel { background: var(--warning-light); color: var(--warning); }
.badge-priority-niedrig { background: var(--surface-alt); color: var(--text-muted); }

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px; text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-number.danger { color: var(--danger); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px; font-size: 0.85rem;
    font-weight: 600; border: none; cursor: pointer; transition: all 0.15s;
    text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }

/* ===== SECTION ===== */
.section { margin-bottom: 24px; }
.section-title {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 12px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-text { font-size: 1rem; }

/* ===== INFO GRID ===== */
.info-grid { border-top: 1px solid var(--border); }
.info-row {
    display: flex; padding: 8px 0; font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}
.info-label { width: 140px; color: var(--text-muted); flex-shrink: 0; font-weight: 500; }
.info-value { color: var(--text); }
textarea.form-input { resize: vertical; }

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; cursor: pointer; border-bottom: 1px solid var(--border);
    user-select: none;
}
.section-header:hover { opacity: 0.8; }
.chevron { color: var(--text-muted); font-size: 1.1rem; transition: transform 0.2s; }

/* ===== LOGIN ===== */
.login-container {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 24px;
}
.login-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 40px; width: 100%; max-width: 380px;
    box-shadow: var(--shadow);
}
.login-title {
    font-size: 1.4rem; font-weight: 700; color: var(--text);
    text-align: center; margin-bottom: 8px;
}
.login-subtitle {
    font-size: 0.85rem; color: var(--text-muted);
    text-align: center; margin-bottom: 28px;
}
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 0.85rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 6px;
}
.form-input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 0.95rem; font-family: inherit;
    background: var(--surface-alt); color: var(--text);
    transition: border-color 0.15s;
}
.form-input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.btn-login {
    width: 100%; padding: 12px; font-size: 1rem; margin-top: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; }
    .header-version { display: none; }
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    .main-content { padding: 16px; padding-bottom: 80px; }
    .card-grid { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-user { display: none; }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .main-content { padding: 12px; padding-bottom: 76px; }
    .card { padding: 14px; }
    .login-card { padding: 28px 20px; }
}
