/* ============================================================
   Картотека Золтана — Vintage/Sepia Theme
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    background: url('bg.png') no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
    color: #3E2B1A;
}

/* Dark overlay on background for readability */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(20, 12, 5, 0.55);
    z-index: 0;
}

/* ============================================================
   Container
   ============================================================ */

.container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px 60px;
    min-height: 100vh;
}

/* ============================================================
   Breadcrumbs
   ============================================================ */

.breadcrumbs {
    background: rgba(210, 180, 140, 0.85);
    border: 1px solid #A08060;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 20px;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}

.breadcrumb-link {
    color: #5C3D1E;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: #8B5E3C;
    text-decoration: underline;
}

.breadcrumb-current {
    color: #3E2B1A;
    font-weight: 700;
}

.breadcrumb-sep {
    margin: 0 8px;
    color: #8B7355;
}

/* ============================================================
   Back Button
   ============================================================ */

.back-btn {
    display: inline-block;
    background: rgba(180, 150, 110, 0.85);
    color: #3E2B1A;
    text-decoration: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    margin-bottom: 24px;
    border: 1px solid #A08060;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.back-btn:hover {
    background: rgba(200, 170, 130, 0.95);
    transform: translateY(-1px);
}

/* ============================================================
   Folder Grid
   ============================================================ */

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #F5E6D0;
    padding: 16px 8px;
    border-radius: 10px;
    background: rgba(62, 43, 26, 0.5);
    border: 1px solid rgba(160, 128, 96, 0.3);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.folder-item:hover {
    background: rgba(80, 55, 30, 0.7);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    border-color: rgba(210, 180, 140, 0.5);
}

.item-icon {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.item-label {
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    letter-spacing: 1px;
}

/* Categories grid (3 items centered) */
.categories-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
    margin: 40px auto 0;
    gap: 30px;
}

.category-item {
    padding: 24px 12px;
}

.category-item .item-icon {
    width: 90px;
    height: 90px;
}

.category-item .item-label {
    font-size: 18px;
    margin-top: 4px;
}

/* ============================================================
   File Display
   ============================================================ */

.file-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.file-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(62, 43, 26, 0.6);
    border: 1px solid rgba(160, 128, 96, 0.4);
    border-radius: 12px;
    padding: 30px 40px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    color: #F5E6D0;
}

.file-card:hover {
    background: rgba(80, 55, 30, 0.8);
    transform: scale(1.05);
}

.file-card .item-icon {
    width: 100px;
    height: 100px;
}

.file-card .item-label {
    font-size: 18px;
    margin-top: 4px;
}

/* Audio card */
.audio-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(62, 43, 26, 0.6);
    border: 1px solid rgba(160, 128, 96, 0.4);
    border-radius: 12px;
    padding: 30px 40px;
    color: #F5E6D0;
}

.audio-card .item-icon {
    width: 100px;
    height: 100px;
}

.audio-card .item-label {
    font-size: 18px;
    margin-bottom: 16px;
}

.audio-player {
    width: 100%;
    max-width: 350px;
    border-radius: 8px;
}

/* ============================================================
   Empty Message
   ============================================================ */

.empty-message {
    text-align: center;
    padding: 60px 20px;
    color: #D2B48C;
    font-size: 20px;
    font-style: italic;
}

/* ============================================================
   Image Viewer Overlay
   ============================================================ */

.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 5, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.image-viewer.active {
    display: flex;
}

.image-viewer img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.8);
}

.viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: rgba(210, 180, 140, 0.8);
    border: none;
    color: #3E2B1A;
    font-size: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-family: inherit;
}

.viewer-close:hover {
    background: rgba(245, 230, 208, 1);
}

/* ============================================================
   Popup
   ============================================================ */

.popup-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 5, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.popup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.popup-box {
    background: linear-gradient(145deg, #F5E6D0, #D2B48C);
    border: 2px solid #A08060;
    border-radius: 14px;
    padding: 40px 36px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.popup-overlay.hidden .popup-box {
    transform: scale(0.9);
}

.popup-title {
    font-size: 26px;
    color: #3E2B1A;
    margin-bottom: 16px;
    font-weight: 700;
}

.popup-text {
    font-size: 16px;
    color: #5C3D1E;
    line-height: 1.6;
    margin-bottom: 28px;
}

.popup-btn {
    background: #5C3D1E;
    color: #F5E6D0;
    border: none;
    padding: 12px 36px;
    font-size: 17px;
    font-family: inherit;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.5px;
}

.popup-btn:hover {
    background: #7A5230;
    transform: translateY(-1px);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
    .container {
        padding: 16px 12px 40px;
    }

    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }

    .folder-item {
        padding: 12px 6px;
    }

    .item-icon {
        width: 56px;
        height: 56px;
    }

    .item-label {
        font-size: 17px;
    }

    .breadcrumbs {
        font-size: 14px;
        padding: 10px 14px;
    }

    .popup-box {
        padding: 28px 22px;
    }

    .popup-title {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .folder-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .item-icon {
        width: 48px;
        height: 48px;
    }

    .item-label {
        font-size: 15px;
    }
}
