:root {
    --primary-green: #008542;
    --dark-green: #005f2e;
    --light-accent: #e8f5e9;
    --text-dark: #2c3e50;
    --grey-bg: #f4f7f6;
    --shadow-card: 0 10px 20px rgba(0,0,0,0.08);
    --shadow-hover: 0 15px 30px rgba(0, 133, 66, 0.2);
    --radius: 16px;
    --danger-red: #c0392b; /* Kolor przycisku zamykania */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; 
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--grey-bg);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
}

/* --- LOGIKA WIDOKÓW --- */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.98);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    background: white;
    z-index: 1;
}

.view.active-view {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 10; /* Aktywny widok zawsze na wierzchu */
}

/* --- NAGŁÓWKI I GRID (Bez zmian) --- */
.main-header { text-align: center; margin-bottom: 2vh; flex-shrink: 0; }
.logo { max-height: 12vh; width: auto; margin-bottom: 1rem; }
.header-text h1 { font-size: 2.5rem; color: var(--primary-green); margin-bottom: 0.5rem; }
.header-text p { font-size: 1.2rem; color: #666; }
.header-text .subtitle { margin-top: 1rem; font-weight: bold; color: var(--dark-green); text-transform: uppercase; letter-spacing: 1px; font-size: 0.9rem; }

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.category-card {
    background: white;
    border: 2px solid transparent;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.category-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 6px; background: var(--primary-green); }
.category-card:active { transform: scale(0.96); }
.category-card:hover { border-color: var(--primary-green); box-shadow: var(--shadow-hover); transform: translateY(-5px); }
.category-icon { font-size: 3rem; color: var(--primary-green); margin-bottom: 1rem; }
.category-name { font-size: 1.5rem; font-weight: 600; color: var(--text-dark); }

/* --- LISTA PDF --- */
.details-header { display: flex; align-items: center; margin-bottom: 1.5rem; border-bottom: 2px solid var(--light-accent); padding-bottom: 1rem; flex-shrink: 0; }
.nav-btn {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 133, 66, 0.3);
}
.nav-btn:active { transform: scale(0.95); }

/* Specjalny przycisk zamykania PDF */
.nav-btn.red-btn {
    background: var(--danger-red);
    box-shadow: 0 4px 10px rgba(192, 57, 43, 0.3);
}

.details-header h2 { margin-left: 2rem; font-size: 2rem; color: var(--dark-green); }

.pdf-list-container { flex-grow: 1; overflow-y: auto; padding-right: 1rem; }
.pdf-item {
    background: var(--light-accent);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pdf-info h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.pdf-info p { color: #555; font-size: 1rem; }

/* Przycisk OTWÓRZ teraz jest buttonem, nie linkiem */
.open-btn {
    background: white;
    border: 2px solid var(--primary-green);
    color: var(--primary-green);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}
.open-btn:active { background: var(--primary-green); color: white; }

/* --- SEKCJA PDF VIEWER --- */
.iframe-container {
    flex-grow: 1;
    width: 100%;
    background: #525659; /* Ciemne tło pod PDF (standard przeglądarek) */
    border-radius: 8px;
    overflow: hidden;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Responsywność */
@media (aspect-ratio < 1/1) {
    .grid-container { grid-template-columns: repeat(2, 1fr); }
    .header-text h1 { font-size: 2rem; }
}
@media (max-width: 600px) {
    .grid-container { grid-template-columns: 1fr; }
    .header-text h1 { font-size: 1.5rem; }
}