/**
 * Główny arkusz stylów Front-end dla wtyczki Dziedzictwo Ks. Bernardyna Dziedziaka.
 * Zastosowano metodologię BEM (Block Element Modifier) w nazewnictwie klas.
 */

/* ==========================================================================
   1. ZMIENNE CSS (Konfiguracja wyglądu)
   ========================================================================== */
:root {
    /* Kolory - Elegancka, archiwalna paleta */
    --dd-primary-color: #1e293b;
    /* Głęboki, elegancki granat */
    --dd-primary-hover: #0f172a;
    /* Ciemniejszy granat na hover */
    --dd-accent-color: #2563eb;
    /* Nowoczesny niebieski dla akcentów i przycisków */
    --dd-accent-hover: #1d4ed8;
    --dd-text-main: #334155;
    /* Główny kolor tekstu (nie czarny, łagodniejszy dla oczu) */
    --dd-text-muted: #64748b;
    /* Wyciszony tekst (np. metadane) */
    --dd-bg-main: #f8fafc;
    /* Tło aplikacji / archiwum */
    --dd-bg-card: #ffffff;
    /* Tło kart dokumentów */
    --dd-border-color: #e2e8f0;
    /* Subtelne ramki */

    /* Strefa Badacza */
    --dd-danger-color: #b91c1c;
    --dd-danger-bg: #fef2f2;
    --dd-danger-border: #fca5a5;

    /* Typografia */
    --dd-font-family: 'Poppins', sans-serif;

    /* Interfejs */
    --dd-border-radius: 12px;
    /* Zaokrąglenia kart */
    --dd-border-radius-sm: 8px;
    /* Zaokrąglenia przycisków i inputów */
    --dd-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --dd-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --dd-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --dd-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- STREFA BADACZA (Całkowite czyszczenie stylów motywu) --- */

.dd-researcher-zone-clean { 
    background: #fff1f2 !important; /* Jasnoróżowe tło */
    border: 1px solid #fecdd3 !important; 
    border-radius: 8px; 
    margin-bottom: 40px; 
    overflow: hidden; 
}

/* Usuwamy zielony/niebieski kolor przy klikaniu i najechaniu */
.dd-rz-toggle,
.dd-rz-toggle:hover,
.dd-rz-toggle:focus,
.dd-rz-toggle:active {
    width: 100% !important;
    background: transparent !important; /* Kluczowe: tło zawsze przezroczyste, by widzieć tło kontenera */
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 15px 20px !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: #be123c !important; /* Czerwony tekst */
    transition: 0.2s;
    text-decoration: none !important;
}

/* Subtelny efekt najechania - tylko lekkie przyciemnienie całego paska */
.dd-rz-toggle:hover {
    background: rgba(190, 18, 60, 0.05) !important; /* Bardzo delikatny czerwony nalot */
}

/* Styl zawartości po rozwinięciu */
.dd-rz-content-clean {
    display: none;
    padding: 0 20px 20px 50px;
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.6;
    border-top: 1px solid #fecdd3;
    padding-top: 15px;
    background: #fff1f2 !important;
}

/* ==========================================================================
   2. RESET I USTAWIENIA GLOBALNE WTYCZKI
   ========================================================================== */
.dd-archive-container,
.dd-single-container {
    font-family: var(--dd-font-family);
    color: var(--dd-text-main);
    line-height: 1.6;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    box-sizing: border-box;
}

.dd-archive-container *,
.dd-single-container * {
    box-sizing: border-box;
}

/* Wyrównanie Ikon Google z tekstem */
.material-symbols-outlined {
    vertical-align: middle;
    font-size: 1.2em;
    position: relative;
    top: -1px;
}

/* ==========================================================================
   3. UKŁAD STRONY GŁÓWNEJ (ARCHIWUM)
   ========================================================================== */
.dd-archive-header {
    text-align: center;
    margin-bottom: 50px;
}

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

.dd-page-description {
    font-size: 1.1rem;
    color: var(--dd-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.dd-archive-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    align-items: flex-start;
}

.dd-sidebar-filters {
    width: 100%;
    max-width: 320px;
    /* Sticky sidebar na desktopie */
    position: sticky;
    top: 40px;
}

.dd-main-content {
    flex: 1;
    min-width: 0;
    /* Zapobiega wychodzeniu flex-itemów poza ekran */
}

/* ==========================================================================
   4. PANEL FILTRÓW (SIDEBAR)
   ========================================================================== */
.dd-filters-wrapper {
    background: var(--dd-bg-card);
    padding: 25px;
    border-radius: var(--dd-border-radius);
    box-shadow: var(--dd-shadow-md);
    border: 1px solid var(--dd-border-color);
}

.dd-filters-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--dd-border-color);
}

.dd-filters-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dd-primary-color);
}

.dd-filter-group {
    margin-bottom: 20px;
}

.dd-filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--dd-primary-color);
}

.dd-filter-group label .material-symbols-outlined {
    font-size: 1.1em;
    color: var(--dd-text-muted);
}

/* Stylowanie formularzy */
.dd-filter-group input[type="text"],
.dd-filter-group input[type="number"],
.dd-filter-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--dd-border-color);
    border-radius: var(--dd-border-radius-sm);
    background-color: #fff;
    font-family: var(--dd-font-family);
    font-size: 0.95rem;
    color: var(--dd-text-main);
    transition: var(--dd-transition);
}

.dd-filter-group input:focus,
.dd-filter-group select:focus {
    outline: none;
    border-color: var(--dd-accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dd-filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

/* ==========================================================================
   5. PRZYCISKI (Komponenty globalne)
   ========================================================================== */
.dd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-family: var(--dd-font-family);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--dd-border-radius-sm);
    cursor: pointer;
    transition: var(--dd-transition);
    border: none;
    width: 100%;
    /* Domyślnie pełna szerokość w sidebarze */
}

.dd-btn-primary {
    background-color: var(--dd-accent-color);
    color: #ffffff !important;
    box-shadow: var(--dd-shadow-sm);
}

.dd-btn-primary:hover {
    background-color: var(--dd-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--dd-shadow-md);
}

.dd-btn-outline {
    background-color: transparent;
    color: var(--dd-text-main) !important;
    border: 1px solid var(--dd-border-color);
}

.dd-btn-outline:hover {
    background-color: var(--dd-bg-main);
    border-color: var(--dd-text-muted);
}

/* ==========================================================================
   6. SIATKA DOKUMENTÓW (GRID) & KARTY
   ========================================================================== */
.dd-grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    /* ZMIANA: stretch wymusza na wszystkich kartach równą wysokość */
    align-items: stretch;
}

/* Karta Dokumentu */
.dd-document-card {
    background: var(--dd-bg-card);
    border-radius: var(--dd-border-radius);
    box-shadow: var(--dd-shadow-sm);
    border: 1px solid var(--dd-border-color);
    overflow: hidden;
    /* Przycina rogi zdjęcia */
    transition: var(--dd-transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.dd-document-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--dd-shadow-hover);
    border-color: transparent;
}

.dd-card-link {
    text-decoration: none !important;
    color: inherit !important;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Sekcja graficzna karty */
.dd-card-media {
    position: relative;
    width: 100%;
    padding-top: 60%;
    /* Proporcje 16:9 dla okładek */
    background-color: var(--dd-bg-main);
    border-bottom: 1px solid var(--dd-border-color);
    overflow: hidden;
}

.dd-card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s ease;
}

.dd-document-card:hover .dd-card-image {
    transform: scale(1.05);
    /* Delikatny zoom zdjęcia przy najechaniu */
}

/* Fallback: Ikona zamiast zdjęcia */
.dd-card-icon-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.dd-card-icon {
    font-size: 4rem !important;
    color: var(--dd-text-muted);
    opacity: 0.5;
    transition: var(--dd-transition);
}

.dd-document-card:hover .dd-card-icon {
    transform: scale(1.1);
    color: var(--dd-accent-color);
    opacity: 0.8;
}

/* Etykieta z rokiem */
.dd-card-badge-year {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(30, 41, 59, 0.85);
    /* Ciemne półprzezroczyste tło */
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* Sekcja tekstowa karty */
.dd-card-content {
    padding: 20px;
    flex-grow: 1; /* To rozciąga środek, aby karty były równe */
    display: flex;
    flex-direction: column;
}

.dd-card-type {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    color: var(--dd-accent-color);
    margin-bottom: 8px;
    display: block;
}

.dd-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: var(--dd-primary-color);
    line-height: 1.4;
    /* Ucinanie długiego tekstu do 3 linijek */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dd-card-author {
    margin-top: auto;
    /* Wypycha autora na sam dół karty */
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--dd-text-muted);
    padding-top: 15px;
    border-top: 1px solid var(--dd-border-color);
}

/* ==========================================================================
   7. WIDOK POJEDYNCZEGO DOKUMENTU (SINGLE)
   ========================================================================== */
.dd-single-article {
    background: var(--dd-bg-card);
    padding: 50px;
    border-radius: var(--dd-border-radius);
    box-shadow: var(--dd-shadow-md);
    margin-bottom: 50px;
}

.dd-single-header {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--dd-border-color);
    padding-bottom: 30px;
}

.dd-single-breadcrumbs {
    font-size: 0.9rem;
    color: var(--dd-text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dd-single-breadcrumbs a {
    color: var(--dd-accent-color);
    text-decoration: none;
}

.dd-single-title {
    font-size: 2.5rem;
    color: var(--dd-primary-color);
    margin: 0 0 20px 0;
    line-height: 1.3;
}

.dd-single-primary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 1rem;
    color: var(--dd-text-muted);
}

.dd-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--dd-bg-main);
    padding: 6px 12px;
    border-radius: 20px;
}

.dd-single-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.dd-single-actions .dd-btn {
    width: auto;
    /* Nadpisanie pełnej szerokości */
}

.dd-single-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--dd-text-main);
    margin-bottom: 50px;
}

/* Stylizowanie transkrypcji z Gutenberga */
.dd-single-content h2,
.dd-single-content h3 {
    color: var(--dd-primary-color);
    margin-top: 30px;
}

.dd-single-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--dd-border-radius-sm);
    box-shadow: var(--dd-shadow-sm);
    margin: 20px 0;
}

.dd-single-extended-meta {
    background: var(--dd-bg-main);
    padding: 30px;
    border-radius: var(--dd-border-radius);
    margin-bottom: 30px;
}

.dd-single-extended-meta h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.dd-meta-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.dd-meta-list li {
    font-size: 0.95rem;
}

.dd-single-tags {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--dd-border-color);
    font-size: 0.95rem;
}

/* Strefa Badacza */
.dd-researcher-zone {
    background: var(--dd-danger-bg);
    border: 1px solid var(--dd-danger-border);
    border-radius: var(--dd-border-radius);
    padding: 30px;
    margin-top: 40px;
}

.dd-rz-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dd-danger-color);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--dd-danger-border);
    padding-bottom: 15px;
}

.dd-rz-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.dd-rz-content {
    color: #7f1d1d;
    /* Ciemna czerwień dla tekstu */
    font-size: 0.95rem;
}

/* ==========================================================================
   8. ANIMACJE I WYSZUKIWANIE (AJAX)
   ========================================================================== */
#dd-ajax-loader {
    text-align: center;
    padding: 40px;
    color: var(--dd-text-muted);
}

.dd-spin {
    animation: dd-spin 1s linear infinite;
    font-size: 3rem !important;
    color: var(--dd-accent-color);
    margin-bottom: 15px;
}

@keyframes dd-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.dd-no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--dd-bg-main);
    border-radius: var(--dd-border-radius);
    color: var(--dd-text-muted);
    grid-column: 1 / -1;
    /* Zajmuje całą szerokość grida */
}

.dd-no-results .material-symbols-outlined {
    font-size: 4rem !important;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Animacja Fade-in dla nowych kart doładowywanych przez AJAX */
.dd-fade-in {
    animation: ddFadeIn 0.5s ease forwards;
    opacity: 0;
}

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

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

/* ==========================================================================
   9. RESPONSIVE DESIGN (Media Queries)
   ========================================================================== */
@media (max-width: 992px) {
    .dd-archive-layout {
        flex-direction: column;
    }

    .dd-sidebar-filters {
        max-width: 100%;
        position: static;
        /* Wyłącza sticky na tabletach i telefonach */
    }

    .dd-single-article {
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {
    .dd-page-title {
        font-size: 2rem;
    }

    .dd-grid-layout {
        grid-template-columns: 1fr;
        /* Jedna kolumna na małych ekranach */
    }

    .dd-single-actions {
        flex-direction: column;
    }

    .dd-single-actions .dd-btn {
        width: 100%;
    }
}

/* ==========================================================================
   11. NAGŁÓWEK (HERO SECTION) Z KARUZELĄ ZDJĘĆ TŁA
   ========================================================================== */
.dd-hero-section {
    position: relative;
    border-radius: var(--dd-border-radius);
    padding: 30px 40px 80px 40px;
    margin-bottom: 40px;
    color: #fff;
    overflow: hidden;
    box-shadow: var(--dd-shadow-md);
    text-align: center;
    min-height: 420px;
    display: flex;
    flex-direction: column;
}

/* --- Karuzela tła (Płynne przenikanie) --- */
.dd-hero-bg-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background-color: #0f172a;
}

.dd-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center top;
    /* Lepsze kadrowanie zdjęć z ludźmi */
    opacity: 0;
    animation: bgCrossfade 15s infinite;
    /* Łączny czas 3 zdjęć = 15s */
}

/* Opóźnienia dla kolejnych zdjęć (co 5 sekund) */
.dd-slide:nth-child(1) {
    animation-delay: 0s;
}

.dd-slide:nth-child(2) {
    animation-delay: 5s;
}

.dd-slide:nth-child(3) {
    animation-delay: 10s;
}

/* Animacja przenikania z bardzo delikatnym zoomem (Ken Burns effect) */
@keyframes bgCrossfade {
    0% {
        opacity: 0;
        transform: scale(1);
    }

    10% {
        opacity: 1;
    }

    33.33% {
        opacity: 1;
    }

    43.33% {
        opacity: 0;
        transform: scale(1.05);
    }

    100% {
        opacity: 0;
    }
}

/* Ciemna nakładka, żeby biały tekst był czytelny na jasnych zdjęciach */
.dd-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.6) 100%);
    z-index: 2;
}

/* --- Zawartość nagłówka --- */
.dd-hero-top-bar {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    margin-bottom: auto;
    /* Wypycha tytuł niżej */
    padding-bottom: 40px;
}

.dd-user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Naprawione przyciski (Szerokość auto, styl Glassmorphism) */
.dd-hero-top-bar .dd-btn {
    width: auto !important;
    /* Wymusza koniec rozciągania */
    white-space: nowrap;
    padding: 10px 22px;
}

.dd-btn-glass {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dd-btn-glass:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: #fff !important;
    transform: translateY(-2px);
}

.dd-btn-glass-primary {
    background: #ffffff !important;
    color: var(--dd-primary-color) !important;
    border: none !important;
    font-weight: 600;
}

.dd-btn-glass-primary:hover {
    background: #f8fafc !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* --- Teksty na bannerze --- */
.dd-hero-content {
    position: relative;
    z-index: 10;
    margin-top: 20px;
}

.dd-hero-content .dd-page-title {
    color: #ffffff;
    font-size: 3.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
    letter-spacing: -0.5px;
}

.dd-hero-content .dd-page-description {
    color: #e2e8f0;
    font-size: 1.25rem;
    max-width: 800px;
    margin: 0 auto;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    line-height: 1.6;
}

/* Responsywność dla urządzeń mobilnych */
@media (max-width: 768px) {
    .dd-hero-top-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .dd-hero-top-bar .dd-btn {
        width: 100% !important;
        justify-content: center;
    }

    .dd-hero-content .dd-page-title {
        font-size: 2.2rem;
    }
}

/* ==========================================================================
   12. KARUZELA KOLEKCJI I AUTORÓW (Estetyczna i responsywna)
   ========================================================================== */
.dd-carousel-section {
    margin-bottom: 50px;
}

.dd-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    color: var(--dd-primary-color);
    margin-bottom: 20px;
}

.dd-carousel-wrapper {
    overflow-x: auto;
    padding-bottom: 20px;
    /* Płynne przyciąganie na ekranach dotykowych (jak w apkach mobilnych) */
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: var(--dd-border-color) transparent;
}

.dd-carousel-wrapper::-webkit-scrollbar { height: 6px; }
.dd-carousel-wrapper::-webkit-scrollbar-thumb { background: var(--dd-border-color); border-radius: 10px; }

.dd-carousel-track {
    display: flex;
    gap: 20px;
    width: max-content;
    padding: 5px; /* Dodane, aby animacja powiększenia (hover) nie ucinała krawędzi */
}

.dd-carousel-card {
    background: #ffffff;
    border: 1px solid var(--dd-border-color);
    border-radius: var(--dd-border-radius);
    padding: 30px 20px 20px 20px;
    /* NAJWAŻNIEJSZE: Sztywna szerokość - brak brzydkiego rozciągania */
    width: 200px; 
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none !important;
    color: var(--dd-primary-color) !important;
    transition: var(--dd-transition);
    position: relative;
    scroll-snap-align: start;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.dd-carousel-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--dd-shadow-md);
    border-color: var(--dd-accent-color);
}

/* Plakietka typu (Autor/Kolekcja) */
.dd-carousel-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.dd-carousel-icon {
    font-size: 3.5rem !important;
    color: var(--dd-accent-color);
    margin-bottom: 12px;
    margin-top: 5px;
}

/* Pudełko blokujące wysokość (dokładnie na 3 linijki) i centrujące tekst w pionie */
.dd-carousel-title-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 15px;
    min-height: 4.2em; /* 3 linijki x 1.4 line-height */
}

.dd-carousel-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    margin: 0; /* Marginesy usunięte, pudełko się nimi zajmuje */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dd-carousel-count {
    font-size: 0.8rem;
    color: var(--dd-primary-color);
    font-weight: 500;
    margin-top: 0; /* Zmienione na 0, nie potrzebujemy już spychania */
    background: #f8fafc;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--dd-border-color);
}

/* Responsywność dla karuzeli na małych ekranach */
@media (max-width: 768px) {
    .dd-carousel-card {
        width: 170px; /* Nieco węższe kafelki, aby mieściło się ich więcej */
        padding: 25px 15px 15px 15px;
    }
    .dd-carousel-title {
        font-size: 0.9rem;
    }
    .dd-carousel-icon {
        font-size: 3rem !important;
    }
}

/* ==========================================================================
   13. AKORDEON W FILTRACH (Zwijane sekcje)
   ========================================================================== */
.dd-filter-accordion {
    border-bottom: 1px solid var(--dd-border-color);
    margin-bottom: 10px;
}

.dd-filter-accordion:last-child {
    border-bottom: none;
}

.dd-accordion-toggle {
    width: 100%;
    background: transparent;
    border: none;
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--dd-primary-color);
    font-family: var(--dd-font-family);
    transition: var(--dd-transition);
}

.dd-accordion-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.95rem;
}

.dd-accordion-title .material-symbols-outlined {
    font-size: 1.1em;
    color: var(--dd-text-muted);
}

.dd-accordion-toggle .dd-chevron {
    transition: transform 0.3s ease;
}

.dd-accordion-toggle.active .dd-chevron {
    transform: rotate(180deg);
}

.dd-accordion-content {
    display: none;
    /* Domyślnie ukryte, otwierane w JS */
    padding-bottom: 15px;
}

.dd-filters-divider {
    height: 1px;
    background: var(--dd-border-color);
    margin: 20px 0 10px 0;
}

/* ==========================================================================
   14. MODAL (POP-UP) BIBLIOGRAFII
   ========================================================================== */
.dd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--dd-transition);
}

.dd-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.dd-modal-content {
    background: var(--dd-bg-main);
    width: 90%;
    max-width: 1200px;
    max-height: 92vh;
    border-radius: var(--dd-border-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dd-modal-overlay.active .dd-modal-content {
    transform: translateY(0) scale(1);
}

.dd-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--dd-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-radius: var(--dd-border-radius) var(--dd-border-radius) 0 0;
}

.dd-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--dd-primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.dd-modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--dd-text-muted);
    cursor: pointer;
    transition: var(--dd-transition);
}

.dd-modal-close:hover {
    color: var(--dd-danger-color);
    transform: rotate(90deg);
}

.dd-modal-body {
    padding: 30px;
    overflow-y: auto;
}

/* --- STYLIZACJA PRZYCISKU ZAMKNIJ MODAL --- */

/* 1. Usunięcie starego, brzydkiego stylu i pozycjonowanie */
/* Przyjmuję klasę `.dd-modal-close` dla przycisku zamykania */
.dd-modal-close {
    background: none !important; /* Całkowicie usuwamy turkusowe tło */
    border: none !important; /* Usuwamy ramki */
    padding: 0 !important; /* Usuwamy dopełnienia */
    width: 40px !important; /* Ustawiamy stały, subtelny obszar kliknięcia */
    height: 40px !important;
    position: absolute; /* Pozycjonujemy absolutnie wewnątrz modala */
    top: 20px; /* Odstęp od góry */
    right: 20px; /* Odstęp od prawej */
    cursor: pointer;
    z-index: 1000; /* Upewniamy się, że jest nad treścią modala */
    display: flex; /* Centrujemy X wewnątrz obszaru kliknięcia */
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Obszar kliknięcia w kształcie koła */
    transition: var(--dd-transition); /* Używamy zdefiniowanej wcześniej tranzicji */
}

/* 2. Stylizacja samego krzyżyka (X) */
/* Zalecam użycie ikony zMaterial Symbols Outlined dla spójności */
.dd-modal-close .material-symbols-outlined {
    font-size: 1.5rem !important; /* Odpowiednia wielkość */
    color: var(--dd-text-muted); /* Używamy neutralnego, wyciszonego koloru */
    font-weight: 300 !important; /* Cienkie linie, subtelny wygląd */
    line-height: 1; /* Wyśrodkowanie w pionie */
}

/* 3. Efekt najechania (Hover) */
.dd-modal-close:hover {
    background-color: rgba(241, 245, 249, 0.8) !important; /* Subtelne, kołowe tło przy najechaniu */
    color: var(--dd-danger-color); /* Krzyżyk zmienia kolor na czerwony, sugerując akcję */
    transform: rotate(90deg); /* Satysfakcjonująca, delikatna animacja obrotu */
}

/* ==========================================================================
   15. RESPONSIVE DESIGN (Media Queries - Naprawione przyciski mobilne)
   ========================================================================== */
@media (max-width: 992px) {
    .dd-archive-layout {
        flex-direction: column;
    }

    .dd-sidebar-filters {
        max-width: 100%;
        position: static;
    }

    .dd-single-article {
        padding: 30px 20px;
    }
}

@media (max-width: 768px) {

    /* Mniejsze marginesy nagłówka, aby zmieścił się na małym ekranie */
    .dd-hero-section {
        padding: 20px 20px 40px 20px;
        min-height: auto;
    }

    /* ZAMIANA KOLUMNY NA GRID 2-kolumnowy dla przycisków */
    .dd-hero-top-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        /* Dwa przyciski obok siebie */
        gap: 8px;
        /* Małe, estetyczne odstępy */
        margin-bottom: 25px;
        padding-bottom: 20px;
    }

    /* Zmniejszenie samych przycisków */
    .dd-hero-top-bar .dd-btn {
        width: 100% !important;
        justify-content: center;
        padding: 8px 10px;
        /* Cieńsze przyciski */
        font-size: 0.85rem;
        /* Mniejsza czcionka na telefonie */
    }

    /* Przycisk logowania wskakuje obok Bibliografii do siatki 2x2 */
    .dd-user-menu {
        grid-column: 1 / -1;
        /* Zostawiamy pełną szerokość tylko dla menu po zalogowaniu, bo są tam dwa przyciski */
    }

    /* Układ dla zalogowanych (Przycisk profilu + wyloguj) */
    .dd-user-menu {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
    }

    /* Dopasowanie tekstów nagłówka */
    .dd-hero-content .dd-page-title {
        font-size: 2rem;
    }

    .dd-hero-content .dd-page-description {
        font-size: 1rem;
    }

    .dd-grid-layout {
        grid-template-columns: 1fr;
    }

    .dd-single-actions {
        flex-direction: column;
    }

    .dd-single-actions .dd-btn {
        width: 100%;
    }
}

/* ==========================================================================
   16. STYLOWANIE TABELI BIBLIOGRAFICZNEJ
   ========================================================================== */
.dd-bibliography-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--dd-border-color);
}

/* Naprawa szerokości przycisków wewnątrz modala */
.dd-bibliography-actions .dd-btn {
    width: auto !important;
}

/* Tytuły grup (kolekcji) */
.dd-bib-collection-title {
    font-size: 1.3rem;
    color: var(--dd-primary-color);
    margin: 40px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--dd-accent-color);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dd-bibliography-container h3:first-of-type {
    margin-top: 0;
}

/* Kontener tabeli (żeby w razie czego można było przesuwać na telefonie) */
.dd-table-responsive {
    overflow-x: auto;
    background: #fff;
    border-radius: var(--dd-border-radius-sm);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--dd-border-color);
}

/* Sama tabela */
.dd-bib-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.dd-bib-table th {
    background-color: #f8fafc;
    color: var(--dd-text-muted);
    font-weight: 600;
    padding: 15px 20px;
    border-bottom: 2px solid var(--dd-border-color);
    white-space: nowrap;
}

.dd-bib-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--dd-border-color);
    color: var(--dd-text-main);
    vertical-align: middle;
}

.dd-bib-table tr:last-child td {
    border-bottom: none;
}

/* Efekt najechania myszką na wiersz w tabeli */
.dd-bib-table tbody tr:hover {
    background-color: #f1f5f9;
}

.dd-bib-col-year {
    font-weight: 600;
    color: var(--dd-primary-color);
}

.dd-bib-col-sign {
    font-family: monospace;
    color: var(--dd-text-muted);
}

/* Przycisk [Zobacz] w tabeli */
.dd-bib-link {
    display: inline-block;
    background: var(--dd-bg-main);
    color: var(--dd-accent-color);
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--dd-border-color);
    transition: var(--dd-transition);
}

.dd-bib-link:hover {
    background: var(--dd-accent-color);
    color: #fff;
    border-color: var(--dd-accent-color);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ==========================================================================
   17. ZWIJANY PANEL BOCZNY (Sidebar) I NAPRAWA PÓŁ FORMULARZA
   ========================================================================== */

/* NAPRAWA BŁĘDU: Blokada wychodzenia list select i pól input poza ramkę */
.dd-filters-form input,
.dd-filters-form select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box !important; 
    padding: 10px;
    border-radius: var(--dd-border-radius-sm);
    border: 1px solid var(--dd-border-color);
    font-family: var(--dd-font-family);
    background: #fff;
}

/* Podstawowe ustawienia panelu (Szerokość, Animacja) */
.dd-sidebar-filters {
    width: 290px;
    flex-shrink: 0;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--dd-bg-card);
    border-radius: var(--dd-border-radius);
    box-shadow: var(--dd-shadow-md);
    border: 1px solid var(--dd-border-color);
}

/* STAN ZWINIĘTY */
.dd-sidebar-filters.dd-collapsed {
    width: 75px; /* Szerokość samego paska z ikonami */
}

/* Układ nagłówka */
.dd-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--dd-border-color);
}

.dd-header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

/* Przycisk strzałki zwiń/rozwiń */
.dd-sidebar-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--dd-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: var(--dd-transition);
}

.dd-sidebar-toggle:hover {
    background: #f1f5f9;
    color: var(--dd-primary-color);
}

.dd-collapsed .dd-toggle-icon {
    transform: rotate(180deg); /* Strzałka odwraca się, by wskazywać rozwijanie */
}

/* Ukrywanie tekstów po zwinięciu */
.dd-filter-text,
.dd-input-wrapper,
.dd-accordion-content,
.dd-chevron,
.dd-filters-title-text {
    transition: opacity 0.2s ease;
    opacity: 1;
    white-space: nowrap;
}

.dd-collapsed .dd-filter-text,
.dd-collapsed .dd-input-wrapper,
.dd-collapsed .dd-accordion-content,
.dd-collapsed .dd-chevron,
.dd-collapsed .dd-filters-title-text {
    opacity: 0;
    visibility: hidden;
    position: absolute; /* Usuwa zajmowane miejsce, by nie rozpychać panelu */
    pointer-events: none;
}

/* Centrowanie samych ikon, gdy tekst jest schowany */
.dd-filter-group label,
.dd-accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.dd-collapsed .dd-filter-group label,
.dd-collapsed .dd-accordion-toggle {
    justify-content: center;
    padding: 10px 0;
}

.dd-collapsed .material-symbols-outlined {
    margin: 0;
    font-size: 1.6rem;
}

/* Transformacja przycisków w kółka z ikonami */
.dd-collapsed .dd-filter-actions {
    align-items: center;
}
.dd-collapsed .dd-filter-actions .dd-btn {
    width: 45px;
    height: 45px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}

/* ==========================================================================
   18. BLOKADA STYLÓW MOTYWU (Naprawa zielonego tła przy kliknięciu)
   ========================================================================== */
.dd-accordion-toggle,
.dd-accordion-toggle:hover,
.dd-accordion-toggle:focus,
.dd-accordion-toggle:active,
.dd-accordion-toggle.active {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--dd-primary-color) !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
}

/* Subtelny efekt najechania zamiast brzydkiego tła */
.dd-accordion-toggle:hover {
    opacity: 0.7;
}

/* ==========================================================================
   17 & 19. GLOBALNE WYSUWANE MENU FILTRÓW (Off-Canvas dla PC i Mobile)
   ========================================================================== */

/* 1. Usunięcie starego podziału i rozciągnięcie głównej zawartości na 100% */
.dd-archive-layout {
    display: block !important;
}
.dd-main-content {
    width: 100% !important;
}

/* 2. Pływający przycisk (Sticky Button) - ZAWSZE WIDOCZNY */
.dd-mobile-filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: var(--dd-accent-color);
    color: #ffffff;
    border: none;
    padding: 16px 14px 16px 18px;
    border-radius: 30px 0 0 30px;
    box-shadow: -4px 4px 15px rgba(0,0,0,0.3);
    z-index: 9990;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}
.dd-mobile-filter-btn:hover {
    background: var(--dd-primary-color);
    transform: translateY(-50%) scale(1.05); /* Lekkie powiększenie po najechaniu myszką */
}
.dd-mobile-filter-btn .material-symbols-outlined { 
    font-size: 2.2rem; 
}

/* 3. Panel filtrów staje się "szufladą" */
.dd-sidebar-filters {
    position: fixed !important;
    top: 0;
    right: -110%; /* Domyslnie schowany poza krawędzią ekranu */
    width: 100vw !important; 
    max-width: 380px !important; /* Na komputerze menu jest przyjemnie szerokie */
    height: 100vh;
    margin: 0 !important;
    border-radius: 0;
    z-index: 10000;
    background: var(--dd-bg-main);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: block !important;
    box-shadow: none;
    overflow-y: auto;
}

/* Klasa aktywująca wsunięcie na ekran */
.dd-sidebar-filters.dd-mobile-open {
    right: 0;
    box-shadow: -10px 0 40px rgba(0,0,0,0.6);
}

/* 4. Ciemne, rozmyte tło (Overlay) */
.dd-mobile-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9995;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    cursor: pointer;
}
.dd-mobile-overlay.dd-active {
    opacity: 1;
    visibility: visible;
}

/* 5. Ikona zamykania (X) zamiast strzałki */
.dd-sidebar-toggle .dd-toggle-icon {
    font-size: 0 !important; 
}
.dd-sidebar-toggle .dd-toggle-icon::after {
    content: "close"; 
    font-size: 2.2rem;
    color: var(--dd-primary-color);
    transition: transform 0.3s;
}
.dd-sidebar-toggle:hover .dd-toggle-icon::after {
    transform: rotate(90deg); /* Animacja obrotu X przy najechaniu */
}

/* 6. Zawsze wymuszone pokazywanie tekstów w menu (usuwamy stare zasady zwijania ikon) */
.dd-sidebar-filters .dd-filter-text,
.dd-sidebar-filters .dd-input-wrapper,
.dd-sidebar-filters .dd-accordion-content,
.dd-sidebar-filters .dd-chevron,
.dd-sidebar-filters .dd-filters-title-text {
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
    pointer-events: auto !important;
}
.dd-sidebar-filters .dd-filter-group label,
.dd-sidebar-filters .dd-accordion-toggle {
    justify-content: flex-start !important;
}
.dd-sidebar-filters .dd-filter-actions {
    flex-direction: row !important;
    gap: 10px;
}
.dd-sidebar-filters .dd-filter-actions .dd-btn {
    width: 100% !important; height: auto !important; padding: 12px !important; border-radius: 8px !important;
}
.dd-sidebar-filters .dd-filter-actions .dd-btn .material-symbols-outlined {
    font-size: 1.4rem !important; margin-right: 5px; margin-left: 0 !important;
}

/* 7. Wymuszenie 1 kolumny TYLKO dla telefonów */
@media (max-width: 768px) {
    #dd-documents-grid,
    .dd-grid-layout {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    .dd-sidebar-filters {
        max-width: 340px !important; /* Na małych ekranach trochę węższe */
    }
}

/* --- SKONDENSOWANY NAGŁÓWEK --- */
.dd-tax-hero-compact {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 0 25px 0;
    margin-bottom: 30px;
}

/* Górna belka: Powrót i Meta w jednej linii */
.dd-tax-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dd-back-button-slim {
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none !important;
    color: #64748b !important;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    background: #f8fafc;
    border-radius: 6px;
    transition: 0.2s;
}

.dd-back-button-slim:hover {
    background: #e2e8f0;
    color: var(--dd-primary-color) !important;
}

.dd-tax-meta-inline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dd-tax-badge-pill {
    background: #1e293b; /* Ciemny antracyt */
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dd-tax-count-text {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* --- MARQUEE STYL MASZYNOWY --- */
.dd-marquee-container-small {
    width: 100%;
    overflow: hidden;
    background: #fdfdfd;
    border-top: 1px dashed #e2e8f0;
    border-bottom: 1px dashed #e2e8f0;
    padding: 10px 0;
}

.dd-marquee-track {
    display: flex;
    width: max-content;
    animation: dd-scroll-text 30s linear infinite;
}

.dd-tax-title-marquee {
    font-family: 'Source Code Pro', monospace !important;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--dd-primary-color);
    white-space: nowrap;
    margin: 0;
    text-transform: uppercase;
}

.dd-tax-title-marquee span {
    color: var(--dd-accent-color);
    padding: 0 40px;
}

/* --- AKORDEON MINIMALISTYCZNY (ZWINIĘTY) --- */
.dd-tax-accordion-minimal {
    margin-top: 15px;
}

.dd-tax-accordion-toggle {
    width: 100%;
    background: none !important;
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 10px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #94a3b8 !important;
    font-size: 0.85rem;
    font-weight: 600;
}

.dd-tax-accordion-toggle:hover {
    color: var(--dd-primary-color) !important;
}

/* TO POWODUJE, ŻE JEST ZWINIĘTY NA START */
.dd-tax-accordion-content {
    display: none; 
    text-align: left;
}

.dd-tax-accordion-inner {
    padding: 20px 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
}

@keyframes dd-scroll-text {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@media (max-width: 768px) {
    .dd-tax-title-marquee { font-size: 1.3rem; }
    .dd-tax-top-bar { flex-direction: row; } /* Zostawiamy w rzędzie nawet na mobile */
}


 /* ==========================================================================
   21. WYGLĄD POJEDYNCZEGO DOKUMENTU (Fizyczna Kartka + Flipbook)
   ========================================================================== */

/* --- Nowoczesny Nagłówek --- */
.dd-single-header-modern { text-align: center; margin-bottom: 40px; }
.dd-single-breadcrumbs { font-size: 0.9rem; color: #64748b; margin-bottom: 20px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.dd-single-breadcrumbs a { color: var(--dd-primary-color); text-decoration: none; font-weight: 600; display: flex; align-items: center; }
.dd-single-title-modern { font-size: 2.5rem; color: var(--dd-primary-color); margin-bottom: 20px; font-weight: 800; line-height: 1.3; }

.dd-single-primary-meta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.dd-meta-pill { background: #f1f5f9; color: #475569; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 6px; border: 1px solid #e2e8f0; }

.dd-single-actions-top { display: flex; justify-content: center; gap: 15px; margin-bottom: 40px; }
.dd-btn-pdf, .dd-btn-scan { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 8px; font-weight: 600; text-decoration: none !important; transition: 0.3s; }
.dd-btn-pdf { background: var(--dd-accent-color); color: #fff !important; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.dd-btn-pdf:hover { background: var(--dd-primary-color); transform: translateY(-3px); }
.dd-btn-scan { background: #fff; color: var(--dd-primary-color) !important; border: 2px solid var(--dd-primary-color); }
.dd-btn-scan:hover { background: #f8fafc; transform: translateY(-3px); }

/* --- Metryka Dokumentu --- */
.dd-single-extended-meta { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 30px; margin-bottom: 40px; }
.dd-single-extended-meta h3 { margin-top: 0; margin-bottom: 25px; font-size: 1.4rem; color: var(--dd-primary-color); border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }
.dd-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.dd-meta-box { background: #f8fafc; padding: 15px; border-radius: 8px; border: 1px solid #e2e8f0; }
.dd-meta-box strong { display: block; font-size: 0.8rem; color: #64748b; text-transform: uppercase; margin-bottom: 5px; }
.dd-meta-box span { font-size: 1rem; color: #1e293b; font-weight: 500; }
.dd-meta-full { grid-column: 1 / -1; }

/* --- REALISTYCZNA KARTKA PAPIERU (Flipbook) --- */
.dd-paper-container {
    background: #e2e8f0; /* Kolor "biurka" */
    padding: 50px 20px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; align-items: center;
    position: relative;
    perspective: 1500px; /* Głębia 3D dla obrotu kartki */
}

.dd-flipbook { width: 100%; max-width: 850px; position: relative; }

.dd-page {
    display: none; width: 100%;
    transform-origin: left center; /* Oś obrotu = lewy grzbiet */
    animation: dd-page-turn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.dd-page.active { display: block; }

.dd-paper-document {
    background: #fffdf8; /* Lekko pożółkły papier archiwalny */
    min-height: 900px;
    padding: 80px 70px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.05), 10px 10px 30px rgba(0,0,0,0.08), inset 2px 0 5px rgba(0,0,0,0.02);
    border: 1px solid #cbd5e1;
    border-left: 3px solid #94a3b8; /* Zszycie grzbietu */
    font-family: 'Georgia', 'Times New Roman', serif; /* Klasyczna czcionka dokumentów */
    font-size: 1.15rem;
    line-height: 1.8;
    color: #1e293b;
    position: relative;
}

.dd-paper-document p { margin-bottom: 25px; text-align: justify; }
.dd-page-number { position: absolute; bottom: 30px; left: 0; width: 100%; text-align: center; font-family: var(--dd-font-family); font-size: 0.9rem; color: #94a3b8; }

/* --- Animacja przewracania --- */
@keyframes dd-page-turn {
    0% { transform: rotateY(90deg); opacity: 0; }
    100% { transform: rotateY(0deg); opacity: 1; }
}

/* --- Panel sterowania --- */
.dd-flipbook-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 40px; }
.dd-flipbook-btn { background: #ffffff; border: 1px solid #cbd5e1; padding: 10px 20px; border-radius: 30px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--dd-primary-color); transition: 0.3s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.dd-flipbook-btn:hover:not(:disabled) { background: var(--dd-primary-color); color: #ffffff; border-color: var(--dd-primary-color); }
.dd-flipbook-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.dd-flipbook-indicator { font-weight: 600; color: #475569; font-size: 0.95rem; }

/* RWD */
@media (max-width: 768px) {
    .dd-single-title-modern { font-size: 1.8rem; }
    .dd-paper-container { padding: 30px 10px; }
    .dd-paper-document { padding: 40px 25px; min-height: 500px; font-size: 1.05rem; }
    .dd-single-actions-top { flex-direction: column; }
}

/* ==========================================================================
   22. STYLIZACJA ZDJĘĆ I MEDIÓW NA KARTCE PAPIERU
   ========================================================================== */

/* Zabezpieczenie przed wychodzeniem zdjęć poza margines kartki */
.dd-paper-document img {
    max-width: 100%;
    height: auto;
    border-radius: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* Delikatny cień dodający "wypukłości" */
    margin: 20px 0;
}

/* Stylizacja podpisów pod zdjęciami (Captions z WordPressa) */
.dd-paper-document figure {
    margin: 20px 0;
    padding: 0;
    text-align: center;
}

.dd-paper-document figcaption {
    font-family: var(--dd-font-family, sans-serif);
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
    margin-top: 8px;
}

/* Standardowe wyrównania WordPressa (Do lewej, prawej, do środka) */
.dd-paper-document .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.dd-paper-document .alignleft {
    float: left;
    margin-right: 25px;
    margin-bottom: 15px;
}

.dd-paper-document .alignright {
    float: right;
    margin-left: 25px;
    margin-bottom: 15px;
}

/* Czyszczenie opływania po zdjęciach */
.dd-paper-document::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   21. UNIFIED SINGLE DOCUMENT VIEW (fokus na tekście, RWD)
   ========================================================================== */

/* --- Kontener Główny (Usuwamy szare tło "biurka" na PC) --- */
.dd-single-container {
    max-width: 900px; /* Maksymalna szerokość czytania na PC */
    margin: 0 auto;
    padding: 20px 0;
}

/* --- NAGŁÓWEK (Czysty, zintegrowany) --- */
.dd-single-header-clean {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.dd-single-breadcrumbs-clean {
    font-size: 0.85rem; color: #94a3b8; margin-bottom: 15px; display: flex; align-items: center; gap: 6px;
}
.dd-single-breadcrumbs-clean a { color: var(--dd-primary-color); text-decoration: none; font-weight: 600; display: flex; align-items: center; gap: 4px; transition: 0.2s; }
.dd-single-breadcrumbs-clean a:hover { color: var(--dd-accent-color); }
.dd-sep { color: #cbd5e1; }

.dd-single-title-clean {
    font-family: 'Lora', serif !important; /* Dodanie nowej czcionki szeryfowej */
    font-style: italic; /* Wymuszenie kursywy */
    font-size: 2.8rem;
    color: var(--dd-primary-color);
    margin: 0 0 20px 0;
    font-weight: 700; /* Zmniejszono z 800, bo Lora przy 700 wygląda bardziej elegancko */
    line-height: 1.2;
}

/* Rząd pod tytułem: Meta i Akcje obok siebie na PC */
.dd-single-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.dd-single-primary-meta-clean { display: flex; gap: 8px; flex-wrap: wrap; }
.dd-meta-pill-clean { background: #f1f5f9; color: #475569; padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 5px; border: 1px solid #e2e8f0; }
.dd-meta-pill-clean .material-symbols-outlined { font-size: 1rem; color: #94a3b8; }

/* --- KOMPAKTOWE PRZYCISKI AKCJI (Slim) --- */
.dd-single-actions-compact { display: flex; gap: 10px; }

.dd-btn-pdf-slim, .dd-btn-scan-slim {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 700; text-decoration: none !important; transition: 0.2s;
}

/* PDF - Pełny kolor, ale mniejszy */
.dd-btn-pdf-slim { background: var(--dd-accent-color); color: #fff !important; }
.dd-btn-pdf-slim:hover { background: var(--dd-primary-color); transform: translateY(-2px); }

/* Skan - Outline, mniejszy */
.dd-btn-scan-slim { background: #fff; color: var(--dd-primary-color) !important; border: 1px solid var(--dd-primary-color); }
.dd-btn-scan-slim:hover { background: #f8fafc; border-color: var(--dd-accent-color); color: var(--dd-accent-color) !important; transform: translateY(-2px); }


/* --- GŁÓWNA TREŚĆ (Styl Archiwalny, fokus) --- */
.dd-paper-main-container {
    position: relative;
    perspective: 1500px;
    margin-bottom: 40px;
}

.dd-flipbook { width: 100%; position: relative; }

/* Pojedyncza kartka (Tylko delikatny cień na PC) */
.dd-paper-document-content {
    background: #fffdfc; /* Kolor papieru */
    padding: 60px 50px; /* Marginesy czytania na PC */
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    
    /* Typografia Archiwalna */
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.15rem;
    line-height: 1.8;
    color: #1e293b;
    position: relative;
}

.dd-paper-document-content p { margin-bottom: 25px; text-align: justify; }

/* Numeracja stron */
.dd-page-number { position: absolute; bottom: 20px; left: 0; width: 100%; text-align: center; font-family: sans-serif; font-size: 0.8rem; color: #cbd5e1; }

/* Sterowanie Flipbookiem (Dyskretne) */
.dd-flipbook-controls-clean { display: flex; align-items: center; justify-content: center; gap: 15px; margin-top: 25px; }
.dd-flipbook-btn-circle { background: #fff; border: 1px solid #e2e8f0; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--dd-primary-color); transition: 0.2s; }
.dd-flipbook-btn-circle:hover:not(:disabled) { background: var(--dd-accent-color); color: #fff; border-color: var(--dd-accent-color); }
.dd-flipbook-btn-circle:disabled { opacity: 0.4; cursor: not-allowed; }
.dd-flipbook-indicator-text { font-weight: 700; color: #64748b; font-size: 0.9rem; font-family: monospace; }


/* --- METRYKA DOKUMENTU (Ujednolicona Tabela) --- */
.dd-single-extended-meta-clean { margin-bottom: 40px; }
.dd-single-extended-meta-clean h3 { margin: 0 0 20px 0; font-size: 1.3rem; color: var(--dd-primary-color); font-weight: 700; }

.dd-meta-grid-clean { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: #e2e8f0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.dd-meta-box-clean { background: #fff; padding: 15px 20px; }
.dd-meta-box-clean strong { display: block; font-size: 0.75rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.dd-meta-box-clean span { font-size: 0.95rem; color: #1e293b; font-weight: 600; }

/* Wymuszenie pełnej szerokości */
.dd-meta-full { grid-column: 1 / -1 !important; }

/* Tagi */
.dd-single-tags-clean { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: #94a3b8; font-size: 0.9rem; }
.dd-single-tags-clean a { text-decoration: none; color: var(--dd-accent-color); font-weight: 600; background: #f1f5f9; padding: 4px 10px; border-radius: 4px; }


/* --- STREFA BADACZA (Zwinięta) --- */
.dd-researcher-zone-clean { background: #fff1f2; border: 1px solid #fecdd3; border-radius: 8px; margin-bottom: 40px; overflow: hidden; }
.dd-rz-toggle { width: 100%; background: none; border: none; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: #be123c; transition: 0.2s; }
.dd-rz-toggle:hover { background: #ffe4e6; }
.dd-rz-title-wrap { display: flex; align-items: center; gap: 10px; }
.dd-rz-title-wrap h4 { margin: 0; font-size: 1rem; font-weight: 700; color: #be123c; }
.dd-rz-title-wrap .material-symbols-outlined { color: #f43f5e; }
.dd-rz-content-clean { display: none; padding: 0 20px 20px 50px; color: #334155; font-size: 0.9rem; line-height: 1.6; border-top: 1px solid #fecdd3; padding-top: 15px; }


/* ==========================================================================
   WIDOK MOBILNY (Dostosowanie Padingów i Przycisków)
   ========================================================================== */
@media (max-width: 768px) {
    /* Skracamy nagłówek na mobilce */
    .dd-single-title-clean { font-size: 1.8rem; margin-bottom: 15px; }
    
    /* Meta i Akcje pod sobą, wyśrodkowane */
    .dd-single-meta-row { flex-direction: column; gap: 15px; text-align: center; }
    .dd-single-primary-meta-clean { justify-content: center; }

    /* --- KOMPAKTOWE PRZYCISKI MOBILNE (Dwa w rzędzie, slim) --- */
    .dd-single-actions-compact { width: 100%; justify-content: center; gap: 8px; }
    .dd-btn-pdf-slim, .dd-btn-scan-slim { width: 48%; padding: 8px 10px; font-size: 0.8rem; justify-content: center; }

    /* Kartka Papieru zajmuje całą szerokość ekranu, mniejsze padingi */
    .dd-single-article-unified { padding: 0 10px; }
    .dd-paper-document-content { padding: 30px 20px; border-radius: 4px; font-size: 1.05rem; }
    
    /* Tabela Metryki w jednej kolumnie */
    .dd-meta-grid-clean { grid-template-columns: 1fr; }
}

/* ==========================================================================
   23. PRZYBORNIK BADAWCZY I ZAKREŚLACZE
   ========================================================================== */

/* Pływający Dymek (Tooltip) */
.dd-hl-popup {
    position: absolute;
    z-index: 9999;
    background: #1e293b; /* Ciemny, elegancki kolor */
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2), 0 4px 6px rgba(0,0,0,0.1);
    display: flex;
    gap: 12px;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
}

/* Stan aktywny (wyskakuje nad tekstem) */
.dd-hl-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Mały dzióbek pod dymkiem */
.dd-hl-popup::after {
    content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    border-width: 6px 6px 0; border-style: solid; border-color: #1e293b transparent transparent transparent;
}

/* Przyciski Kolorów (Flamastry) */
.dd-hl-color {
    width: 24px; height: 24px; border-radius: 50%; border: 2px solid #334155;
    cursor: pointer; transition: 0.2s; padding: 0;
}
.dd-hl-color:hover { transform: scale(1.2); border-color: #fff; }

.dd-hl-yellow { background-color: #facc15; }
.dd-hl-green { background-color: #4ade80; }
.dd-hl-pink { background-color: #f472b6; }

/* Separator i Gumka */
.dd-hl-divider { width: 1px; height: 24px; background: #334155; }

.dd-hl-remove {
    background: none; border: none; color: #94a3b8; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0; transition: 0.2s;
}
.dd-hl-remove:hover { color: #f43f5e; transform: scale(1.1); }
.dd-hl-remove .material-symbols-outlined { font-size: 1.3rem; }

/* --------------------------------------
   Wygląd Zakreślonego Tekstu
-------------------------------------- */
.dd-highlight-marker {
    border-radius: 4px;
    padding: 2px 0;
    transition: background-color 0.3s ease;
}

/* Półprzezroczyste, realistyczne kolory zakreślaczy */
.dd-bg-yellow { background-color: rgba(250, 204, 21, 0.35); }
.dd-bg-green { background-color: rgba(74, 222, 128, 0.35); }
.dd-bg-pink { background-color: rgba(244, 114, 182, 0.35); }

/* ==========================================================================
   WYŁĄCZENIE MASONRY.JS I WYMUSZENIE IDEALNIE RÓWNYCH KART
   ========================================================================== */

/* 1. Resetujemy główny kontener siatki */
#dd-documents-grid,
.dd-grid-layout {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 30px !important;
    align-items: stretch !important; /* To wymusza równą wysokość w rzędzie */
    height: auto !important; /* Nadpisuje wysokość narzucaną przez skrypt Masonry */
}

/* 2. Resetujemy poszczególne karty */
.dd-document-card {
    position: relative !important; /* Zabija position: absolute z Masonry */
    top: auto !important; /* Usuwa pozycjonowanie z JS */
    left: auto !important; /* Usuwa pozycjonowanie z JS */
    width: 100% !important;
    height: 100% !important; /* Rozciąga kartę na maxa w dół */
    margin: 0 !important;
}

/* 3. Wymuszenie responsywności (1 kolumna na telefonach) */
@media (max-width: 768px) {
    #dd-documents-grid,
    .dd-grid-layout {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   24. SEKCJA DOKUMENTÓW POWIĄZANYCH (Related Documents)
   ========================================================================== */

/* Odstęp całej sekcji od metryki dokumentu powyżej */
.dd-related-documents {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e2e8f0; /* Subtelna linia oddzielająca sekcje */
}

/* Kluczowa zmiana: Margines pod tytułem "Inne dokumenty z tego cyklu" */
.dd-related-documents h3 {
    margin: 0 0 35px 0 !important; /* 35px odstępu na dole */
}