/* ===================================================================
 *  KRS Dashboard - Główny Arkusz Stylów
 *  Wersja: 2.0 (po redesignie)
 * ===================================================================
 *  1. Zmienne globalne
 *  2. Style podstawowe (body, typografia)
 *  3. Główny layout (Sidebar, Main Content, Header)
 *  4. Komponenty (Karty, Tabele, Listy, Przyciski, Badges)
 *  5. Style pomocnicze (utility)
 *  6. Responsywność
 * =================================================================== */

/* -----------------------------------------
 *  1. Zmienne globalne
 * ----------------------------------------- */
:root {
/*    --bs-primary-rgb: 32, 76, 152; /* Definiuje główny kolor dla Bootstrapa */
/*    --bs-primary: #204C98;*/
/*    --bs-border-radius-pill: 0.3rem; /* Zaokrąglenie dla przycisków i elementów interaktywnych */
    --bs-border-radius: 0.25rem;
    --app-bg: #f8f9fa;
    --app-sidebar-bg: #1e293b; /* Ciemny granat/szary dla sidebara */
    --app-sidebar-text: rgba(255, 255, 255, 0.7);
    --app-sidebar-text-active: #ffffff;
    --app-sidebar-active-bg: rgba(255, 255, 255, 0.1);
    --app-card-bg: #ffffff;
    --app-border-color: #e5e7eb;
    --app-border-radius: 0.75rem;
    --app-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* -----------------------------------------
 *  2. Style podstawowe
 * ----------------------------------------- */
html {
    /* Globalna wielkość czcionki (domyślnie 1rem = 16px).
       Ustawienie tutaj zmienia wartość bazową dla całej aplikacji. */
    font-size: 14px; /* Możesz eksperymentować z tą wartością, np. 14px, 15px */
}

body {
    background-color: var(--app-bg);
    font-family: 'Inter', sans-serif; /* Nowoczesna, czytelna czcionka */
}

/* -----------------------------------------
 *  3. Główny layout
 * ----------------------------------------- */

/* --- Sidebar (Desktop) --- */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1030;
    background-color: var(--app-sidebar-bg);
    color: var(--app-sidebar-text);
    transition: width 0.3s ease-in-out;
    overflow-x: hidden; /* Ukrywa tekst podczas zwijania */
}

.sidebar .sidebar-brand {
    color: var(--app-sidebar-text-active);
    white-space: nowrap;
}

.sidebar .nav-link {
    /* Używamy 'em', aby rozmiar był proporcjonalny do otoczenia, a nie sztywno do roota */
    font-size: 1em;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    white-space: nowrap;
    color: var(--app-sidebar-text);
}

.sidebar .nav-link i {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
    transition: margin-right 0.3s ease-in-out;
}

.sidebar .nav-link:hover {
    color: var(--app-sidebar-text-active);
    background-color: var(--app-sidebar-active-bg);
}

.sidebar .nav-link.active {
    color: var(--app-sidebar-text-active);
    background-color: var(--bs-primary);
    font-weight: 600;
}

/* --- Główna treść --- */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
    overflow-x: hidden;
}

/* --- Stan zwinięty (Desktop) --- */
body.sidebar-collapsed .sidebar {
    width: 80px;
}

body.sidebar-collapsed .sidebar .sidebar-brand span,
body.sidebar-collapsed .sidebar .nav-link span {
    display: none;
}

body.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
    padding: 0.75rem 1rem;
}

body.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0;
}

@media (min-width: 992px) { /* Stosuj tylko na desktopie */
    body.sidebar-collapsed .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
    }
}

/* --- Górny pasek (Header) --- */
.main-header {
    background-color: var(--app-card-bg);
    border-bottom: 1px solid var(--app-border-color);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Przycisk zwijania sidebara - po przeniesieniu na sidebar */
#desktop-toggle-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1031; /* Wyżej niż sidebar, aby był zawsze klikalny */
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--app-sidebar-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
#desktop-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--app-sidebar-text-active);
}

/* --- Kontrolki DataTables --- */
/* Klasa pomocnicza do centrowania kontrolek w pionie wewnątrz kolumn */
.dt-v-center {
    display: flex;
    align-items: center;
}

/* Zerujemy domyślny padding-top dla kontrolki 'info', ale tylko wtedy,
   gdy znajduje się ona wewnątrz naszej kolumny do centrowania. */
div.dt-v-center div.dt-info,
div.dt-v-center div.dt-length,
div.dt-v-center div.dt-paging {
    padding-top: 0;
}

/* -----------------------------------------
 *  4. Komponenty
 * ----------------------------------------- */

/* --- Karty --- */
.card {
    border: none;
    box-shadow: var(--app-box-shadow);
    border-radius: var(--app-border-radius);
}

.card-header {
    background-color: var(--app-card-bg);
    border-bottom: 1px solid var(--app-border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* --- Listy wewnątrz kart (dla company_view) --- */
.data-list-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.data-list-item:last-child {
    border-bottom: none;
}
.data-list-item .label {
    color: #6c757d;
}
.data-list-item .value {
    color: black;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: right;
}

/* --- Tabele --- */
.table-hover tbody tr {
    cursor: pointer;
}

/* --- Stare style, do usunięcia --- 

 --- Logo firmy w tabeli --- 
.company-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}
----- */
 /*--- Logo w nagłówku wizytówki firmy --- */
.company-logo-placeholder {
    width: 160px;
    height: 60px;
    border-radius: 0.75rem;  /*Taki sam jak karty */
    background-color: #e9ecef;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.8rem;
}

/* --- Logo wgrane przez użytkownika --- */
.company-logo-img {
    /* width: 80px;  */
    height: 60px;
    border-radius: 0.75rem;
    object-fit: contain; /* Zapobiega rozciąganiu logo */
    background-color: #ffffff; /* Jasne tło dla przezroczystych PNG */
}

/* --- Miniaturka logo w oknie modalnym --- */
.modal-logo-thumbnail {
    /* width: 48px; */
    height: 30px;
    object-fit: contain;
    border-radius: 0.375rem; /* Domyślne zaokrąglenie Bootstrapa */
}

/* --- Kategorie w oknie modalnym --- */
.cat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;

    padding: 0.35rem 0.5rem;
    /* border: 1px solid #e1e1e1;
    border-radius: 0.35rem; */
}

/* --- Logo i Placeholder na liście firm --- */
.company-logo-list,
.company-logo-placeholder-list {
    width: 80px;
/*    height: 48px;   */
    border-radius: 0.5rem; /* Mniejszy promień, pasujący do mniejszego rozmiaru */
}

.company-logo-list {
    object-fit: contain;
    background-color: #ffffff;
}

.company-logo-placeholder-list {
    background-color: #e9ecef;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

/* --- Badges --- */
.badge.bg-success { color: white !important; }
.badge.bg-secondary { color: white !important; }


.badge-grid {
    display: inline-grid;
    grid-template-columns: auto auto; /* Dwie kolumny o auto-szerokości */
    gap: 0.25rem; /* Odstęp między badgami (Twój "niewielki odstęp") */
    flex-shrink: 0; /* Zapobiega kurczeniu się grupy badge'y */
}

/* -----------------------------------------
 *  5. Style pomocnicze
 * ----------------------------------------- */

/* --- Przycisk kopiowania --- */
.copy-btn {
    font-size: 1.1em; /* Proporcjonalny do otaczającego tekstu */
    background: none;
    border: none;
    color: var(--bs-primary);
    font-size: 1.2rem;
    margin-left: 5px;
    cursor: pointer;
    vertical-align: middle;
}
.copy-btn:active {
    color: #163362;
}

/* --- Przycisk rozwijania opisu (reprezentacja) --- */
.representation-toggle {
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    color: var(--bs-primary);
}
.representation-toggle .text-hide {
    display: none;
}
.representation-toggle[aria-expanded="true"] .text-hide {
    display: inline;
}
.representation-toggle[aria-expanded="true"] .text-show {
    display: none;
}

/* -----------------------------------------
 *  6. Responsywność
 * ----------------------------------------- */
@media (max-width: 991.98px) { /* Poniżej 'lg' */
    /* Ukryj pasek desktopowy */
    .sidebar {
        left: -300px;
    }

    /* Główna zawartość zajmuje 100% */
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    /* Pasek nawigacji mobilnej (offcanvas) */
    /* Poprawka: Celujemy w ogólną klasę .offcanvas, a nie .offcanvas-lg */
    /* OSTATECZNA POPRAWKA: Używamy ID #mobile-menu dla maksymalnej precyzji */
    #mobile-menu {
        background-color: var(--app-sidebar-bg);
        color: var(--app-sidebar-text-active);
    }

    #mobile-menu .offcanvas-header .offcanvas-title {
        color: var(--app-sidebar-text-active);
    }

    #mobile-menu .offcanvas-body .nav-link {
        /* Jawne ustawienie koloru, aby uniknąć dziedziczenia */
        font-size: 1.1em; /* Lekko większa czcionka dla lepszej czytelności na mobile */
        color: var(--app-sidebar-text);
    }
    #mobile-menu .offcanvas-body .nav-link:hover,
    #mobile-menu .offcanvas-body .nav-link.active {
        color: var(--app-sidebar-text-active);
        background-color: var(--app-sidebar-active-bg);
    }
}
