﻿html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

html, body {
    height: 100%;
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overscroll-behavior: none;
}

/* ============================================== */
/* === ZMIENNE I KOLORY === */
/* ============================================== */
:root {
    --brand-blue: #0d2c56;
    --brand-gold: #d4a017;
    --primary-color: var(--brand-blue);
    --accent-color: var(--brand-gold);
    --sidebar-width: 260px;
    --navbar-height: 60px;
}

/* ============================================== */
/* === BOOTSTRAP OVERRIDES & UTILITIES === */
/* ============================================== */
.bg-primary-custom {
    background-color: var(--brand-blue);
}

.text-primary-custom {
    color: var(--brand-blue);
}

.text-primary {
    color: var(--brand-blue) !important;
}

.border-primary {
    border-color: var(--brand-blue) !important;
}

.btn-primary {
    background-color: var(--brand-blue);
    border-color: var(--brand-blue);
}

    .btn-primary:hover, .btn-primary:active, .btn-primary:focus {
        background-color: #082042;
        border-color: #082042;
    }

.btn-accent {
    background-color: var(--brand-gold);
    color: white;
    font-weight: bold;
    border: none;
}

    .btn-accent:hover {
        background-color: #b88a10;
        color: white;
    }

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus, .form-select:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 44, 86, 0.25);
    border-color: var(--brand-blue);
}

/* ============================================== */
/* === UKŁAD STRONY (LAYOUT) === */
/* ============================================== */
body.public-layout {
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow-y: auto;
}

body.admin-layout {
    display: flex;
    background-color: #f8f9fa; /* Jaśniejsze tło dla Dashboardu */
    height: 100vh;
    overflow: hidden;
}

.admin-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* --- SIDEBAR --- */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--brand-blue);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    height: 100%;
}

    #sidebar .sidebar-brand {
        padding: 20px;
        background: rgba(0,0,0,0.2);
        font-size: 1.2rem;
        font-weight: bold;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        text-align: center;
        flex-shrink: 0;
    }

    #sidebar ul.components {
        padding: 20px 0;
        flex: 1;
        overflow-y: auto;
    }

    #sidebar ul li a {
        padding: 15px 25px;
        font-size: 1rem;
        display: flex;
        align-items: center;
        color: rgba(255,255,255,0.8);
        text-decoration: none;
        transition: 0.3s;
        border-left: 4px solid transparent;
    }

        #sidebar ul li.active a,
        #sidebar ul li a:hover {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: var(--brand-gold);
            color: #fff;
        }

        #sidebar ul li a i {
            margin-right: 15px;
            font-size: 1.2rem;
            width: 25px;
            text-align: center;
        }

.sidebar-footer {
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

/* --- CONTENT --- */
#content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-navbar {
    background: #fff;
    padding: 0 30px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: var(--navbar-height);
    flex-shrink: 0;
    z-index: 50;
}

main.app-main-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ============================================== */
/* === SOFT UI & MODERN FORM (WERSJA SLIM) === */
/* ============================================== */
.form-control, .form-select, .input-group-text {
    height: 36px !important; /* ZMNIEJSZONO: Z 38px na 36px (zgrabniejsze) */
    border-radius: 6px !important; /* ZMNIEJSZONO: Z 8px na 6px (mniej "bąbelkowe") */
    border: 1px solid #e0e0e0 !important;
    background-color: #fcfcfc !important;
    padding-left: 10px !important; /* ZMNIEJSZONO: Z 12px na 10px */
    padding-right: 10px !important;
    font-size: 0.875rem !important; /* 14px - idealne do paneli admina */
    color: #343a40 !important; /* Ciemny szary zamiast czarnego (łagodniejszy dla oka) */
    box-shadow: none !important;
    transition: all 0.2s ease-in-out;
}

/* Wersja LG - na wszelki wypadek też zmniejszamy */
.form-control-lg, .form-select-lg {
    height: 44px !important;
    font-size: 0.95rem !important;
}

/* Stan aktywny (kliknięcie) */
.form-control:focus, .form-select:focus {
    background-color: #fff !important;
    border-color: var(--brand-blue) !important;
    box-shadow: 0 0 0 3px rgba(13, 44, 86, 0.1) !important; /* Subtelna poświata zamiast cienia */
    transform: none !important; /* Usunięto podskakiwanie (translateY), żeby nie męczyło wzroku */
}

.form-label-unified {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d; /* Szary tekst etykiet */
    margin-bottom: 4px;
    display: block;
}

/* ============================================== */
/* === KARTY I ROZCIĄGANIE === */
/* ============================================== */
.card-stretch {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.card-body-stretch {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

/* ============================================== */
/* === MODAL CZYTNIKA === */
/* ============================================== */
@keyframes pulse-blue {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
        text-shadow: 0 0 15px rgba(13,110,253,0.6);
    }

    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

.modal-icon-pulse {
    font-size: 4rem;
    color: #0d6efd;
    animation: pulse-blue 1.5s infinite;
}

.modal-reader-content {
    background-color: #fcfcfc;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* ============================================== */
/* === FLATPICKR & SLIDER === */
/* ============================================== */
.flatpickr-calendar {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(13, 44, 86, 0.15) !important;
    padding: 10px !important;
    font-family: 'Segoe UI', sans-serif !important;
    background: #fff !important;
}

.flatpickr-months {
    background: var(--brand-blue) !important;
    color: #fff !important;
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    padding: 15px 5px 5px 5px !important;
    margin-bottom: 10px !important;
}

.flatpickr-day.selected {
    background: var(--brand-blue) !important;
    border-color: var(--brand-blue) !important;
}

.flatpickr-day.today:after {
    background-color: var(--brand-gold);
}

/* Suwak Czasu */
.noUi-connect {
    background: var(--brand-blue);
}

.noUi-horizontal .noUi-handle {
    width: 20px;
    height: 20px;
    right: -10px;
    top: -7px;
    border: 2px solid #fff;
    background: var(--brand-gold);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.noUi-handle:before, .noUi-handle:after {
    display: none;
}

/* ============================================== */
/* === MODERN DASHBOARD ADDITIONS (NOWE STYLE) === */
/* ============================================== */

/* 1. Miękkie tła dla ikon */
.bg-primary-soft {
    background-color: rgba(13, 110, 253, 0.1);
}

.bg-success-soft {
    background-color: rgba(25, 135, 84, 0.1);
}

.bg-danger-soft {
    background-color: rgba(220, 53, 69, 0.1);
}

.bg-warning-soft {
    background-color: rgba(255, 193, 7, 0.15);
}

.bg-indigo-soft {
    background-color: rgba(102, 16, 242, 0.1);
}

/* Kolory tekstów do pary z tłami */
.text-indigo {
    color: #6610f2;
}

/* Obramowania subtelne */
.border-success-subtle {
    border-color: rgba(25, 135, 84, 0.2) !important;
}

.border-indigo-subtle {
    border-color: rgba(102, 16, 242, 0.2) !important;
}

/* 2. Kwadratowe Ikony (Kafelki) */
.icon-sq {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 3. Efekt Uniesienia Kafelków Statystyk */
.hover-elevate-stat {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .hover-elevate-stat:hover {
        transform: translateY(-5px);
        box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1) !important;
    }

/* 4. Przycisk Akcji z Gradientem (Wydaj Kartę) */
.action-btn-gradient {
    background: linear-gradient(135deg, #0d6efd 0%, #0043a8 100%);
    border: none;
    transition: all 0.3s;
}

    .action-btn-gradient:hover {
        background: linear-gradient(135deg, #0b5ed7 0%, #003585 100%);
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(13, 110, 253, 0.3);
    }

/* 4a. Przycisk Akcji z Gradientem CZERWONY (Blokada) */
.action-btn-gradient-red {
    background: linear-gradient(135deg, #dc3545 0%, #a80010 100%) !important;
    border: none !important;
    color: white !important;
    transition: all 0.3s;
}

    .action-btn-gradient-red:hover {
        background: linear-gradient(135deg, #bb2d3b 0%, #85000d 100%) !important;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
    }

/* 5. Custom Tabs - FINAL (Metoda Warstwowa - Linear Gradient) */

/* A. STAN NIEAKTYWNY */
.btn-white {
    background-color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
    color: #6c757d !important;
    box-shadow: none !important;
}

    .btn-white:hover {
        background-color: #e9ecef !important;
        color: var(--brand-blue) !important;
        border-color: #ced4da !important;
    }

/* B. STAN AKTYWNY */
.active-tab-mode,
.active-tab-mode:hover,
.active-tab-mode:focus,
.active-tab-mode:active {
    /* 1. KOLOR BAZOWY: Twój granat */
    background-color: var(--brand-blue) !important;
    /* 2. WARSTWA ROZJAŚNIAJĄCA: Dokładnie taka jak w Sidebarze (10% bieli) */
    /* Użycie gradientu symuluje nałożenie jednej warstwy na drugą */
    /* Reszta styli */
    color: #ffffff !important;
    border: 1px solid transparent !important; /* Ramka przezroczysta */
    outline: none !important;
    box-shadow: none !important;
}

    /* Usunięcie obwódki systemowej */
    .btn-white:focus, .active-tab-mode:focus {
        box-shadow: none !important;
        outline: none !important;
    } 

/* 6. Typography Helpers */
.ls-1 {
    letter-spacing: 1px;
}

.letter-spacing-2 {
    letter-spacing: 4px;
}

.stats-container-spacing {
    margin-bottom: 2rem !important;
}

/* 7. Scrollbar wewnątrz karty formularza */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

    .custom-scrollbar::-webkit-scrollbar-thumb:hover {
        background: #bbb;
    }

/* 8. Status Dots (WPF Style) */
.status-dots-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    border-radius: 6px;
}

    .status-row:hover {
        background-color: #f8f9fa;
    }

.status-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #343a40;
}

.status-dot.idle {
    background-color: #e9ecef;
    border: 2px solid #ced4da;
    color: #adb5bd;
}

.status-dot.processing {
    background-color: transparent;
    border: 2px solid #0d6efd;
    color: #0d6efd;
}

.status-dot.success {
    background-color: #198754;
    border: 2px solid #198754;
    color: white;
}

.status-dot.error {
    background-color: #dc3545;
    border: 2px solid #dc3545;
    color: white;
}

/* --- CUSTOM RADIO & CHECKBOX BUTTONS (Granatowy Aktywny) --- */

/* Styl dla grupy przycisków wyboru (Ważność, Pakiety) */
.btn-check-navy:checked + .btn-navy-outline {
    background-color: var(--brand-blue) !important;
    color: white !important;
    border-color: var(--brand-blue) !important;
    box-shadow: 0 4px 6px rgba(13, 44, 86, 0.2);
}

/* Styl domyślny (nieaktywny) */
.btn-navy-outline {
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #6c757d; /* Szary tekst */
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

    .btn-navy-outline:hover {
        background-color: #f8f9fa;
        color: var(--brand-blue);
        border-color: #ced4da;
    }

/* Ukrycie suwaka przewijania wewnątrz formularza jeśli coś wystaje */
.overflow-hidden-x {
    overflow-x: hidden;
}

/* --- BUTTONY DNI TYGODNIA (OKRĄGŁE) --- */

/* Domyślny wygląd (nieaktywny) */
.btn-day-custom {
    width: 35px;
    height: 35px;
    padding: 0;
    display: flex; /* Centrowanie tekstu */
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 1px solid #dee2e6;
    color: #495057;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.2s ease-in-out;
}

    /* Hover (po najechaniu) */
    .btn-day-custom:hover {
        border-color: var(--brand-blue);
        color: var(--brand-blue);
        background-color: #f8f9fa;
    }

/* AKTYWNY (Zaznaczony - Checkbox:checked) */
/* To jest kluczowe - wiąże stan checkboxa z wyglądem etykiety */
.btn-check-navy:checked + .btn-day-custom {
    background-color: var(--brand-blue) !important;
    color: #ffffff !important;
    border-color: var(--brand-blue) !important;
    box-shadow: 0 4px 6px rgba(13, 44, 86, 0.2);
}
