/* ═══════════════════════════════════════════════════════════════
   Files.Alowy — Apple Liquid Glass Dark Theme
   True glassmorphism with refraction, specular highlights,
   caustic light, and depth layering
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #050509;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-border-bright: rgba(255, 255, 255, 0.14);
    --glass-specular: rgba(255, 255, 255, 0.15);
    --glass-specular-strong: rgba(255, 255, 255, 0.25);
    --glass-inner-shadow: rgba(255, 255, 255, 0.06);
    --glass-shadow: rgba(0, 0, 0, 0.5);
    --text-1: rgba(255, 255, 255, 0.95);
    --text-2: rgba(255, 255, 255, 0.55);
    --text-3: rgba(255, 255, 255, 0.28);
    --accent: #7ab8ff;
    --accent-2: #a78bfa;
    --accent-glow: rgba(122, 184, 255, 0.2);
    --radius: 24px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --blur: 50px;
    --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-1);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Background Scene ────────────────────────────────────────── */
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.noise-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-size: 256px 256px;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: orbDrift 25s ease-in-out infinite;
}

.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4) 0%, rgba(59, 130, 246, 0) 70%);
    top: -15%; left: -10%;
    animation-delay: 0s;
}
.orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.35) 0%, rgba(139, 92, 246, 0) 70%);
    top: 40%; right: -12%;
    animation-delay: -8s;
}
.orb-3 {
    width: 450px; height: 450px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, rgba(6, 182, 212, 0) 70%);
    bottom: -10%; left: 25%;
    animation-delay: -16s;
}
.orb-4 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(244, 114, 182, 0.2) 0%, rgba(244, 114, 182, 0) 70%);
    top: 20%; left: 50%;
    animation-delay: -12s;
    animation-duration: 30s;
}

@keyframes orbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    20% { transform: translate(40px, -30px) scale(1.08); }
    40% { transform: translate(-25px, 45px) scale(0.92); }
    60% { transform: translate(35px, 20px) scale(1.05); }
    80% { transform: translate(-15px, -35px) scale(0.97); }
}

/* ─── Liquid Glass Material ───────────────────────────────────── */
.liquid-card {
    position: relative;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.01) 50%, rgba(255,255,255,0.04) 100%);
    backdrop-filter: blur(var(--blur)) saturate(1.6) brightness(1.1);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6) brightness(1.1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow:
        0 8px 32px var(--glass-shadow),
        0 0 0 0.5px rgba(255,255,255,0.05) inset,
        0 1px 0 var(--glass-inner-shadow) inset;
    overflow: hidden;
}

/* Top specular highlight — the key liquid glass element */
.liquid-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(
        180deg,
        var(--glass-specular) 0%,
        rgba(255,255,255,0.04) 30%,
        transparent 100%
    );
    border-radius: var(--radius) var(--radius) 0 0;
    pointer-events: none;
    z-index: 1;
}

/* Bottom caustic refraction */
.liquid-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    pointer-events: none;
    z-index: 1;
}

.liquid-bar {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    backdrop-filter: blur(60px) saturate(1.8) brightness(1.05);
    -webkit-backdrop-filter: blur(60px) saturate(1.8) brightness(1.05);
    border-bottom: 1px solid var(--glass-border);
    box-shadow:
        0 4px 20px var(--glass-shadow),
        0 1px 0 var(--glass-inner-shadow) inset;
}

.liquid-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 5%,
        var(--glass-specular) 20%,
        var(--glass-specular-strong) 50%,
        var(--glass-specular) 80%,
        transparent 95%
    );
    pointer-events: none;
}

.liquid-chip {
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    box-shadow:
        0 2px 8px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.06);
    position: relative;
    overflow: hidden;
}

.liquid-chip::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
    border-radius: 100px 100px 0 0;
    pointer-events: none;
}

.liquid-btn {
    position: relative;
    background:
        linear-gradient(135deg, rgba(122,184,255,0.12) 0%, rgba(167,139,250,0.12) 100%);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(122,184,255,0.18);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
    box-shadow:
        0 4px 16px rgba(0,0,0,0.3),
        0 0 0 0.5px rgba(122,184,255,0.1) inset,
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.liquid-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.12), transparent);
    pointer-events: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.btn-shine {
    position: absolute;
    top: -100%; left: -100%;
    width: 300%; height: 300%;
    background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.liquid-btn:hover {
    border-color: rgba(122,184,255,0.35);
    background: linear-gradient(135deg, rgba(122,184,255,0.18) 0%, rgba(167,139,250,0.18) 100%);
    box-shadow:
        0 8px 32px rgba(122,184,255,0.15),
        0 0 0 0.5px rgba(122,184,255,0.2) inset,
        inset 0 1px 0 rgba(255,255,255,0.15);
    transform: translateY(-1px);
}

.liquid-btn:hover .btn-shine { opacity: 1; }

.liquid-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ─── Header ──────────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 24px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-glass {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(122,184,255,0.08);
    border: 1px solid rgba(122,184,255,0.15);
    border-radius: 10px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.logo-glass::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
    border-radius: 10px 10px 0 0;
    pointer-events: none;
}

.logo-icon {
    width: 18px; height: 18px;
    color: var(--accent);
    position: relative;
    z-index: 1;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--text-1);
}

.logo-dot { color: var(--accent); }

/* ─── Container ───────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    position: relative;
    z-index: 1;
}

/* ─── Files Grid ──────────────────────────────────────────────── */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* ─── File Card ───────────────────────────────────────────────── */
.file-card {
    cursor: pointer;
    transition: var(--transition);
    animation: cardIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.file-card:nth-child(1) { animation-delay: 0.05s; }
.file-card:nth-child(2) { animation-delay: 0.1s; }
.file-card:nth-child(3) { animation-delay: 0.15s; }
.file-card:nth-child(4) { animation-delay: 0.2s; }
.file-card:nth-child(5) { animation-delay: 0.25s; }
.file-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(24px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.file-card:hover {
    transform: translateY(-6px) scale(1.015);
    border-color: var(--glass-border-bright);
    box-shadow:
        0 16px 48px var(--glass-shadow),
        0 0 60px rgba(122,184,255,0.04),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.file-card:hover::before {
    background: linear-gradient(
        180deg,
        var(--glass-specular-strong) 0%,
        rgba(255,255,255,0.06) 25%,
        transparent 100%
    );
}

.file-card:active { transform: translateY(-2px) scale(0.99); }

.card-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    position: relative;
    z-index: 0;
}

.card-cover-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, rgba(122,184,255,0.06), rgba(139,92,246,0.06));
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-cover-placeholder svg {
    width: 48px; height: 48px;
    color: var(--text-3);
}

.card-body { padding: 20px; position: relative; z-index: 2; }

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-desc {
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-3);
}

.card-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-meta-item svg { width: 14px; height: 14px; }

.card-download-icon {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(122,184,255,0.06);
    border: 1px solid rgba(122,184,255,0.12);
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.card-download-icon::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
    border-radius: 50%;
    pointer-events: none;
}

.file-card:hover .card-download-icon {
    background: rgba(122,184,255,0.15);
    border-color: rgba(122,184,255,0.3);
    box-shadow: 0 0 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.1);
}

.card-download-icon svg { width: 16px; height: 16px; color: var(--accent); position: relative; z-index: 1; }

/* ─── Single File View ────────────────────────────────────────── */
.single-file-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 20px;
}

.single-card {
    width: 100%;
    max-width: 560px;
}

.single-cover-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.single-cover {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.single-cover-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.12) 0%,
        transparent 40%,
        transparent 60%,
        rgba(255,255,255,0.04) 100%
    );
    pointer-events: none;
    z-index: 2;
}

.single-cover-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 100px;
    background: linear-gradient(to top, rgba(5,5,9,0.8), transparent);
    pointer-events: none;
    z-index: 2;
}

.single-body {
    padding: 28px 32px 32px;
    position: relative;
    z-index: 2;
}

.single-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.8px;
    color: var(--text-1);
    margin-bottom: 10px;
    line-height: 1.25;
}

.single-desc {
    font-size: 15px;
    color: var(--text-2);
    line-height: 1.65;
    margin-bottom: 24px;
}

.single-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    color: var(--text-2);
}

.meta-chip svg { width: 14px; height: 14px; color: var(--text-3); }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    color: var(--text-2);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.back-link:hover {
    color: var(--text-1);
    border-color: var(--glass-border-bright);
}

.back-link svg { width: 16px; height: 16px; }

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    transform: scale(0.9) translateY(24px);
    transition: var(--spring);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    z-index: 10;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-1);
    transform: rotate(90deg);
}

.modal-close svg { width: 16px; height: 16px; }

.modal-cover-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-cover {
    width: 100%;
    height: 260px;
    object-fit: cover;
    display: block;
}

.modal-cover-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 80px;
    background: linear-gradient(to top, rgba(5,5,9,0.6), transparent);
    pointer-events: none;
    z-index: 2;
}

.modal-body {
    padding: 24px 28px 28px;
    position: relative;
    z-index: 2;
}

.modal-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-1);
    margin-bottom: 8px;
    line-height: 1.3;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

/* ─── Download Button ─────────────────────────────────────────── */
.download-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 24px;
    font-size: 15px;
    font-family: inherit;
}

.download-btn svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.download-btn span { position: relative; z-index: 1; }

.download-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ─── Empty State ─────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 24px;
    text-align: center;
}

.empty-icon {
    width: 80px; height: 80px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 24px;
}

.empty-icon svg { width: 36px; height: 36px; color: var(--text-3); position: relative; z-index: 2; }

.empty-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 8px;
}

.empty-sub {
    font-size: 14px;
    color: var(--text-3);
}

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    .files-grid { grid-template-columns: 1fr; gap: 16px; }
    .container { padding: 24px 16px 60px; }
    .header-content { height: 56px; }
    .modal { max-width: 100%; }
    .modal-body { padding: 20px; }
    .single-body { padding: 20px; }
    .single-title { font-size: 22px; }
    .orb { filter: blur(80px); }
}

@media (max-width: 400px) {
    .logo-text { font-size: 16px; }
    .card-cover, .card-cover-placeholder { height: 160px; }
}
