/*
Theme Name: Szablon BIP
Author: Twój Urząd
Description: Prosty, dostępny motyw BIP zgodny z WCAG 2.1 z obsługą skalowania tekstu.
Version: 1.2
*/

/* =========================================
   1. ZMIENNE I RESET (Podstawa skalowania)
   ========================================= */
:root {
    --primary-color: #0056b3;    /* Główny niebieski */
    --secondary-color: #f4f4f4;  /* Tła */
    --text-color: #333;          /* Tekst główny */
    --bg-color: #fff;            /* Tło strony */
    --border-color: #ddd;        /* Ramki */
    --meta-bg: #f9f9f9;          /* Tło metryczki */
    --alert-color: #d9534f;      /* Czerwony akcent (np. metryczka) */
}

* {
    box-sizing: border-box;
}

/* KLUCZOWE DLA SKALOWANIA: 
   Ustawiamy bazę na 100%. Skrypt JS będzie zmieniał tę wartość (np. na 110%, 120%),
   a reszta strony dostosuje się automatycznie dzięki jednostkom 'rem'. */
html {
    font-size: 100%; 
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    color: var(--text-color);
    background-color: var(--bg-color);
    font-size: 1rem; /* 1rem = aktualny rozmiar html */
}

/* Typografia skalowalna */
h1 { font-size: 2rem; margin-bottom: 0.5em; line-height: 1.2; }
h2 { font-size: 1.75rem; margin-bottom: 0.5em; }
h3 { font-size: 1.4rem; margin-bottom: 0.5em; }
p, li { font-size: 1rem; margin-bottom: 1em; }

/* Linki */
a { color: var(--primary-color); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* Kontener */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================
   2. PASEK DOSTĘPNOŚCI (WCAG)
   ========================================= */
.accessibility-bar {
    background: #333;
    color: #fff;
    padding: 5px 0;
    text-align: right;
    font-size: 0.9rem;
}

.accessibility-bar button {
    background: #555;
    color: #fff;
    border: 1px solid #777;
    padding: 2px 10px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.9rem;
}

.accessibility-bar button:hover,
.accessibility-bar button:focus {
    background: #777;
    outline: 2px solid #fff;
}

/* Skip link - widoczny tylko po tabulacji (Klawiatura) */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 15px;
    z-index: 9999;
    font-weight: bold;
    transition: top 0.3s;
}
.skip-link:focus {
    top: 0;
}

/* =========================================
   3. NAGŁÓWEK (HEADER)
   ========================================= */
.site-header {
    border-bottom: 4px solid var(--primary-color);
    padding: 1.5rem 0;
    background: #fff;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bip-logo {
    height: 60px; /* Logo BIP ma stały rozmiar */
    width: auto;
}

.site-title h1 {
    font-size: 1rem;
    color: #666;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.site-title h2 {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 700;
}
.site-title h2 a { color: #000; text-decoration: none; }

/* Wyszukiwarka */
.search-box input {
    padding: 8px;
    border: 1px solid #ccc;
    font-size: 1rem;
}
.search-box button {
    padding: 8px 15px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

/* =========================================
   4. UKŁAD GŁÓWNY (GRID)
   ========================================= */
.main-layout {
    display: grid;
    grid-template-columns: 250px 1fr; /* Menu boczne | Treść */
    gap: 2rem;
    margin-top: 2rem;
    margin-bottom: 3rem;
}

/* Menu boczne */
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.3rem;
    border-bottom: 1px solid #eee;
}

.sidebar-nav a {
    display: block;
    padding: 0.8rem 1rem;
    background: var(--secondary-color);
    color: var(--text-color);
    border-left: 4px solid transparent;
    transition: background 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav .current-menu-item > a {
    background: #e9e9e9;
    border-left-color: var(--primary-color);
    font-weight: bold;
    text-decoration: none;
}

/* Okruszki (Breadcrumbs) */
.breadcrumbs {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

/* =========================================
   5. TREŚĆ I ZAŁĄCZNIKI
   ========================================= */
.article-header {
    margin-bottom: 2rem;
}

.article-body {
    margin-bottom: 2rem;
}

/* MODUŁ ZAŁĄCZNIKÓW (Ten, który dodałeś w PHP) */
.bip-attachments {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f4f6f8;
    border-radius: 5px;
    border: 1px solid #e1e4e8;
}

.bip-attachments h3 {
    margin-top: 0;
    font-size: 1.1rem;
    border-bottom: 2px solid #ccc;
    padding-bottom: 0.5rem;
}

.file-list {
    list-style: none;
    padding: 0;
}

.file-item {
    margin-bottom: 0.8rem;
    background: #fff;
    border: 1px solid #ddd;
    transition: transform 0.2s;
}

.file-item:hover {
    transform: translateX(5px);
    border-color: #bbb;
}

.file-item a {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 10px;
    text-decoration: none;
    color: #333;
}

.file-name {
    font-weight: 600;
    color: var(--primary-color);
    flex: 1;
}

.file-meta {
    font-size: 0.85rem;
    color: #666;
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

/* Kolorowe paski typów plików */
.file-item.pdf { border-left: 5px solid #d32f2f; }
.file-item.doc { border-left: 5px solid #2b579a; }
.file-item.xls { border-left: 5px solid #217346; }
.file-item.default { border-left: 5px solid #777; }

/* =========================================
   6. METRYCZKA BIP (WYMAGANE PRAWEM)
   ========================================= */
.bip-metadata {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--meta-bg);
    border: 1px solid var(--border-color);
    border-left: 6px solid var(--alert-color); /* Czerwony pasek wyróżniający */
}

.bip-metadata h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    font-size: 0.9rem;
}

.meta-item strong {
    display: block;
    color: #555;
    margin-bottom: 3px;
}

/* =========================================
   7. STOPKA
   ========================================= */
.site-footer {
    background: #333;
    color: #ccc;
    padding: 2rem 0;
    margin-top: auto; /* Sticky footer fix */
}
.site-footer p { font-size: 0.9rem; margin: 0; text-align: center; }

/* =========================================
   8. MEDIA QUERIES (RESPONSYWNOŚĆ)
   ========================================= */
@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr; /* Jedna kolumna na mobilkach */
    }
    .header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .search-box {
        width: 100%;
    }
    .search-box input {
        width: 100%;
    }
}

/* =========================================
   9. WordPress Classes (Wymagane)
   ========================================= */
.aligncenter { display: block; margin: 0 auto; }
.alignleft { float: left; margin-right: 1.5rem; }
.alignright { float: right; margin-left: 1.5rem; }
img { max-width: 100%; height: auto; }

/* =========================================
   10. WYSOKI KONTRAST (WCAG AAA)
   ========================================= */
body.high-contrast {
    --primary-color: #ffff00;
    --secondary-color: #000;
    --text-color: #ffff00;
    --bg-color: #000;
    --border-color: #ffff00;
    --meta-bg: #000;
    --alert-color: #ffff00;
}

body.high-contrast * {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.high-contrast a {
    color: #00ff00 !important; /* Linki na zielono dla odróżnienia */
    text-decoration: underline !important;
}

body.high-contrast .file-item.pdf, 
body.high-contrast .file-item.doc, 
body.high-contrast .file-item.xls {
    border-left: 5px solid #ffff00 !important; /* Reset kolorów pasków plików */
}

body.high-contrast img {
    filter: grayscale(100%) contrast(120%); /* Opcjonalne uproszczenie grafik */
}