/* ========================================
   dm-Cockpit - Themes
   Override --color-primary + --accent vars per theme
   ======================================== */

:root {
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-rgb: 14, 165, 233;
    --accent-light: #38bdf8;
    --accent-soft: rgba(14, 165, 233, 0.12);
    --accent-soft-strong: rgba(14, 165, 233, 0.2);
}

[data-theme="ocean"] {
    --color-primary: #0ea5e9;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-rgb: 14, 165, 233;
    --accent-light: #38bdf8;
    --accent-soft: rgba(14, 165, 233, 0.12);
    --accent-soft-strong: rgba(14, 165, 233, 0.2);
}

[data-theme="orange"] {
    --color-primary: #f97316;
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-rgb: 249, 115, 22;
    --accent-light: #fb923c;
    --accent-soft: rgba(249, 115, 22, 0.12);
    --accent-soft-strong: rgba(249, 115, 22, 0.22);
}

[data-theme="forest"] {
    --color-primary: #10b981;
    --accent: #10b981;
    --accent-hover: #059669;
    --accent-rgb: 16, 185, 129;
    --accent-light: #34d399;
    --accent-soft: rgba(16, 185, 129, 0.13);
    --accent-soft-strong: rgba(16, 185, 129, 0.22);
}

[data-theme="sunset"] {
    --color-primary: #a855f7;
    --accent: #a855f7;
    --accent-hover: #9333ea;
    --accent-rgb: 168, 85, 247;
    --accent-light: #c084fc;
    --accent-soft: rgba(168, 85, 247, 0.13);
    --accent-soft-strong: rgba(168, 85, 247, 0.22);
}

/* Apply accent to primary surfaces (override hardcoded sky-blue gradient) */
.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%) !important;
    box-shadow: 0 2px 4px rgba(var(--accent-rgb), 0.3) !important;
}

.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(var(--accent-rgb), 0.4) !important;
}

/* Sidebar active state uses theme accent */
.sidebar-item.active {
    background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(var(--accent-rgb), 0.06) 100%) !important;
    color: var(--accent-hover) !important;
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}

.dark .sidebar-item.active {
    background: linear-gradient(135deg, var(--accent-soft-strong) 0%, rgba(var(--accent-rgb), 0.1) 100%) !important;
    color: var(--accent-light) !important;
}

.sidebar-item.active .sidebar-item-icon {
    color: var(--accent-hover) !important;
}

.dark .sidebar-item.active .sidebar-item-icon {
    color: var(--accent-light) !important;
}

/* Theme picker tiles (settings) */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.theme-tile {
    cursor: pointer;
    border-radius: 14px;
    padding: 14px;
    border: 2px solid transparent;
    background: #f8fafc;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.dark .theme-tile {
    background: #1e293b;
}

.theme-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.theme-tile.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

.theme-tile-preview {
    height: 48px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.theme-tile-preview::before,
.theme-tile-preview::after {
    content: '';
    position: absolute;
    border-radius: 4px;
}

.theme-tile-preview::before {
    left: 8px;
    top: 10px;
    width: 24px;
    height: 8px;
    background: rgba(255, 255, 255, 0.7);
}

.theme-tile-preview::after {
    left: 8px;
    bottom: 10px;
    width: 50%;
    height: 6px;
    background: rgba(255, 255, 255, 0.55);
}

.theme-tile-label {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    text-align: center;
}

.dark .theme-tile-label {
    color: #f1f5f9;
}

.theme-tile-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.theme-tile.active .theme-tile-check {
    display: flex;
}

/* ============================================
   Sidebar Pin
   ============================================ */
.sidebar-pin-btn {
    display: none;
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.sidebar-pin-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent);
}

.dark .sidebar-pin-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent-light);
}

.sidebar:hover .sidebar-pin-btn {
    display: flex;
}

.sidebar.sidebar-pinned .sidebar-pin-btn {
    display: flex;
    color: var(--accent);
}

.dark .sidebar.sidebar-pinned .sidebar-pin-btn {
    color: var(--accent-light);
}

@media (min-width: 1025px) {
    .sidebar.sidebar-pinned {
        width: 260px;
    }
    .sidebar.sidebar-pinned ~ .main-content,
    body:has(.sidebar.sidebar-pinned) .main-content {
        margin-left: 260px;
    }
    .sidebar.sidebar-pinned .sidebar-logo-text,
    .sidebar.sidebar-pinned .sidebar-logo-sub,
    .sidebar.sidebar-pinned .sidebar-section-title,
    .sidebar.sidebar-pinned .sidebar-item-label,
    .sidebar.sidebar-pinned .sidebar-footer-details {
        opacity: 1;
    }
}

/* ============================================
   Top-Nav polish — view title accent
   ============================================ */
#viewTitle {
    color: var(--accent-hover);
}

.dark #viewTitle {
    color: var(--accent-light);
}

/* ============================================
   Mobile Bottom-Tab-Bar
   ============================================ */
.bottom-tabbar {
    display: none;
}

@media (max-width: 1024px) {
    .bottom-tabbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        border-top: 1px solid #e2e8f0;
        z-index: 55;
        display: flex;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .dark .bottom-tabbar {
        background: rgba(15, 23, 42, 0.95);
        border-top-color: rgba(255, 255, 255, 0.1);
    }

    .bottom-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #94a3b8;
        font-size: 10px;
        font-weight: 600;
        cursor: pointer;
        transition: color 0.2s ease;
        border: none;
        background: transparent;
        padding: 6px 4px;
    }

    .bottom-tab svg {
        width: 20px;
        height: 20px;
    }

    .bottom-tab.active {
        color: var(--accent);
    }

    .dark .bottom-tab.active {
        color: var(--accent-light);
    }

    /* Push main content above the bar */
    .main-content {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
    }
}

/* Hide bottom bar on print and login splash */
@media print {
    .bottom-tabbar { display: none !important; }
}

/* ============================================
   Forecast Slider (Gehaltsrechner-Prognose)
   ============================================ */
.forecast-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 25%), #e2e8f0 var(--val, 25%), #e2e8f0 100%);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}

.dark .forecast-slider {
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 25%), #334155 var(--val, 25%), #334155 100%);
}

.forecast-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.forecast-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.4);
}

.forecast-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: white;
    border: 2px solid var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.forecast-slider:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.forecast-slider:disabled::-webkit-slider-thumb {
    cursor: not-allowed;
}
