/*
 * ██████╗ ███████╗████████╗██████╗  ██████╗      █████╗ ███████╗ ██████╗██╗██╗    ██╗   ██╗██╗██████╗ ███████╗███████╗
 * ██╔══██╗██╔════╝╚══██╔══╝██╔══██╗██╔═══██╗    ██╔══██╗██╔════╝██╔════╝██║██║    ██║   ██║██║██╔══██╗██╔════╝██╔════╝
 * ██████╔╝█████╗     ██║   ██████╔╝██║   ██║    ███████║███████╗██║     ██║██║    ██║   ██║██║██████╔╝█████╗  ███████╗
 * ██╔══██╗██╔══╝     ██║   ██╔══██╗██║   ██║    ██╔══██║╚════██║██║     ██║██║    ╚██╗ ██╔╝██║██╔══██╗██╔══╝  ╚════██║
 * ██║  ██║███████╗   ██║   ██║  ██║╚██████╔╝    ██║  ██║███████║╚██████╗██║██║     ╚████╔╝ ██║██████╔╝███████╗███████║
 * ╚═╝  ╚═╝╚══════╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝     ╚═╝  ╚═╝╚══════╝ ╚═════╝╚═╝╚═╝      ╚═══╝  ╚═╝╚═════╝ ╚══════╝╚══════╝
 *
 * KD's Homebrew PDF Archive - Retro ASCII Vibes CSS Framework
 * 
 * 🎨 Style Philosophy: Terminal chic meets modern web design
 * 🖥️  Theme: Monospace fonts, animated bars, and that sweet CRT nostalgia
 * 📱 Responsive: Because even retro needs to work on mobile
 * ⚡ Performance: Optimized animations for Raspberry Pi deployments
 * 
 * Color Palette: Shades of awesome (mostly grayscale with attitude)
 * Typography: Courier New or bust - keeping it old school
 * 
 * kunaldawn.com - Where CSS meets personality
 */

body {
    font-family: "Courier New", monospace;
    background-color: #ffffff;
    color: #333333;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg,
    rgba(248, 248, 248, 1) 0%,
    rgba(255, 255, 255, 1) 100%);
}

.animated-bars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    background: repeating-linear-gradient(
            0deg,
            rgba(230, 230, 230, 0.3), rgba(230, 230, 230, 0.3) 2px,
            transparent 4px, transparent 10px);
    animation: retroBars 4s linear infinite;
}

a {
    color: #444444;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #000000;
}

header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e0e0e0;
    z-index: 100;
    padding: 15px 20px;
}

.main-title {
    text-align: center;
    margin-bottom: 15px;
}

.main-title h1 {
    color: #000000;
    font-family: "Courier New", Courier, monospace;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    padding: 10px 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 2px solid #000000;
    background-color: #ffffff;
    text-align: center;
    position: relative;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
}

.breadcrumb-link {
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    color: #000000;
    text-decoration: none;
    padding: 2px 6px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid transparent;
}

.breadcrumb-link:hover {
    color: #ffffff;
    background-color: #000000;
    border-color: #000000;
}

.breadcrumb-separator {
    color: #000000;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    font-weight: bold;
}

.current-location {
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    color: #ffffff;
    font-weight: bold;
    padding: 2px 8px;
    background-color: #000000;
    border: 2px solid #000000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.folders-container, .pdf-container {
    flex: 1 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 30px;
    overflow: visible;
    justify-content: center;
    align-content: flex-start;
    contain: layout style paint;
}

.folder, .pdf {
    margin: 0;
    padding: 15px;
    border: 1px solid #dddddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 300px;
    height: 390px;
    overflow: hidden;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.folder img, .pdf img {
    width: 100%;
    height: 100%;
    display: block;
    visibility: hidden;
    opacity: 0;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    backface-visibility: hidden;
}

.folder img.active, .pdf img.loaded {
    opacity: 1;
    visibility: visible;
}

.folder.no-thumbnails {
    background: linear-gradient(135deg, #f8f8f8 0%, #e8e8e8 100%);
    border: 2px dashed #ccc;
}

.folder.no-thumbnails::before {
    content: "📁 NO THUMBNAILS";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    color: #666;
    font-weight: bold;
    text-align: center;
    z-index: 5;
}

.folder img[loading="lazy"]:not(.active):not(.loaded),
.pdf img[loading="lazy"]:not(.loaded) {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.pdf img.loading {
    opacity: 0.3; 
    visibility: visible; 
}

.folder img.loading {
    opacity: 0.3;
    visibility: visible;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.lazy-image {
    background-color: rgba(240, 240, 240, 0.5);
    border: 1px solid rgba(200, 200, 200, 0.3);
    filter: blur(2px);
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.folder-info, .pdf-details {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    border-top: 2px solid rgba(51, 51, 51, 0.75);
    text-align: left;
    padding: 8px 5px;
    font-size: 12px;
    font-family: "Courier New", Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    z-index: 15;
    box-sizing: border-box;
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

::-webkit-scrollbar {
    width: 12px;
    background: rgba(245, 245, 245, 0.8);
}

::-webkit-scrollbar-track {
    background: rgba(250, 250, 250, 0.9);
    border: 1px solid rgba(220, 220, 220, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #888888, #666666);
    border-radius: 6px;
    border: 1px solid rgba(160, 160, 160, 0.5);
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #666666, #444444);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-corner {
    background: rgba(250, 250, 250, 0.9);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #888888 rgba(245, 245, 245, 0.8);
}

footer, .footer {
    margin-top: auto;
    background-color: rgba(248, 248, 248, 0.9);
    color: #666666;
    font-size: 16px;
    text-align: center;
    font-family: "Courier New", Courier, monospace;
    border-top: 1px solid rgba(220, 220, 220, 0.8);
    padding: 10px 0;
    z-index: 100;
    flex-shrink: 0;
}

@keyframes retroBars {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(10px);
    }
}


.folder::before, .folder::after,
.pdf::before, .pdf::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    mix-blend-mode: multiply;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.folder::before, .pdf::before {
    background: rgba(200, 200, 200, 0.1);
}

.folder::after, .pdf::after {
    background: rgba(100, 100, 100, 0.1);
}

.folder:hover, .pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.folder:hover::before, .pdf:hover::before,
.folder:hover::after, .pdf:hover::after {
    opacity: 0.5;
}

.empty-message {
    width: 100%;
    text-align: center;
    color: #000000;
    font-family: "Courier New", Courier, monospace;
    font-size: 16px;
    padding: 50px 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    border: 2px solid #000000;
    background-color: #ffffff;
    margin: 20px;
}

.empty-message::before {
    content: "[ SYSTEM MESSAGE ]";
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666666;
}

.empty-message::after {
    content: "────────────────────────────────";
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: #666666;
}

.folder.pdf-folder {
    border: 3px solid #000000;
    background: #ffffff;
}

.folder.pdf-folder .folder-info {
    background-color: #333333;
    color: #ffffff;
    border-top: 2px solid #000000;
}