* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
header {
    text-align: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2em;
    font-weight: 300;
}

/* --- SEKCJA WYSZUKIWARKI - POPRAWKI --- */
.search-container {
    margin-bottom: 30px;
    /* Usunięto 'text-align: center', ponieważ będziemy centrować sam formularz */
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    /* NOWE REGUŁY DO WYŚRODKOWANIA */
    max-width: 700px; /* Ustawiamy maksymalną szerokość formularza */
    margin: 0 auto;  /* Automatyczne marginesy lewy/prawy centrują formularz */
}

.search-box {
    /* Usunięto 'width' i 'max-width', bo szerokością zarządza teraz .search-form */
    flex-grow: 1; /* Pole tekstowe rozciąga się, aby wypełnić wolne miejsce */
    padding: 15px 20px;
    font-size: 1.1em;
    border: none;
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    outline: none;
    transition: all 0.3s ease;
}
.search-box:focus {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}
/* Przycisk 'Szukaj' i 'Wyczyść' - pobieramy style, które mieliśmy wcześniej */
.search-form button {
    width: auto;
    padding: 15px 25px; /* Dopasowujemy padding do wysokości pola */
    border-radius: 25px;
    flex-shrink: 0;
    border: none;
    background: #74b9ff;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
}
.search-form button:hover {
    background: #0984e3;
}
.search-form .clear-search {
    background-color: #7f8c8d;
    color: white;
    padding: 15px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 1em;
    flex-shrink: 0;
}
.search-form .clear-search:hover {
    background-color: #95a5a6;
}

/* --- POZOSTAŁE SEKCJE --- */
.education-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}
.level-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.level-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
}
.level-title {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3498db;
}
.class-section {
    margin-bottom: 30px;
}
.class-title {
    font-size: 1.3em;
    color: #34495e;
    margin-bottom: 15px;
    padding: 10px;
    background: linear-gradient(90deg, #74b9ff, #0984e3);
    color: white;
    border-radius: 8px;
    text-align: center;
}
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.material-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.3s ease;
    position: relative;
}
.material-item:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}
.material-link {
    text-decoration: none;
    color: #2c3e50;
    font-weight: 500;
    display: block;
    padding: 5px 0;
}
.material-link:hover {
    color: #2196f3;
}
.material-type {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff6b6b;
    color: white;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
}
.pdf-type { background: #ff6b6b; }
.zip-type { background: #ffa726; }
.rar-type { background: #ab47bc; }
.link-type { background: #26c6da; }

.stats {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    color: white;
    margin-top: 30px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}
.stat-item {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #74b9ff;
}
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
}
.pagination {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0 10px 0;
    gap: 8px;
}
.pagination a {
    color: #3498db;
    padding: 8px 14px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}
.pagination a:hover {
    background-color: #f0f0f0;
}
.pagination a.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
    font-weight: bold;
}
.no-materials {
    grid-column: 1 / -1;
    text-align: center;
    color: #888;
    padding: 20px;
}
.search-results-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
}
.search-results-section h2 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}
.search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.material-item-search {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 10px;
    border-bottom: 1px solid #f0f0f0;
}
.search-results-list li:last-child .material-item-search {
    border-bottom: none;
}
.material-item-search .material-info {
    display: flex;
    flex-direction: column;
}
.material-item-search .material-class-tag {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}