/* ========================================
MATERIAŁY DO POBRANIA
======================================== */

.download-center {
    max-width: 1400px;
    margin: 60px auto;
    padding: 0 20px;
}

.download-center h1 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 42px;
    line-height: 1.2;
    font-weight: 700;
    color: #1f2937;
}

.download-center h2 {
    margin: 50px 0 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e5e5;
    font-size: 30px;
    line-height: 1.25;
    font-weight: 700;
    color: #1f2937;
}

.materials-empty {
    text-align: center;
    color: #666;
    font-size: 18px;
    margin: 40px 0;
}


/* ========================================
FILTRY
======================================== */

.materials-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 50px;
}

.filter-btn {
    padding: 12px 24px;
    border: 1px solid #dcdcdc;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    border-radius: 8px;
    transition: all .25s ease;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.filter-btn:hover {
    background: #f5f5f5;
    border-color: #cfcfcf;
}

.filter-btn.active {
    background: #0066cc;
    color: #ffffff;
    border-color: #0066cc;
}

.filter-btn:focus {
    outline: 2px solid rgba(0, 102, 204, .35);
    outline-offset: 2px;
}


/* ========================================
SEKCJE KATEGORII
======================================== */

.category-section {
    margin-bottom: 20px;
}


/* ========================================
SIATKA
======================================== */

.materials-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    align-items: stretch;
}


/* ========================================
KAFELEK
======================================== */

.material-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.material-card:hover {
    transform: translateY(-4px);
    border-color: #d8d8d8;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}


/* ========================================
MINIATURA
======================================== */

.material-thumb {
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    overflow: hidden;
}

.material-thumb img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}


/* ========================================
TREŚĆ KAFELKA
======================================== */

.material-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 20px;
}

.material-content h3 {
    min-height: 30px;
    margin: 0 0 10px;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    color: #1f2937;
}

.material-content p {
    color: #666666;
    line-height: 1.6;
    margin: 0 0 20px;
    font-size: 15px;
}


/* ========================================
META: FORMAT / INDEX
======================================== */

.material-meta {
    margin: 12px 0 18px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.material-index,
.material-size {
    background: #f3f4f6;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 13px;
    color: #444444;
    font-weight: 500;
    line-height: 1.3;
}

.material-index strong,
.material-size strong {
    color: #222222;
    font-weight: 700;
}


/* ========================================
PRZYCISKI
======================================== */

.material-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.material-buttons a,
.preview-btn,
.material-file-missing {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.2;
}

.preview-btn {
    background: #f3f4f6;
    color: #1f2937;
    border: none;
    cursor: pointer;
    transition: background .25s ease, color .25s ease;
}

.preview-btn:hover {
    background: #e4e6ea;
}

.preview-btn:focus {
    outline: 2px solid rgba(0, 102, 204, .35);
    outline-offset: 2px;
}

.material-buttons a {
    background: #0066cc;
    color: #ffffff;
    transition: background .25s ease;
}

.material-buttons a:hover {
    background: #0052a3;
    color: #ffffff;
    text-decoration: none;
}

.material-buttons a:focus {
    outline: 2px solid rgba(0, 102, 204, .35);
    outline-offset: 2px;
}

.material-file-missing {
    background: #f3f4f6;
    color: #999999;
    cursor: default;
}


/* ========================================
PDF MODAL
======================================== */

#pdf-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .8);
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.pdf-modal-inner {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}

.close-modal {
    position: fixed;
    top: 20px;
    right: 25px;
    width: 50px;
    height: 50px;
    padding: 0;
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    z-index: 999999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
    transition: transform .2s ease, background .2s ease;
}

.close-modal:hover {
    transform: scale(1.1);
    background: #f3f4f6;
}

.close-modal:focus {
    outline: 2px solid rgba(255, 255, 255, .8);
    outline-offset: 3px;
}

#pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}


/* ========================================
RESPONSIVE
======================================== */

@media (max-width: 1400px) {
    .materials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .download-center {
        margin: 50px auto;
    }

    .materials-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .material-thumb {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .download-center {
        margin: 40px auto;
        padding: 0 16px;
    }

    .download-center h1 {
        font-size: 32px;
        margin-bottom: 30px;
    }

    .download-center h2 {
        font-size: 24px;
        margin: 40px 0 20px;
    }

    .materials-filter {
        justify-content: flex-start;
        margin-bottom: 35px;
    }

    .filter-btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .materials-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .material-thumb {
        height: 280px;
    }

    .material-content {
        padding: 18px;
    }

    .material-content h3 {
        font-size: 20px;
    }

    .material-buttons {
        flex-direction: column;
    }

    #pdf-modal {
        padding: 15px;
    }

    .pdf-modal-inner {
        width: 100%;
        height: 85vh;
        border-radius: 10px;
    }

    .close-modal {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .download-center h1 {
        font-size: 28px;
    }

    .download-center h2 {
        font-size: 22px;
    }

    .material-thumb {
        height: 240px;
    }

    .material-meta {
        justify-content: flex-start;
    }
}