/* Plik: assets/css/bip.css */

:root {
    --primary: #0b325e;        /* Głęboki granat urzędowy */
    --primary-hover: #072242;
    --accent-red: #c0262b;      /* Czerwień urzędowa BIP */
    --text-main: #1f2937;
    --text-muted: #64748b;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --focus-ring: #ffbf47;
    --font-base: 15px;
}

/* Skalowanie czcionki dla opcji WCAG */
body.font-lg { --font-base: 17px; }
body.font-xl { --font-base: 19px; }

/* Tryb Wysokiego Kontrastu (WCAG 2.1 AA) */
body.contrast-mode {
    --primary: #ffff00;
    --primary-hover: #ffffff;
    --accent-red: #ffff00;
    --text-main: #ffff00;
    --text-muted: #ffffff;
    --bg-main: #000000;
    --bg-card: #000000;
    --border-color: #ffff00;
    --focus-ring: #ffffff;
}
body.contrast-mode * {
    background-color: #000000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
}
body.contrast-mode a:hover, 
body.contrast-mode a:focus {
    background-color: #ffff00 !important;
    color: #000000 !important;
}

/* Reset bazowy */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: var(--font-base);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
}

/* Dostępność: Skiplinki i focus */
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.skiplink {
    position: absolute; top: -100px; left: 10px; background: #000; color: #fff;
    padding: 10px 15px; z-index: 9999; font-weight: bold; text-decoration: none;
}
.skiplink:focus { top: 10px; }

/* Pasek narzędzi WCAG */
.wcag-bar {
    background: #0f172a; color: #fff; padding: 6px 0; font-size: 13px;
}
.wcag-container {
    max-width: 1240px; margin: 0 auto; padding: 0 15px; display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
.wcag-btn {
    background: #1e293b; color: #fff; border: 1px solid #475569; padding: 2px 8px;
    border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: bold;
}
.wcag-btn:hover { background: #334155; }

/* Główny Nagłówek */
.main-header {
    background: #fff; border-bottom: 3px solid var(--accent-red); padding: 15px 0;
}
.header-container {
    max-width: 1240px; margin: 0 auto; padding: 0 15px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;
}
.brand-box { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.herb-img { height: 75px; width: auto; object-fit: contain; }
.brand-text h1 { font-size: 20px; color: var(--primary); font-weight: 800; line-height: 1.2; }
.brand-text span { font-size: 13px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.bip-emblem {
    display: flex; align-items: center; gap: 8px; background: #f1f5f9; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border-color); text-decoration: none;
}
.bip-logo-box {
    background: var(--accent-red); color: #fff; font-weight: 900; padding: 2px 8px; border-radius: 3px; font-size: 16px;
}

/* Wyszukiwarka */
.search-form { display: flex; max-width: 320px; width: 100%; }
.search-input {
    flex: 1; padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 4px 0 0 4px; font-size: 14px;
}
.search-btn {
    background: var(--primary); color: #fff; border: none; padding: 8px 16px; border-radius: 0 4px 4px 0; cursor: pointer; font-weight: bold;
}

/* Układ serwisu: Siatka 2-kolumnowa */
.site-wrapper {
    max-width: 1240px; margin: 25px auto; padding: 0 15px; display: grid; grid-template-columns: 310px 1fr; gap: 30px; align-items: start;
}
@media (max-width: 900px) {
    .site-wrapper { grid-template-columns: 1fr; }
}

/* =========================================
   BLOKI MENU BOCZNEGO (KARTY Z GRANATOWYMI NAGŁÓWKAMI)
   ========================================= */
.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sidebar-section .section-header {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section .section-header a {
    color: #ffffff;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-section .section-header a:hover {
    color: #e2e8f0;
}

.sidebar-section .section-header .header-arrow {
    font-size: 18px;
    line-height: 1;
    opacity: 0.8;
}

.sidebar-section .section-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-section .section-list li {
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section .section-list li:last-child {
    border-bottom: none;
}

.sidebar-section .section-list li a {
    display: block;
    padding: 8px 14px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    border-left: 3px solid transparent;
    transition: all 0.15s ease-in-out;
}

.sidebar-section .section-list li a:hover {
    background-color: #f1f5f9;
    color: var(--primary);
    border-left-color: var(--primary);
    padding-left: 17px;
}

.sidebar-section .section-list li a.active {
    background-color: #f8fafc;
    color: var(--primary);
    font-weight: 700;
    border-left: 4px solid var(--accent-red);
}

/* Treść podstrony */
.content-card {
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 6px; padding: 30px; min-height: 500px;
}
.page-title {
    font-size: 22px; color: var(--primary); margin-bottom: 20px; border-bottom: 2px solid var(--border-color); padding-bottom: 10px;
}
.page-body { font-size: 15px; margin-bottom: 25px; }
.page-body p { margin-bottom: 12px; }

/* Breadcrumbs */
.bip-breadcrumbs {
    font-size: 13px; color: var(--text-muted); margin-bottom: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color);
}
.bip-breadcrumbs a { color: var(--primary); text-decoration: none; }
.bip-breadcrumbs a:hover { text-decoration: underline; }
.bip-breadcrumbs .crumb-current { color: var(--text-main); font-weight: 600; }

/* Siatka kafelków podstron */
.subpages-container {
    margin: 25px 0; padding: 20px; background: #f8fafc; border: 1px solid var(--border-color); border-radius: 6px;
}
.subpages-title { font-size: 15px; color: var(--primary); margin-bottom: 12px; }
.subpages-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px;
}
.subpage-card {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #ffffff;
    border: 1px solid var(--border-color); border-radius: 5px; text-decoration: none;
    color: var(--text-main); font-size: 13.5px; font-weight: 600; transition: all 0.15s ease-in-out;
}
.subpage-card:hover {
    border-color: var(--primary); background: #f1f5f9; transform: translateY(-1px);
}
.subpage-icon { font-size: 18px; color: var(--accent-red); font-weight: bold; line-height: 1; }

/* Załączniki */
.attachments-box {
    margin-top: 30px; border-top: 2px solid var(--border-color); padding-top: 20px;
}
.attachments-box h3 { font-size: 17px; margin-bottom: 15px; color: var(--primary); }
.attachment-item {
    display: flex; justify-content: space-between; align-items: center; padding: 12px; border: 1px solid var(--border-color);
    border-radius: 6px; margin-bottom: 10px; background: #ffffff;
}
.att-badge {
    background: var(--accent-red); color: #fff; padding: 3px 6px; border-radius: 3px; font-size: 10px; font-weight: 800; margin-right: 8px;
}
.att-download-btn {
    background: var(--primary); color: #fff; text-decoration: none; padding: 6px 14px; border-radius: 4px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.att-download-btn:hover { background: var(--primary-hover); }

/* Ustawowa Metryka Sprawy */
.bip-registry-card {
    margin-top: 35px; background: #f8fafc; border: 1px solid var(--border-color); border-left: 4px solid var(--primary); border-radius: 4px; padding: 16px; font-size: 13px;
}
.registry-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 8px;
}
.registry-item strong { color: var(--text-muted); display: block; font-size: 11px; text-transform: uppercase; }

/* Stopka */
.main-footer {
    background: #0f172a; color: #94a3b8; padding: 30px 0; margin-top: 50px; font-size: 13px; border-top: 3px solid var(--accent-red);
}
.footer-container {
    max-width: 1240px; margin: 0 auto; padding: 0 15px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.footer-links a { color: #cbd5e1; text-decoration: none; margin-right: 15px; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

.sidebar-section .section-header.active-header {
    border-left: 4px solid var(--accent-red);
    background: var(--primary-hover);
}
body.contrast-mode .sidebar-section .section-header.active-header {
    border-left: 4px solid #ffffff !important;
}

article ul, 
article ol,
#content ul, 
#content ol,
#tresc ul, 
#tresc ol,
.tresc ul, 
.tresc ol,
main ul, 
main ol,
.content ul,
.content ol,
.instrukcja-bip ul,
.instrukcja-bip ol {
    padding-left: 35px !important;
    margin-left: 10px !important;
    margin-top: 8px !important;
    margin-bottom: 16px !important;
}

article li, 
#content li, 
#tresc li, 
.tresc li, 
main li, 
.content li,
.instrukcja-bip li {
    margin-bottom: 6px !important;
    line-height: 1.6 !important;
}

/* Listy zagnieżdżone (podpunkty drugiego poziomu) */
article ul ul, 
article ol ul,
#content ul ul,
#tresc ul ul,
.tresc ul ul,
.content ul ul {
    padding-left: 25px !important;
    margin-top: 5px !important;
    margin-bottom: 8px !important;
}
/* ========================================================================= */
/* MODUŁ: ZAMÓWIENIA PUBLICZNE I PRZETARGI (SPÓJNY Z BIP TARNOWIEC)          */
/* ========================================================================= */

.bip-modul-przetargi {
    color: #1e293b;
    font-family: inherit;
}

/* TYTUŁ I PODZIAŁKA */
.bip-modul-przetargi h1.page-heading {
    font-size: 26px;
    font-weight: 800;
    color: #0f2b48;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

/* ZAKŁADKI (TABS) */
.bip-tabs-nav {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #e2e8f0;
    margin: 20px 0 25px 0;
}
.bip-tab-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
    font-size: 14.5px;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.bip-tab-link:hover {
    color: #0f2b48;
}
.bip-tab-link.active {
    color: #c02424;
    border-bottom-color: #c02424;
}
.bip-tab-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}
.bip-tab-link.active .bip-tab-badge {
    background: #fee2e2;
    color: #991b1b;
}

/* KAFELKI POSTĘPOWAŃ NA LIŚCIE */
.bip-tender-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.bip-tender-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}
.bip-tender-meta-top {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.bip-tender-title {
    margin: 0 0 14px 0;
    font-size: 18px;
    line-height: 1.4;
}
.bip-tender-title a {
    color: #0f2b48;
    text-decoration: none;
    font-weight: 700;
}
.bip-tender-title a:hover {
    color: #c02424;
    text-decoration: underline;
}
.bip-tender-dates-box {
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 25px;
}
.bip-tender-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 14px;
    font-size: 13.5px;
}

/* URZĘDOWY PRZYCISK GRANATOWY (JAK W CAŁYM BIP) */
.btn-bip-navy {
    background: #0f2b48 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 8px 18px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 13px;
    display: inline-block;
    white-space: nowrap;
    transition: background 0.15s;
}
.btn-bip-navy:hover {
    background: #173f6b !important;
}

/* WIDOK POJEDYNCZEGO PRZETARGU */
.bip-details-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.bip-back-link {
    font-size: 14px;
    font-weight: 700;
    color: #0f2b48;
    text-decoration: none;
}
.bip-back-link:hover {
    color: #c02424;
    text-decoration: underline;
}
.bip-status-badge {
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}
.bip-status-badge.active { background: #dcfce7; color: #166534; }
.bip-status-badge.past { background: #f1f5f9; color: #475569; }

.bip-dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 15px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
    margin: 20px 0;
}
.bip-date-col small {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 3px;
}
.bip-date-col strong {
    font-size: 15px;
}
.bip-officer-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 20px;
}

/* SEKCJA ZAŁĄCZNIKÓW */
.bip-attachments-container {
    margin-top: 35px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}
.bip-attachments-title {
    font-size: 16px;
    font-weight: 800;
    color: #0f2b48;
    margin: 0 0 16px 0;
}
.bip-attachments-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.bip-attachment-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.bip-attachment-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-grow: 1;
}
.bip-format-badge {
    background: #c02424;
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 800;
    padding: 3px 6px;
    border-radius: 3px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    margin-top: 2px;
}
.bip-attachment-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.45;
    text-decoration: none;
}
.bip-attachment-name:hover {
    color: #c02424;
    text-decoration: underline;
}
.bip-attachment-meta {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}