@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap');

:root {
    --primary-color: #0056b3;
    --text-dark: #1a1a1a;
    --text-light: #555555;
    --bg-white: #ffffff;
    --bg-hover: #f4f6f8;
    --border-color: #e0e0e0;
    --header-height: 120px;
}

/* SKIP LINK (WCAG) */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    z-index: 10001;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    scroll-behavior: smooth;
}

/* Zapobiega opóźnieniom i niechcianemu przybliżaniu przy klikaniu na urządzenia dotykowych */
a, button, input, select, textarea, label, .btn {
    touch-action: manipulation;
}

body {
    background-color: #f9f9f9;
    overflow-x: hidden;
    /* Zapobiega poziomemu przewijaniu strony */
    width: 100%;
}

header {
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-white);    
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05), 0 1px 0 0 var(--border-color);
    z-index: 1000;
    transition: box-shadow 0.3s ease;
    /* ZMIANA: Animacja cienia */
    user-select: none;
}

/* Styl dla nagłówka po przewinięciu */
header.scrolled {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1), 0 1px 0 0 var(--border-color);
    /* Mocniejszy cień */
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1500px;
    margin: 0 auto;
    padding: 10px 20px;
    height: var(--header-height);
    gap: 20px;
    /* ZMIANA: Płynna zmiana wysokości przy scrollu */
    transition: height 0.3s ease, padding 0.3s ease;
}

/* Zmniejszenie wysokości nagłówka przy klasie .scrolled */
header.scrolled .header-content {
    height: 80px;
    /* Zmniejszamy wysokość ze 120px na 80px */
}

/* --- LOGO WRAPPER --- */
.logos-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1005;
    flex-shrink: 1;
    min-width: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
}

.emblem img,
.school-logo img {
    height: 70px;
    width: auto;
    transition: height 0.3s ease;
}

/* Zmniejszenie logo przy scrollu */
header.scrolled .emblem img,
header.scrolled .school-logo img {
    height: 50px;
}

.school-logo img {
    border-radius: 50%;
}

.school-title h3 {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    line-height: 1.3;
    white-space: nowrap;
    transition: font-size 0.3s ease;
}

/* Zmniejszenie tekstu przy scrollu */
header.scrolled .school-title h3 {
    font-size: 0.95rem;
}

/* --- NAWIGACJA (DESKTOP) --- */
nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
}

#menu-toggle {
    display: none;
}

.menu {
    list-style: none;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: nowrap;
    transition: gap 0.3s ease;
}

.menu>li {
    position: relative;
    padding: 10px 0;
    flex-shrink: 0;
}

.menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease, font-size 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    white-space: nowrap;
}

.menu>li>a {
    padding: 8px 10px;
    border-radius: 6px;
}

/* Klasa active działa zawsze */
.menu>li>a.active {
    background-color: var(--bg-hover);
    color: var(--primary-color);
}

/* Hover tylko dla myszek */
@media (hover: hover) {
    .menu>li>a:hover {
        background-color: var(--bg-hover);
        color: var(--primary-color);
    }
}

/* --- STRZAŁKI (ARROWS) --- */
.has-submenu>a::after {
    content: '';
    display: block;
    width: 5px;
    height: 5px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.3s ease;
}

.has-submenu:hover>a::after,
.has-submenu.open>a::after {
    transform: rotate(225deg) translateY(0px) !important;
}

/* --- DROPDOWN (PODMENU) --- */
.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-white);
    min-width: 240px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    list-style: none;
    padding: 10px 0;
    z-index: 1001;
}

@media (min-width: 1251px) {

    /* Domyślny stan menu na desktopie: */
    /* Używamy opacity/visibility zamiast display:none, aby obsłużyć opóźnienie */
    .submenu {
        display: block;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        /* Opóźnienie zamykania: visibility zmienia się dopiero po 0.3s */
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.3s;
    }

    .has-submenu:hover>.submenu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        /* Otwieranie natychmiastowe (brak opóźnienia) */
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
    }
}

.submenu li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 20px;
    font-size: 0.95rem;
    color: var(--text-light);
}

@media (hover: hover) {
    .submenu li a:hover {
        background-color: var(--bg-hover);
        color: var(--primary-color);
    }
}

.submenu li a.active {
    background-color: var(--bg-hover);
    color: var(--primary-color);
    font-weight: 600;
}

/* --- ZAGNIEŻDŻONE PODMENU (DESKTOP) --- */
@media (min-width: 1251px) {
    .submenu li {
        position: relative;
        /* Kluczowe dla pozycjonowania podmenu 3. poziomu */
    }

    /* Strzałka w prawo dla elementów zagnieżdżonych */
    .submenu .has-submenu>a::after {
        transform: rotate(-45deg) translateY(0px);
    }

    /* FIX: Blokada obracania strzałki w górę dla WSZYSTKICH zagnieżdżonych menu */
    /* Po najechaniu strzałka obraca się w lewo (135deg), dając efekt otwarcia */
    .submenu .has-submenu:hover>a::after,
    .submenu .has-submenu.open>a::after {
        transform: rotate(135deg) translateY(0px) !important;
    }

    /* --- DYNAMICZNE OTWIERANIE W LEWO (JS wykrywa krawędź) --- */
    /* Klasa .opens-left jest dodawana przez JS, gdy menu nie mieści się z prawej */
    .menu>li.opens-left>.submenu {
        left: auto;
        right: 0;
    }

    /* Zagnieżdżone menu (3 poziom) otwiera się w lewo */
    .menu>li.opens-left .submenu .submenu {
        left: auto;
        right: 100%;
    }

    /* Odwrócenie strzałki dla zagnieżdżonych elementów (wskazuje w lewo) */
    .menu>li.opens-left .submenu .has-submenu>a::after {
        transform: rotate(135deg) translateY(0px);
    }

    /* Animacja strzałki po najechaniu (obrót w prawo) */
    .menu>li.opens-left .submenu .has-submenu:hover>a::after,
    .menu>li.opens-left .submenu .has-submenu.open>a::after {
        transform: rotate(-45deg) translateY(0px) !important;
    }

    /* Przeniesienie strzałki na lewą stronę tekstu */
    .menu>li.opens-left .submenu li a {
        flex-direction: row-reverse;
        /* Ważne: w trybie row-reverse 'flex-end' oznacza wizualnie lewą stronę */
        justify-content: flex-end !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ZAGNIEŻDŻONE PODMENU (Level 3+) --- */
.submenu .submenu {
    top: 0;
    left: 100%;
    margin-top: -5px;
    /* Wyrównanie do góry rodzica */
}

/* --- HAMBURGER ICON --- */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    cursor: pointer;
    z-index: 2005;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--text-dark);
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* --- MEDIA QUERY: 1250px - 1480px --- */
@media (max-width: 1480px) {

    .emblem img,
    .school-logo img {
        height: 60px;
    }

    /* Jeśli scrollujemy w tym widoku, to zmniejszamy do 50px */
    header.scrolled .emblem img,
    header.scrolled .school-logo img {
        height: 50px;
    }

    .school-title h3 {
        font-size: 0.9rem;
    }

    .logos-wrapper {
        gap: 10px;
    }

    .menu {
        gap: 8px;
    }

    .menu>li>a {
        font-size: 0.85rem;
        padding: 8px 6px;
    }
}

/* --- MEDIA QUERY: MOBILE / TABLET (< 1250px) --- */
@media (max-width: 1250px) {

    .emblem img,
    .school-logo img {
        height: 50px;
    }

    .school-title h3 {
        font-size: 0.85rem;
        display: block;
        white-space: normal;
    }

    .header-content {
        padding: 10px 20px;
    }

    .hamburger {
        display: flex;
    }

    /* FULLSCREEN MENU */
    .menu {
        position: fixed;
        top: var(--header-height);
        /* START POD HEADEREM */
        left: 0;
        width: 100%;
        height: calc(100vh - var(--header-height));
        /* NIE POD HEADER */
        background-color: var(--bg-white);

        display: block !important;
        z-index: 1999;
        overflow-y: auto !important;

        clip-path: circle(0px at top right);
        transition: clip-path 0.5s ease-in-out;
        padding-top: 0;
        /* USUWAMY HACK */
    }


    header {
        z-index: 2000 !important;
        /* Header zawsze nad menu fullscreen */
    }

    #menu-toggle:checked~.menu {
        clip-path: circle(150% at top right);
    }

    #menu-toggle:checked~.hamburger span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    #menu-toggle:checked~.hamburger span:nth-child(2) {
        opacity: 0;
    }

    #menu-toggle:checked~.hamburger span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .menu>li {
        width: 100%;
        text-align: center;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        padding: 0;
        display: block;
        /* Upewniamy się, że to blok */
        height: auto;
        /* Pozwalamy li rosnąć wraz z zawartością */
        position: relative;
    }

    .menu>li>a {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        font-size: 1.3rem;
        width: 100%;
        /* Zajmuje całą szerokość */
    }

    .has-submenu>a::after {
        width: 10px;
        height: 10px;
        margin-left: 10px;
        border-width: 0 3px 3px 0;
    }

    .has-submenu.open>a::after {
        transform: rotate(225deg) translateY(0px) !important;
    }

    .submenu {
        /* Usuwamy display: none */
        display: block !important;
        position: static !important;
        width: 100% !important;
        background-color: #fcfcfc !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;

        /* KLUCZ DO ANIMACJI: */
        max-height: 0;
        /* Domyślnie schowane */
        overflow: hidden;
        /* Ukrywa wystającą zawartość */
        opacity: 0;
        /* Dodatkowy efekt zanikania */
        transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
        pointer-events: none;
        /* Blokuje kliknięcia gdy zamknięte */
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            max-height: 0;
        }

        to {
            opacity: 1;
            max-height: 1000px;
            /* Duża wartość, by zmieścić wszystkie linki */
        }
    }

    /* To jest najważniejsza reguła - musi być display: block */
    .has-submenu.open>.submenu {
        max-height: 1000px;
        /* Wartość większa niż wysokość menu */
        opacity: 1;
        pointer-events: auto;
    }

    .submenu li a {
        padding: 15px 40px !important;
        /* Większe wcięcie dla czytelności */
        font-size: 1.1rem;
        color: #666;
        border-bottom: 1px solid rgba(0, 0, 0, 0.02);
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    /* Wcięcie dla zagnieżdżonych poziomów na mobile */
    .submenu .submenu li a {
        padding-left: 60px !important;
        background-color: #f5f5f5 !important;
        /* Nieco ciemniejsze tło dla odróżnienia */
    }

    @keyframes mobileSlideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

@media (max-width: 480px) {
    .school-title {
        display: block;
    }

    .school-title h3 {
        font-size: 0.7rem;
        /* Mniejszy tekst, żeby się zmieścił */
    }

    header.scrolled .school-title h3 {
        font-size: 0.7rem;
    }

    .logos-wrapper {
        width: auto;
        /* Zmieniono z 100% na auto */
        gap: 8px;
    }

    header.scrolled .emblem img {
        height: 35px;
        width: auto;
    }

    header.scrolled .school-logo img {
        height: 35px;
        width: auto;
    }

    .emblem img,
    .school-logo img {
        height: 45px;
        width: auto;
    }
}

/* --- LAYOUT I KARTY --- */
.main-container {
    padding-top: 180px;
    max-width: 1500px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 60px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 40px;
    align-items: start;
}

/* ZABEZPIECZENIE GRID: Zapobiega rozpychaniu kolumn przez szeroką zawartość */
.main-container>* {
    min-width: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.section-header h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
}

.view-switcher {
    display: flex;
    gap: 10px;
}

.view-switcher button {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-switcher button:hover,
.view-switcher button.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.news-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
    cursor: pointer;
}

.news-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.card-image {
    position: relative;
    overflow: hidden;
}

.card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.news-card:hover .card-image img {
    transform: scale(1.05);
}

.card-date {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.card-overlay-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.card-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-dark);
    line-height: 1.3;
}

.excerpt {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
}

.btn-read-more {
    display: flex;
    align-self: flex-start;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    transition: all 0.3s;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.btn-read-more i {
    font-size: 18px;
    margin-right: -6px;
}

/* ZMIANA: Efekt hover na przycisku aktywuje się po najechaniu na całą kartę */
.news-card:hover .btn-read-more,
.btn-read-more:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.news-container.view-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.news-container.view-list .news-card {
    display: flex;
    flex-direction: row;
    min-height: 240px;
    height: auto;
}

.news-container.view-list .card-image {
    width: 35%;
    flex-shrink: 0;
}

.news-container.view-list .card-content {
    width: 65%;
    justify-content: center;
}

.news-container.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.news-container.view-grid .news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-container.view-grid .card-image {
    height: 200px;
    width: 100%;
}

.sidebar {
    position: sticky;
    top: 140px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.widget {
    background-color: var(--bg-white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.widget h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 5px;
    display: inline-block;
}

.widget-primary {
    background: linear-gradient(135deg, var(--primary-color), #004494);
    color: #fff;
}

.widget-primary h3 {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.widget-primary p {
    margin-bottom: 15px;
    opacity: 0.9;
}

.btn-full {
    display: block;
    width: 100%;
    text-align: center;
    background-color: #fff;
    color: var(--primary-color);
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
    transition: all 0.2s ease-in-out;
}

.btn-full:hover {
    background-color: #e7e7e7;
}

.schedule-list {
    list-style: none;
}

.schedule-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

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

.schedule-list small {
    color: var(--text-light);
    font-size: 0.8rem;
}

.social-links {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.social-btn {
    text-decoration: none;
    padding: 10px;
    border-radius: 6px;
    text-align: center;
    color: #fff;
    font-weight: 500;
    font-size: 0.9rem;
    width: 100%;
}

.facebook {
    background-color: #ffffff;
    border: 2px solid #1877F2;
    color: #1877F2;
    transition: all 0.2s ease-in-out;
}

.facebook:hover {
    background-color: #1877F2;
    color: #fff;
}

.youtube {
    background-color: #ffffff;
    border: 2px solid #FF0000;
    color: #FF0000;
    transition: all 0.2s ease-in-out;
}

.youtube:hover {
    background-color: #FF0000;
    color: #fff;
}

.facebook:hover,
.youtube:hover {
    opacity: 0.9;
}

.links-list {
    list-style: none;
}

.links-list li {
    margin-bottom: 10px;
}

.links-list a {
    text-decoration: none;
    color: var(--text-light);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.links-list a:before {
    content: '›';
    color: var(--primary-color);
    font-weight: bold;
}

.links-list a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

@media (max-width: 1024px) {
    .news-container.view-list .news-card {
        height: auto;
    }

    .news-container.view-list .card-image {
        width: 30%;
    }

    .news-container.view-list .card-content {
        width: 70%;
    }
}

@media (max-width: 850px) {
    .main-container {
        padding-top: 130px;
    }

    .news-container.view-list .news-card {
        flex-direction: column;
        height: auto;
    }

    .news-container.view-list .card-image {
        width: 100%;
        height: 200px;
    }

    .news-container.view-list .card-content {
        width: 100%;
    }

    .view-switcher {
        display: none;
    }
}


.social-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
}

.social-btn i {
    font-size: 16px;
}


/* Admin Przyciski Cofania */

.btn-back-admin i {
    font-size: 20px;
    margin-left: -6px;
}

.btn-back-admin {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 3px;
    border: 1px solid #555;
    background-color: #f5f5f5;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.btn-back-admin:hover {
    color: var(--primary-color);
    background-color: rgb(247, 247, 255);
    border: 1px solid #004494;
}


/* =========================================
   STYLE KATEGORII W KARTACH (NEWS)
   ========================================= */

.card-categories {
    margin-top: auto;
    /* Dopycha kategorie do dołu w widoku siatki (grid), jeśli tekst jest krótki */
    margin-bottom: 20px;
    /* Odstęp od przycisku "Zobacz" */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-badge {
    /* Kolor tła: bardzo jasny niebieski (zmienna primary z dużą jasnością) lub szaro-niebieski */
    background-color: #eff6ff;
    color: var(--primary-color);
    border: 1px solid #dbeafe;
    /* Delikatna ramka */

    padding: 5px 12px;
    border-radius: 50px;
    /* Kształt pigułki */

    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;

    transition: all 0.2s ease-in-out;
    cursor: default;
    /* Lub pointer, jeśli w przyszłości dodasz linkowanie */
    white-space: nowrap;
}

.category-badge:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 86, 179, 0.2);
}

/* Dodatkowe style dla paska filtrów */
.category-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: #fff;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.filter-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.filter-btn.active {
    background-color: #0056b3;
    /* Primary color */
    color: #fff;
    border-color: #0056b3;
}



/* --- POPRAWKI DLA GRIDU (PRZYCISK NA DOLE) --- */

/* 1. Upewniamy się, że karta ma flex w pionie i zajmuje 100% wysokości w gridzie */
.news-container.view-grid .news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    /* Zabezpieczenie kart w siatce */
    /* Rozciągnij kartę na całą wysokość komórki gridu */
}

/* 2. Upewniamy się, że treść karty też jest flexem w pionie */
.news-container.view-grid .card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    /* Wypełnij pozostałą przestrzeń */
    padding: 20px;
}

/* 3. Zajawka niech zajmuje dostępną przestrzeń, ale nie spycha reszty */
.news-container.view-grid .excerpt {
    margin-bottom: 15px;
    /* Opcjonalnie: ograniczenie liczby linii */
    /* display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden; */
}

/* 4. Kategorie - kluczowy element! 
           Ustawiamy margin-top: auto, aby "odepchnąć się" od zajawki i wylądować na dole,
           tuż nad przyciskiem. */
.news-container.view-grid .card-categories {
    margin-top: auto;
    /* To pcha kategorie i przycisk na sam dół */
    margin-bottom: 15px;
    /* Odstęp od przycisku */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 5. Przycisk - jest ostatni w DOM, więc będzie na samym dole pod kategoriami */
.news-container.view-grid .btn-read-more {
    align-self: flex-start;
    /* Do lewej */
    position: relative;
    z-index: 3;
    pointer-events: none; /* ZMIANA: Przycisk nie blokuje kliknięcia, działa overlay pod spodem */
}



/* Domyślnie (widok listy): pokaż wersję długą, ukryj krótką */
.excerpt-grid {
    display: none;
}

.excerpt-list {
    display: block;
}

/* W widoku siatki (grid): odwróć widoczność */
.news-container.view-grid .excerpt-list {
    display: none;
}

.news-container.view-grid .excerpt-grid {
    display: block;
}









/* --- STYLE DLA TREŚCI STRON (GRID LAYOUTS) --- */
.page-header {
    margin-bottom: 40px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.page-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.page-subtitle {
    font-size: 1.2rem;
    color: #666;
}

/* Wstawiane przez edytor siatki */
.content-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 30px 0;
}

.content-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.content-grid-2>*,
.content-grid-3>* {
    min-width: 0;
}

.grid-col {
    background: #fff;
    /* Opcjonalnie border dla podglądu, w produkcji można usunąć */
}

.info-box {
    background-color: #eef7ff;
    border-left: 5px solid var(--primary-color);
    padding: 20px;
    border-radius: 0 8px 8px 0;
    margin: 20px 0;
}

/* Responsywność dla kolumn w treści */
@media (max-width: 768px) {

    .content-grid-2,
    .content-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Sekcja powiązanych postów */
.template-posts-list {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px dashed #eee;
}




/* =========================================
   PAGE BUILDER SYSTEM (Frontend Styles - FINAL FIX)
   ========================================= */

/* 1. KONTENERY I WIERSZE */
.builder-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.pb-row {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    align-items: stretch !important;
    /* To sprawia, że kolumny są równe */
}

/* 2. KOLUMNY */
.pb-col {
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;

    /* ZMIANA: height: auto pozwala Flexboxowi (stretch) działać poprawnie */
    height: auto;
    min-height: 50px;
    width: 100%;

    /* Domyślne: do lewej i do góry */
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
}

/* SZEROKOŚCI KOLUMN */
.pb-col-100 {
    width: 100% !important;
}

.pb-col-50 {
    width: 50% !important;
}

.pb-col-33 {
    width: 33.333% !important;
}

.pb-col-66 {
    width: 66.666% !important;
}

.pb-col-30 {
    width: 30% !important;
}

.pb-col-70 {
    width: 70% !important;
}

/* 3. KLASY WYRÓWNANIA (Kluczowa poprawka) */

/* PION (Oś Y - Flexbox) */
.pb-v-start {
    justify-content: flex-start !important;
}

.pb-v-center {
    justify-content: center !important;
}

.pb-v-end {
    justify-content: flex-end !important;
}

.pb-v-between {
    justify-content: space-between !important;
}

/* POZIOM (Oś X - Text Align + Flexbox) */
.pb-h-start {
    align-items: flex-start !important;
    text-align: left !important;
}

.pb-h-center {
    align-items: center !important;
    text-align: center !important;
}

.pb-h-end {
    align-items: flex-end !important;
    text-align: right !important;
}

/* 4. WIDGETY I ELEMENTY WEWNĘTRZNE */

/* Styl dla głównego kontenera treści z Page Buildera */
.pb-main-wrapper {
    background-color: var(--bg-white, #ffffff);
    border-radius: 12px;
    overflow: hidden;
    /* Aby tła wierszy nie wystawały poza zaokrąglenia */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
    padding: 30px !important;
    /* Odstęp treści od krawędzi białego tła */
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

/* Responsywność dla wrappera */
@media (max-width: 850px) {
    .pb-main-wrapper {
        padding: 20px !important;
        /* Mniejszy padding na urządzeniach mobilnych */
        border-radius: 8px;
    }
}

/* Poprawka dla wierszy wewnątrz białego wrappera */
.builder-content .pb-row {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.pb-widget {
    width: 100% !important;
    position: relative;
    margin-bottom: 15px;
    display: block;
    background-color: transparent !important;
    /* Upewnij się, że widget nie ma własnego tła */
}

.pb-widget:last-child {
    margin-bottom: 0;
}

/* Obrazki */
.pb-image {
    width: 100%;
    display: flex;
    /* Zmieniamy na flex, aby kontrolować wyrównanie */
    flex-direction: column;
}

.pb-image img {
    /* Usunięto: width: 100% - teraz szerokość idzie z inline style z bazy danych */
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    /* Domyślny cień, który teraz będziemy mogli wyłączyć nadpisując stylem inline */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

/* Wyrównanie obrazka w zależności od klasy kolumny */
.pb-h-start .pb-image {
    align-items: flex-start;
}

.pb-h-center .pb-image {
    align-items: center;
}

.pb-h-end .pb-image {
    align-items: flex-end;
}

/* Teksty i Nagłówki - wymuszenie dziedziczenia */
.pb-col.pb-h-center p,
.pb-col.pb-h-center h1,
.pb-col.pb-h-center h2,
.pb-col.pb-h-center h3,
.pb-col.pb-h-center h4,
.pb-col.pb-h-center h5 {
    text-align: center !important;
}

.pb-col.pb-h-end p,
.pb-col.pb-h-end h1,
.pb-col.pb-h-end h2,
.pb-col.pb-h-end h3,
.pb-col.pb-h-end h4,
.pb-col.pb-h-end h5 {
    text-align: right !important;
}

.pb-text {
    background-color: transparent !important;
    /* Usuwa szare tło */
    line-height: 1.7;
    color: #333;
    width: 100%;
    overflow-wrap: break-word;
}

/* Jeśli szare tło pojawia się tylko w akapitach wewnątrz wrappera: */
.pb-main-wrapper .pb-text p {
    background-color: transparent !important;
    margin-bottom: 1em;
}

.pb-text p {
    margin-bottom: 1em;
}

.pb-text ul {
    padding-left: 20px;
    list-style: disc;
    margin-bottom: 1em;
    display: inline-block;
    text-align: left;
}

.pb-header {
    color: var(--primary-color);
    line-height: 1.2;
    margin: 10px 0 20px 0;
    font-weight: 700;
    background-color: transparent !important;
}

.pb-header.h1 {
    font-size: 2.5rem;
}

.pb-header.h2 {
    font-size: 2rem;
}

.pb-header.h3 {
    font-size: 1.75rem;
}

.pb-header.h4 {
    font-size: 1.4rem;
}

.pb-header.h5 {
    font-size: 1.2rem;
}

/* Wideo */
.pb-video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    width: 100%;
    margin: 0 auto;
}

.pb-video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* RESPANSYWNOŚĆ */
@media (max-width: 850px) {
    .pb-row {
        flex-direction: column !important;
    }

    .pb-col {
        width: 100% !important;
        min-height: auto;
    }
}


/* --- NOWE STYLE (Galeria i Przyciski) --- */

/* Przycisk */
.pb-button {
    display: inline-block !important;
    text-decoration: none !important;
    font-weight: 600;
    transition: filter 0.2s;
    text-align: center;
    line-height: 1.2;
}

.pb-button:hover {
    filter: brightness(90%);
    /* Lekkie przyciemnienie po najechaniu */
}

/* Galeria */
.pb-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    /* Responsywna siatka */
    gap: 10px;
    width: 100%;
}

.pb-gallery-item {
    width: 100%;
    aspect-ratio: 1/1;
    /* Kwadratowe kafelki */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.pb-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Wypełnij kafelek */
    transition: transform 0.3s ease, filter 0.3s ease;
}

.pb-gallery-item:hover img {
    transform: scale(1.03);
    filter: brightness(1.05);
}

/* --- POPRAWIONE STYLE TEKSTU I LIST (Wklej to do global.css) --- */

.pb-text {
    line-height: 1.7;
    color: #333;
    width: 100%;
    overflow-wrap: break-word;
    /* Zabezpieczenie przed długimi słowami */
}

.pb-text p {
    margin-bottom: 1em;
}

/* Style dla list (Punktowane i Numerowane) */
.pb-text ul,
.pb-text ol {
    margin-top: 0.5em;
    margin-bottom: 1em;
    padding-left: 1.5em;
    /* Ważne: miejsce na kropki/cyfry */
    list-style-position: outside;
    /* Kropki na zewnątrz tekstu, ale wewnątrz paddingu */
    text-align: left;
    /* Listy zazwyczaj czytamy od lewej */
}

.pb-text ul {
    list-style-type: disc;
}

.pb-text ol {
    list-style-type: decimal;
}

.pb-text li {
    margin-bottom: 5px;
    padding-left: 5px;
    /* Odstęp tekstu od kropki/cyfry */
}

/* --- STYL LINKÓW W TEKŚCIE (Frontend) --- */

.pb-text a {
    color: var(--primary-color, #0056b3);
    /* Kolor główny */
    text-decoration: underline;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.pb-text a:hover {
    color: #003d80;
    /* Ciemniejszy odcień po najechaniu */
    text-decoration: none;
    /* Opcjonalnie: usuwa podkreślenie po najechaniu */
}


/* --- STYLE PRZYCISKÓW (Button Widget) --- */

.pb-button {
    display: inline-block !important;
    text-decoration: none !important;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 6px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-sizing: border-box;
    border: 2px solid transparent;
    /* Rezerwacja miejsca na ramkę */
    line-height: 1.2;
    min-width: fit-content;
}

/* Efekt Hover (Zawsze taki sam, bez customizacji) */
.pb-button:hover {
    filter: brightness(120%);
    /* Lekkie rozjaśnienie */
}

/* Styl: Ramka (Outline) - tło przezroczyste */
.pb-btn-outline {
    background-color: transparent !important;
}

.pb-btn-outline:hover {
    background-color: var(--primary-color) !important;
    color: #fff !important;
}




.pb-attachment-link:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08) !important;
}

.pb-attachment-link:hover .pb-att-title {
    color: var(--primary-color) !important;
}

@media (max-width: 480px) {
    .pb-attachment-link {
        padding: 12px !important;
    }

    .pb-attachment-link i {
        font-size: 1.8rem !important;
    }
}





@media (hover: hover) {
    .news-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    }

    .btn-read-more:hover {
        background-color: var(--primary-color);
        color: #fff;
    }

    .category-badge:hover {
        background-color: var(--primary-color);
        color: #fff;
    }
}










/* --- LAYOUT I KARTY --- */
.main-container {
    /* Zwiększono z 180px na 220px dla dużych ekranów */
    padding-top: 220px;
    max-width: 1500px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 60px;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 1250px) {
    .main-container {
        /* Odstęp dla widoku, gdzie logo się nieco zmniejsza */
        padding-top: 170px;
        grid-template-columns: 1fr;
        /* Zmiana na 1 kolumnę równo z hamburgerem */
        gap: 30px;
    }

    .sidebar {
        position: static;
        order: 2;
        /* Przeniesienie widżetów pod treść */
    }
}

@media (max-width: 850px) {
    .main-container {
        grid-template-columns: 1fr;
        /* Odstęp dla wersji mobilnej */
        padding-top: 140px;
    }
}

/* =========================================
   FOOTER STYLES
   ========================================= */
footer {
    background-color: #1e293b;
    /* Ciemny granat/szary */
    color: #fff;
    padding: 60px 20px 20px;
    margin-top: 80px;
    border-top: 4px solid var(--primary-color);
}

.footer-content {
    max-width: 1500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Zmniejszono z 300px dla lepszej responsywności */
    gap: 50px;
    margin-bottom: 50px;
}

.footer-content>* {
    min-width: 0;
}

.footer-section h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 25px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    padding-bottom: 10px;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
}

.footer-logo-area h3 {
    margin-bottom: 0;
    padding-bottom: 0;
}

.footer-logo-area h3::after {
    display: none;
}

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

.footer-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.footer-contact p {
    color: #cbd5e1;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-contact p a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: color 0.2s;
}

.footer-contact p a:hover {
    color: var(--primary-color);
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-links a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.footer-map-placeholder {
    background: rgba(255, 255, 255, 0.05);
    height: 150px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 600;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    gap: 10px;
}

.footer-map-container iframe {
    width: 100%;
    height: 200px;
    border: 0;
    border-radius: 8px;
    filter: grayscale(30%) contrast(0.9);
    transition: filter 0.3s ease;
}

.footer-map-container iframe:hover {
    filter: grayscale(0%) contrast(1);
}

.footer-bottom {
    max-width: 1500px;
    margin: 0 auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 25px;
    text-align: center;
    color: #64748b;
    font-size: 0.85rem;
}

.author-badge-footer {
    text-decoration: none;
    color: #1877F2;
    background-color: #003d80;
    padding: 3px 8px;
    border-radius: 4px;
}

.author-wrapper {
    margin-top: 15px;
}

/* Style dla opcji "Styl karty" w wierszach */
.pb-row-card {
    background-color: #fff !important;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e0e0e0;
    padding: 30px;
    margin-bottom: 30px;
}
@media (max-width: 850px) { .pb-row-card { padding: 20px !important; } }



/* =========================================
   PAGE FULL HEADER (Nagłówek strony)
   ========================================= */
.page-full-header {
    position: relative;
    width: 100%;
    height: 300px; /* Domyślna wysokość */
    background-color: var(--primary-color); /* Fallback color */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: var(--header-height); /* Odsunięcie od nawigacji */
    overflow: hidden;
}

.page-full-header.no-image {
    height: 200px; /* Mniejszy jeśli sam kolor */
    background: linear-gradient(135deg, var(--primary-color) 0%, #003d80 100%);
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Przyciemnienie zdjęcia */
    z-index: 1;
}

.page-full-header.no-image .header-overlay {
    display: none; /* Brak overlayu na samym kolorze */
}

.header-content-container {
    position: relative;
    z-index: 2;
    text-align: left;
    padding: 0 20px;
    width: 100%;
    max-width: 1500px;
    margin-left: 40px;
}

.page-main-title {
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    line-height: 1.2;
}

@media (max-width: 768px) {
    .page-full-header {
        height: 200px;
        margin-top: var(--header-height); /* Poprawka: Dostosowanie do wysokości nagłówka (120px) */
    }
    .page-full-header.no-image {
        height: 150px;
    }
    .page-main-title {
        font-size: 2rem;
    }
}

/* Korekta main-container gdy jest header */
/* Jeśli header jest obecny, main-container nie potrzebuje dużego padding-top */
.page-full-header + .main-container {
    padding-top: 40px !important;
}

/* --- PWA INSTALL BUTTON --- */
.btn-install-app {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: background-color 0.3s, transform 0.2s;
}

/* =========================================
   CUSTOM SPLASH SCREEN (Z PASKIEM ŁADOWANIA)
   ========================================= */
.custom-splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff; /* Idealnie białe, spójne z manifest.json */
    z-index: 9999999; /* Zawsze na samym wierzchu */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.custom-splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.splash-logo-anim {
    width: 160px;
    height: auto;
}

.splash-loader {
    width: 200px;
    height: 6px;
    background-color: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.splash-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background-color: var(--primary-color, #0056b3);
    border-radius: 10px;
    animation: slideProgress 1.2s infinite ease-in-out;
}

@keyframes slideProgress {
    0% { left: -40%; }
    100% { left: 100%; }
}

.btn-install-app:hover {
    background-color: #004494;
    transform: translateY(-2px);
}

@media (max-width: 1250px) {
    .btn-install-app {
        width: auto;
        margin: 10px auto;
        font-size: 1.1rem;
        padding: 12px 24px;
    }
}

/* --- PWA TOP BANNER (MOBILE) --- */
.pwa-top-banner {
    background-color: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
    padding: 10px 15px;
    width: 100%;
    position: relative;
    z-index: 1001; /* Powyżej headera */
}

.pwa-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1500px;
    margin: 0 auto;
}

.pwa-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-close {
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    margin-right: 5px;
}

.pwa-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.pwa-text {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    line-height: 1.2;
}

.pwa-text strong {
    color: #0f172a;
}

.pwa-text span {
    color: #64748b;
    font-size: 0.75rem;
}

.pwa-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* --- iOS INSTRUCTION MODAL --- */
.ios-instruction-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Na dole ekranu jak w iOS */
    padding-bottom: 20px;
    backdrop-filter: blur(3px);
}

.ios-instruction-card {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

.ios-instruction-card h3 { margin-top: 0; color: #333; }
.ios-instruction-card ol { text-align: left; padding-left: 20px; margin: 15px 0; color: #555; }
.ios-instruction-card li { margin-bottom: 10px; }
.ios-instruction-card button {
    background: var(--primary-color); color: white; border: none;
    padding: 12px 30px; border-radius: 10px; font-weight: 600; font-size: 1rem; cursor: pointer; width: 100%;
}

/* --- JEDNOSTKI SZKOLNE (Unit Widget) --- */
.unit-person-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}
@media (max-width: 768px) {
    .unit-person-name {
        font-size: 1.4rem; /* Mniejsza czcionka na telefonach */
    }
}


/* =========================================
   PWA (STANDALONE) STYLES (MOBILE ONLY)
   ========================================= */
.pwa-bottom-bar,
.pwa-notifications-panel {
    display: none !important;
}

/* =========================================
   Wymuszenie wyglądu "scrolled" w PWA
   ========================================= */
@media (display-mode: standalone) {
    :root {
        --header-height: 80px !important;
    }
    header {
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1), 0 1px 0 0 var(--border-color) !important;
    }
    .header-content {
        height: var(--header-height) !important;
    }
    .emblem img,
    .school-logo img {
        height: 50px !important;
    }
    .school-title h3 {
        font-size: 0.95rem !important;
    }
    .main-container {
        padding-top: 180px !important;
    }

    /* Ukrycie sekcji z mapą w stopce dla PWA */
    .footer-section:has(.footer-map-container),
    .footer-section:has(.footer-map-placeholder) {
        display: none !important;
    }

    /* PWA: Pokaż link w stopce zamiast pływającego przycisku */
    .pwa-privacy-link {
        display: block !important;
    }
}

@media (display-mode: standalone) and (max-width: 1250px) {
    .school-title h3 {
        font-size: 0.85rem !important;
    }
    .main-container {
        padding-top: 130px !important;
    }
    /* Dolny pasek nawigacyjny */
    .pwa-bottom-bar {
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 80px;
        padding-bottom: 20px;
        background-color: var(--bg-white);
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.05);
        z-index: 2005;
        border-top: 1px solid var(--border-color);
    }

    .pwa-bottom-action {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--text-light);
        text-decoration: none;
        flex: 1;
        height: 100%;
        font-size: 0.7rem;
        font-weight: 500;
        gap: 4px;
        transition: color 0.2s;
    }

    .pwa-bottom-action i {
        font-size: 1.5rem;
    }

    .pwa-bottom-action.active,
    .pwa-bottom-action:active {
        color: var(--primary-color);
    }

    /* Ukrycie hamburgera na górze i wyśrodkowanie logo */
    .hamburger { display: none !important; }
    .header-content { justify-content: center !important; padding-left: 0 !important; padding-right: 0 !important; }
    .logos-wrapper { margin: 0 auto !important; }

    /* Zabezpieczenie miejsca na dolny pasek (żeby nie ucięło treści na samym dole) */
    .main-container { padding-bottom: 100px !important; }
    footer { padding-bottom: 100px !important; }

    /* Przesunięcie menu mobilnego (by nie wychodziło na dolny pasek) */
    .menu { height: calc(100vh - var(--header-height) - 80px) !important; }

    /* Ukrycie widżetów na dole strony i zamiana ich na "osobny widok" wywoływany z przycisku */
    .sidebar {
        display: none !important;
        position: fixed !important;
        top: var(--header-height) !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - var(--header-height) - 80px) !important;
        background-color: #f9f9f9 !important;
        z-index: 1999 !important;
        overflow-y: auto !important;
        padding: 20px !important;
        margin: 0 !important;
        order: unset !important;
    }

    .sidebar.pwa-active {
        display: flex !important;
        flex-direction: column;
        gap: 20px;
    }

    .sidebar.pwa-active > * {
        flex-shrink: 0;
    }

    /* Przesunięcie menu dostępności i ukrycie głównego pływającego przycisku w PWA */
    .a11y-toolbar-toggle {
        display: none !important;
    }
    .a11y-toolbar {
        bottom: 90px !important;
        left: 10px !important;
    }

    /* Panel Powiadomień PWA */
    .pwa-notifications-panel {
        display: none !important;
        position: fixed !important;
        top: var(--header-height) !important;
        left: 0 !important;
        width: 100% !important;
        height: calc(100vh - var(--header-height) - 80px) !important;
        background-color: #f9f9f9 !important;
        z-index: 1999 !important;
        overflow-y: auto !important;
        padding: 20px !important;
        margin: 0 !important;
    }
    .pwa-notifications-panel.pwa-active {
        display: block !important;
    }
    .pwa-notifications-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 2px solid var(--border-color);
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    .pwa-clear-btn {
        background: none;
        border: none;
        color: var(--text-light);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        padding: 5px 10px;
        border-radius: 4px;
        transition: background 0.2s;
    }
    .pwa-clear-btn:active {
        background: #e2e8f0;
    }
    .pwa-notifications-list {
        display: flex;
        flex-direction: column;
    }

    .pwa-notifications-list > * {
        flex-shrink: 0;
    }

    .pwa-notification-wrapper {
        position: relative;
        overflow: hidden;
        border-radius: 8px;
        margin-bottom: 10px;
        touch-action: pan-y;
    }
    .pwa-notification-background {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        background-color: #ef4444;
        color: white;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-right: 20px;
        font-size: 1.5rem;
        z-index: 1;
        border-radius: 8px;
    }
    .pwa-notification-item {
        background: #eff6ff;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        border-left: 4px solid var(--primary-color);
        text-decoration: none;
        color: var(--text-dark);
        display: block;
        margin-bottom: 0 !important;
        position: relative;
        z-index: 2;
        transition: transform 0.2s ease-out, background-color 0.3s ease;
        will-change: transform;
    }
    .pwa-notification-item.dragging {
        transition: none;
    }
    .pwa-notification-item.read {
        border-left-color: var(--border-color);
        background: #fff;
    }
    .pwa-notification-title {
        font-weight: 600;
        margin-bottom: 5px;
        font-size: 0.95rem;
    }
    .pwa-notification-item:not(.read) .pwa-notification-title::before {
        content: '';
        display: inline-block;
        width: 8px;
        height: 8px;
        background-color: var(--primary-color);
        border-radius: 50%;
        margin-right: 8px;
        vertical-align: middle;
        transform: translateY(-2px);
    }
    .pwa-notification-item.read .pwa-notification-title {
        font-weight: 400;
    }
    .pwa-notification-date {
        font-size: 0.8rem;
        color: var(--text-light);
    }
 
    /* PWA: Przełącznik powiadomień */
    #footer-push-container {
        display: none; /* Domyślnie ukryty, JS go pokaże w PWA */
        justify-content: space-between;
        align-items: center;
        background: #fff;
        padding: 15px 20px;
        border-radius: 12px;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
    }
 
    .pwa-push-label {
        font-weight: 600;
        color: var(--text-dark);
        font-size: 1rem;
    }
 
    .pwa-switch {
      position: relative;
      display: inline-block;
      width: 50px;
      height: 28px;
    }
 
    .pwa-switch input { 
      opacity: 0;
      width: 0;
      height: 0;
    }
 
    .pwa-slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #ccc;
      transition: .4s;
      border-radius: 28px;
    }
 
    .pwa-slider:before {
      position: absolute;
      content: "";
      height: 20px;
      width: 20px;
      left: 4px;
      bottom: 4px;
      background-color: white;
      transition: .4s;
      border-radius: 50%;
      box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }
 
    input:checked + .pwa-slider {
      background-color: #10b981; /* Zielony */
    }
 
    input:checked + .pwa-slider:before {
      transform: translateX(22px);
    }
 
    /* Ukrycie starego elementu w stopce */
    #footer-push-li {
        display: none !important;
    }
}

@media (display-mode: standalone) and (max-width: 850px) {
    .main-container {
        padding-top: 100px !important;
    }
}

@media (display-mode: standalone) and (max-width: 480px) {
    .emblem img,
    .school-logo img {
        height: 35px !important;
    }
    .school-title h3 {
        font-size: 0.7rem !important;
    }
}

/* =========================================
   PRIVACY CONSENT BANNER & MODAL
   ========================================= */
.privacy-notice-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    padding: 20px;
    z-index: 999999;
    pointer-events: none; /* Przepuszcza kliknięcia w tle na desktopie */
}

.privacy-notice-box {
    background-color: #fff;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 25px;
    max-width: 480px;
    width: 100%;
    pointer-events: auto; /* Reaktywuje kliknięcia na samym boksie */
    animation: slideUpFade 0.4s ease-out forwards;
    box-sizing: border-box;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media(max-width: 768px) {
    .privacy-notice-overlay {
        justify-content: center;
        align-items: center;
        background-color: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(3px);
        pointer-events: auto; /* Blokuje tło na telefonach */
    }
    .privacy-notice-box {
        max-width: 95%;
        animation: popIn 0.3s ease-out forwards;
        padding: 20px;
    }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.privacy-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.privacy-text-box h4 {
    margin: 0 0 15px 0;
    color: var(--text-dark);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-text-box h4 i {
    color: var(--primary-color);
    font-size: 1.4rem;
}

.privacy-text-box p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.5;
}

.privacy-text-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}
.privacy-text-box a:hover { text-decoration: underline; }

.privacy-actions-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
}

#btnPrivacyAccept {
    grid-column: 1 / -1;
}

.btn-priv-outline, .btn-priv-filled {
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
}

.btn-priv-outline {
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-dark);
}

.btn-priv-outline:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-priv-filled {
    border: none;
    background: var(--primary-color);
    color: #fff;
}

.btn-priv-filled:hover {
    filter: brightness(1.1);
}

/* Customize Modal */
.privacy-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

.privacy-modal-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.privacy-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.privacy-modal-header h3 { margin: 0; font-size: 1.2rem; color: var(--text-dark); }
.privacy-modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-light); cursor: pointer; }
.privacy-modal-close:hover { color: #ef4444; }

.privacy-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.privacy-option-row { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: #f8fafc; border: 1px solid var(--border-color); border-radius: 12px; gap: 15px; }
.privacy-option-info strong { display: block; color: var(--text-dark); margin-bottom: 5px; font-size: 1rem; }
.privacy-option-info p { margin: 0; font-size: 0.85rem; color: var(--text-light); line-height: 1.4; }
.privacy-always-active { color: #10b981; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }

.privacy-modal-footer { padding: 20px; border-top: 1px solid var(--border-color); background: #f8fafc; }

.privacy-settings-link {
    color: #cbd5e1;
    text-decoration: underline;
    margin-right: 15px;
    cursor: pointer;
}

.privacy-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin: 0;
    flex-shrink: 0;
}

.privacy-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.privacy-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 28px;
}

.privacy-slider:before {
    position: absolute; content: "";
    height: 20px; width: 20px;
    left: 4px; bottom: 4px;
    background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.privacy-switch input:checked + .privacy-slider { background-color: #10b981; }
.privacy-switch input:checked + .privacy-slider:before { transform: translateX(22px); }

/* =========================================
   FLOATING PRIVACY BUTTON
   ========================================= */
.floating-privacy-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #fff;
    color: #64748b; /* Lekko wyszarzony */
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 9998; /* Pod ewentualnymi oknami modalnymi, ale nad resztą */
    cursor: pointer;
    opacity: 0.6; /* Częściowa przezroczystość - efekt "wyszarzenia" */
    transition: all 0.3s ease;
}

.floating-privacy-btn:hover {
    opacity: 1; /* Pełna widoczność przy najechaniu myszką */
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

/* PWA oraz telefony: Ukrycie pływającego przycisku (zastąpiony linkiem w stopce) */
@media (display-mode: standalone), (max-width: 850px) {
    .floating-privacy-btn {
        display: none !important;
    }

    /* Pokaż ukryty link cookies na dole stopki */
    .pwa-privacy-link {
        display: block !important;
    }
}