/* Paleta kolorów (Nowoczesny, łagodny "Slate / Navy" przyjazny dla oka) */
:root[data-theme="dark"] {
    --bg-base: #0f172a;         /* Tło główne (Slate 900) */
    --bg-surface: #1e293b;      /* Tło paneli i modali (Slate 800) */
    --bg-sidebar: #0f172a;      /* Tło menu bocznego */
    
    --text-main: #f8fafc;       /* Jasny, miękki tekst (Slate 50) */
    --text-muted: #94a3b8;      /* Wysokokontrastowy, stonowany szary (Slate 400) */
    
    --accent-blue: #38bdf8;     /* Przyjazny cyjan/błękit */
    --accent-purple: #a78bfa;   /* Miękki fiolet */
    --accent-red: #fb7185;      /* Miękki, pastelowy czerwony */
    
    --border-color: rgba(255, 255, 255, 0.05);
}

:root[data-theme="light"] {
    --bg-base: #f8fafc;         /* Bardzo jasny Slate 50 */
    --bg-surface: #ffffff;      /* Czysta biel paneli */
    --bg-sidebar: #ffffff;
    
    --text-main: #334155;       /* Ciemny Slate 700 */
    --text-muted: #64748b;      /* Slate 500 */
    
    --accent-blue: #0284c7;
    --accent-purple: #7c3aed;
    --accent-red: #e11d48;
    
    --border-color: rgba(0, 0, 0, 0.08);
}

/* 1. Ustawienia Typografii - POPPINS */
body {
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 16px;
    background-color: var(--bg-base);
    color: var(--text-main);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Grubości i Rozmiary dla nagłówków wg wytycznych (24 pkt = 24px) */
.fw-heading, strong, b {
    font-weight: 500 !important;
}

.page-title, .modal-title, .section-title, .brand-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 24px !important;
}

/* Utilities kolorystyczne */
.bg-surface { background-color: var(--bg-surface) !important; }
.text-main { color: var(--text-main) !important; transition: color 0.3s; }
.text-muted { color: var(--text-muted) !important; }

/* Rameczki i Panele (Miękkie, przyjazne krawędzie) */
.dashboard-panel, .custom-modal, .kpi-card { 
    border: 1px solid var(--border-color) !important; 
    border-radius: 16px !important;
}

/* Popupy (Modals) z miękkim cieniem */
.custom-modal {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3) !important;
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR (Rozmiar czcionki 15px) */
.sidebar {
    width: 280px; 
    background-color: var(--bg-sidebar); 
    display: flex; flex-direction: column;
    padding: 1.5rem; position: fixed; height: 100vh; z-index: 10;
    border-right: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
    font-size: 15px; /* Sidebar wg wytycznych */
}

.text-primary-glow { color: var(--accent-blue) !important; }

.nav-section-title {
    font-size: 12px; font-weight: 500; color: var(--text-muted);
    letter-spacing: 0.12em; margin-bottom: 0.8rem; padding-left: 0.5rem;
}

.nav-item {
    display: flex; align-items: center; padding: 0.8rem 1rem;
    color: var(--text-muted); text-decoration: none;
    border-radius: 8px; margin-bottom: 0.2rem; font-weight: 500;
    transition: all 0.2s;
}
.nav-item i { margin-right: 12px; font-size: 1.2rem; }
.nav-item:hover { color: var(--text-main); background: rgba(135, 82, 243, 0.05); }
.nav-item.active {
    background: linear-gradient(90deg, rgba(135, 82, 243, 0.1) 0%, transparent 100%);
    color: var(--text-main); border-left: 3px solid var(--accent-purple);
}
.nav-item.active i { color: var(--accent-purple); }

/* Przyciski w Sidebarze */
.btn-action-sidebar {
    font-size: 14px; /* Przyciski w bocznym menu */
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 6px;
    padding: 8px 12px;
    font-weight: 300;
    transition: 0.2s;
}
.btn-action-sidebar:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.03);
    border-color: var(--text-muted);
}

/* Moduł Listy CSV w Sidebarze */
.csv-list-container {
    max-height: 180px; overflow-y: auto; border-radius: 8px;
    background: rgba(0,0,0,0.1); padding: 0.2rem; border: 1px solid var(--border-color);
}
[data-theme="light"] .csv-list-container { background: rgba(0,0,0,0.02); }

.csv-file-item {
    display: flex; align-items: center; padding: 0.6rem; border-radius: 6px;
    font-size: 14px; color: var(--text-muted); cursor: pointer; transition: 0.2s;
    border: 1px solid transparent;
}
.csv-file-item:hover { background: rgba(56, 189, 248, 0.1); color: var(--text-main); }
.csv-file-item.selected {
    background: rgba(56, 189, 248, 0.15); color: var(--text-main);
    border-color: rgba(56, 189, 248, 0.3); font-weight: 500;
}
.csv-file-item i { margin-right: 8px; font-size: 1.1rem; color: var(--accent-blue); }

/* FOOTER (Rozmiar 14px) */
.sidebar-footer { 
    margin-top: auto; 
    font-size: 14px; /* Wytyczne: Stopka na 14pkt */
}

/* MAIN CONTENT */
.main-content {
    flex-grow: 1; margin-left: 280px; padding: 2rem 3rem; max-width: calc(100% - 280px);
}

/* KPI CARDS */
.kpi-card {
    border-radius: 16px; padding: 1.5rem; display: flex; align-items: center;
    color: white; position: relative; overflow: hidden; border: none !important;
}
.kpi-card::after {
    content: ''; position: absolute; top: 0; right: 0; width: 100px; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1));
    transform: skewX(-20deg) translateX(50px); pointer-events: none;
}
/* Subtelniejsze gradienty */
.gradient-purple { background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%); }
.gradient-blue { background: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%); }
.gradient-red { background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%); }

.kpi-icon {
    width: 50px; height: 50px; border-radius: 12px; background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-right: 1rem;
}
.kpi-label { font-size: 14px; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; display: block; font-weight: 500;}
.kpi-value { margin: 0; font-weight: 500; font-size: 32px; line-height: 1.2;}

/* PANELS */
.dashboard-panel { background: var(--bg-surface); padding: 1.8rem; transition: background-color 0.3s ease; box-shadow: 0 4px 20px rgba(0,0,0,0.02); }

/* AI Glow Panel */
.ai-panel { position: relative; border: 1px solid rgba(56, 189, 248, 0.2) !important; }
.ai-glow-bg {
    position: absolute; top: -50px; right: -50px; width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, transparent 70%); border-radius: 50%; z-index: 0; pointer-events: none;
}
.relative-z { position: relative; z-index: 1; }
#aiContent strong { color: var(--accent-blue); font-weight: 500; }

/* Przyciski Akcji */
.btn-app-support { 
    color: var(--text-muted); border-color: var(--border-color); font-size: 14px;
}
.btn-app-support:hover { color: var(--text-main); background-color: rgba(255,255,255,0.05); }

.btn-incident {
    background: rgba(244, 63, 94, 0.1); color: var(--accent-red);
    border: 1px solid rgba(244, 63, 94, 0.3); border-radius: 8px; transition: 0.3s;
}
.btn-incident:hover { background: var(--accent-red); color: white; box-shadow: 0 0 15px rgba(244, 63, 94, 0.4); }

.btn-primary {
    background-color: var(--accent-blue); border: none; border-radius: 8px;
}
.btn-primary:hover { background-color: #0ea5e9; }

/* Modals & Inputs */
.custom-input { 
    background: var(--bg-base); border: 1px solid var(--border-color); color: var(--text-main) !important; border-radius: 8px; font-weight: 300;
}
.custom-input:focus { background: var(--bg-base); border-color: var(--accent-blue); box-shadow: none; }

/* Accordion (FAQ) */
.accordion-button:not(.collapsed) { background-color: rgba(56, 189, 248, 0.05); color: var(--accent-blue) !important; box-shadow: none; }
.accordion-button:focus { box-shadow: none; border-color: transparent; }
.accordion-body { font-weight: 300; }

/* --- PŁYWAJĄCY COOKIE BAR --- */
.cookie-banner-wrapper {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    z-index: 9999;
    padding: 0 16px;
    animation: slideUp 0.5s ease-out forwards;
}

.cookie-banner-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.3);
}

@keyframes slideUp {
    from { transform: translate(-50%, 100px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* Scrollbar Sidebaru */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 4px; }

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; max-width: 100%; padding: 1.5rem; }
    .cookie-banner-wrapper { bottom: 10px; }
}