/* ================================================== 
   Design System
   ================================================== */
:root {
    --bg-main: #09090b;
    --bg-secondary: #18181b;
    --bg-tertiary: #27272a;
    --text-primary: #fafafa;
    --text-muted: #a1a1aa;
    --text-dim: #52525b;

    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --accent-soft: rgba(99, 102, 241, 0.12);
    --danger: #e11d48;

    --glass-bg: rgba(24, 24, 27, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);

    --topbar-height: 60px;
    --transition-fast: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --page-shadow: 2px 0 12px rgba(0, 0, 0, 0.15), inset -2px 0 8px rgba(0, 0, 0, 0.05);
    --page-shadow-left: -2px 0 12px rgba(0, 0, 0, 0.15), inset 2px 0 8px rgba(0, 0, 0, 0.05);
    
    --star-color: #fff;
    --shape-bg: rgba(255, 255, 255, 0.03);
    --shape-border: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(0, 0, 0, 0.06);
    --page-shadow: 2px 0 12px rgba(0, 0, 0, 0.08), inset -2px 0 6px rgba(0, 0, 0, 0.03);
    --page-shadow-left: -2px 0 12px rgba(0, 0, 0, 0.08), inset 2px 0 6px rgba(0, 0, 0, 0.03);
    
    --star-color: var(--accent);
    --shape-bg: rgba(0, 0, 0, 0.03);
    --shape-border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color 0.4s, color 0.4s;
    touch-action: manipulation;
    overscroll-behavior: none;
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

.hidden {
    display: none !important;
}

/* Screens */
.screen-container {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-main);
    z-index: 100;
    overflow-y: auto;
    padding: 40px 20px;
    animation: screenReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes screenReveal {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

/* Splash */
#splash-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(145deg, var(--bg-main) 0%, var(--bg-secondary) 50%, var(--bg-main) 100%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 1.2s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: center center;
    will-change: transform, opacity, filter;
}

#splash-screen.zoom-out {
    transform: scale(4);
    opacity: 0;
    filter: blur(30px);
    pointer-events: none;
}

.splash-title {
    font-family: 'Outfit', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a78bfa, #6366f1);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
    letter-spacing: -1px;
}

.splash-subtitle {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 6px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.splash-loader {
    margin-top: 36px;
    width: 180px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-left: auto;
    margin-right: auto;
}

.loader-bar {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    box-shadow: 0 0 16px var(--accent-glow);
    border-radius: 4px;
    animation: loading 1.2s infinite ease-in-out;
}

@keyframes loading {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

.powered-by {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
}

.powered-by span {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.powered-by img {
    height: 32px;
    width: auto;
}


/* Shared Brand */
.upload-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.upload-tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    text-align: center;
    margin-top: 8px;
    margin-bottom: 30px;
}

/* Auth Card */
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--glass-shadow);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: 16px;
    color: var(--text-dim);
}

.input-group input {
    width: 100%;
    padding: 14px 14px 14px 44px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
    padding: 14px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-2px);
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 8px;
}

#catalog-screen {
    position: fixed;
    background-color: var(--bg-main);
    overflow-y: auto;
    z-index: 100;
}

/* Premium Animated Background */
.catalog-bg {
    position: fixed;
    inset: -40px;
    z-index: -1;
    overflow: hidden;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: moveGrid 20s linear infinite;
    pointer-events: none;
    will-change: transform;
}

@keyframes moveGrid {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(40px, 40px, 0); }
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: floatingBlobs 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    background: linear-gradient(135deg, #6366f1, #a18cd1);
    top: -10%;
    left: -10%;
    animation-duration: 25s;
}

.blob-2 {
    width: 40vw;
    height: 40vw;
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
    bottom: 10%;
    right: -5%;
    animation-duration: 22s;
    animation-delay: -5s;
}

.blob-3 {
    width: 45vw;
    height: 45vw;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    top: 40%;
    left: 30%;
    animation-duration: 28s;
    animation-delay: -12s;
    opacity: 0.3;
}

.blob-4 {
    width: 35vw;
    height: 35vw;
    background: linear-gradient(135deg, #f6d365, #fda085);
    bottom: -5%;
    left: 10%;
    animation-duration: 30s;
    animation-delay: -8s;
    opacity: 0.25;
}

.blob-5 {
    width: 55vw;
    height: 55vw;
    background: linear-gradient(135deg, #84fab0, #8fd3f4);
    top: -15%;
    right: 5%;
    animation-duration: 26s;
    animation-delay: -15s;
    opacity: 0.2;
}

.blob-6 {
    width: 40vw;
    height: 40vw;
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
    top: 30%;
    right: -10%;
    animation-duration: 32s;
    animation-delay: -3s;
    opacity: 0.3;
}

@keyframes floatingBlobs {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33% { transform: translate(15vw, 10vh) scale(1.2) rotate(45deg); }
    66% { transform: translate(-10vw, 20vh) scale(0.8) rotate(90deg); }
    100% { transform: translate(5vw, -15vh) scale(1.1) rotate(135deg); }
}

/* --- New Animated Background Elements --- */
.star {
    position: absolute;
    background: var(--star-color);
    border-radius: 50%;
    filter: blur(1px);
    animation: twinkle 4s infinite alternate ease-in-out;
    will-change: transform, opacity;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8) translateZ(0); }
    50% { opacity: 0.8; transform: scale(1.5) translateZ(0); }
}
.star-1 { width: 3px; height: 3px; top: 15%; left: 20%; animation-delay: 0s; }
.star-2 { width: 4px; height: 4px; top: 25%; left: 80%; animation-delay: 1s; }
.star-3 { width: 2px; height: 2px; top: 60%; left: 10%; animation-delay: 2.5s; }
.star-4 { width: 5px; height: 5px; top: 75%; left: 85%; animation-delay: 0.5s; }
.star-5 { width: 3px; height: 3px; top: 40%; left: 50%; animation-delay: 1.8s; }
.star-6 { width: 4px; height: 4px; top: 8%; left: 45%; animation-delay: 0.8s; }
.star-7 { width: 3px; height: 3px; top: 85%; left: 30%; animation-delay: 3s; }
.star-8 { width: 2px; height: 2px; top: 35%; left: 15%; animation-delay: 1.2s; }
.star-9 { width: 5px; height: 5px; top: 55%; left: 75%; animation-delay: 0.2s; }
.star-10 { width: 3px; height: 3px; top: 90%; left: 60%; animation-delay: 2.1s; }
.star-11 { width: 2px; height: 2px; top: 20%; left: 5%; animation-delay: 1.5s; }
.star-12 { width: 4px; height: 4px; top: 45%; left: 95%; animation-delay: 0.7s; }
.star-13 { width: 3px; height: 3px; top: 70%; left: 40%; animation-delay: 2.8s; }
.star-14 { width: 5px; height: 5px; top: 10%; left: 65%; animation-delay: 0.4s; }
.star-15 { width: 2px; height: 2px; top: 80%; left: 15%; animation-delay: 1.9s; }
.star-16 { width: 4px; height: 4px; top: 12%; left: 35%; animation-delay: 0.6s; }
.star-17 { width: 2px; height: 2px; top: 48%; left: 25%; animation-delay: 2.2s; }
.star-18 { width: 5px; height: 5px; top: 82%; left: 90%; animation-delay: 1.1s; }
.star-19 { width: 3px; height: 3px; top: 28%; left: 65%; animation-delay: 0.3s; }
.star-20 { width: 4px; height: 4px; top: 65%; left: 55%; animation-delay: 1.7s; }
.star-21 { width: 2px; height: 2px; top: 5%; left: 85%; animation-delay: 2.4s; }
.star-22 { width: 5px; height: 5px; top: 95%; left: 10%; animation-delay: 0.9s; }
.star-23 { width: 3px; height: 3px; top: 38%; left: 88%; animation-delay: 1.6s; }
.star-24 { width: 4px; height: 4px; top: 52%; left: 12%; animation-delay: 0.4s; }
.star-25 { width: 2px; height: 2px; top: 78%; left: 70%; animation-delay: 2.9s; }
.star-26 { width: 3px; height: 3px; top: 18%; left: 52%; animation-delay: 1.3s; }
.star-27 { width: 4px; height: 4px; top: 88%; left: 45%; animation-delay: 0.8s; }
.star-28 { width: 5px; height: 5px; top: 32%; left: 5%; animation-delay: 2.1s; }
.star-29 { width: 2px; height: 2px; top: 68%; left: 32%; animation-delay: 0.5s; }
.star-30 { width: 3px; height: 3px; top: 42%; left: 78%; animation-delay: 2.6s; }

.binary {
    position: absolute;
    font-family: monospace;
    color: var(--accent);
    opacity: 0.15;
    font-size: 1.2rem;
    white-space: nowrap;
    animation: binaryStream 15s linear infinite;
    user-select: none;
    z-index: -1;
}
@keyframes binaryStream {
    from { transform: translateY(-100vh) translateX(0); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    to { transform: translateY(100vh) translateX(-50px); opacity: 0; }
}
.binary-1 { left: 15%; top: 0; animation-duration: 25s; font-size: 1.5rem; }
.binary-2 { left: 75%; top: -20%; animation-duration: 18s; animation-delay: 5s; }
.binary-3 { left: 35%; top: -50%; animation-duration: 22s; animation-delay: 2s; font-size: 1.1rem; }
.binary-4 { left: 55%; top: -10%; animation-duration: 28s; animation-delay: 8s; font-size: 1.8rem; opacity: 0.1; }
.binary-5 { left: 90%; top: -40%; animation-duration: 20s; animation-delay: 12s; font-size: 1.3rem; }
.binary-6 { left: 5%; top: -30%; animation-duration: 21s; animation-delay: 3s; font-size: 1.4rem; opacity: 0.15; }
.binary-7 { left: 25%; top: -10%; animation-duration: 26s; animation-delay: 9s; font-size: 1.0rem; opacity: 0.2; }
.binary-8 { left: 45%; top: -45%; animation-duration: 19s; animation-delay: 1s; font-size: 1.6rem; opacity: 0.1; }
.binary-9 { left: 65%; top: -25%; animation-duration: 24s; animation-delay: 6s; font-size: 1.2rem; opacity: 0.25; }
.binary-10 { left: 85%; top: -5%; animation-duration: 29s; animation-delay: 14s; font-size: 1.7rem; opacity: 0.1; }

.shape {
    position: absolute;
    background: var(--shape-bg);
    border: 1px solid var(--shape-border);
    animation: spinShape 30s linear infinite;
    z-index: -1;
    will-change: transform;
}
@keyframes spinShape {
    0% { transform: rotate(0deg) translate3d(0,0,0); }
    50% { transform: rotate(180deg) translate3d(30px, 40px, 0); }
    100% { transform: rotate(360deg) translate3d(0,0,0); }
}
.shape-circle {
    width: 150px; height: 150px; border-radius: 50%;
    bottom: 20%; left: 15%; animation-duration: 25s;
}
.shape-square {
    width: 100px; height: 100px; border-radius: 15px;
    top: 30%; right: 20%; animation-direction: reverse;
}
.shape-triangle {
    width: 0; height: 0;
    background: transparent;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 100px solid var(--shape-border);
    border-top: none;
    top: 60%; left: 40%;
    animation-duration: 40s;
}
.shape-circle-2 {
    width: 80px; height: 80px; border-radius: 50%;
    top: 15%; left: 45%; animation-duration: 35s; animation-direction: reverse;
}
.shape-square-2 {
    width: 140px; height: 140px; border-radius: 20px;
    bottom: 10%; right: 35%; animation-duration: 28s;
}
.shape-circle-3 {
    width: 200px; height: 200px; border-radius: 50%;
    top: -5%; right: 25%; animation-duration: 45s; opacity: 0.5;
}
.shape-square-3 {
    width: 60px; height: 60px; border-radius: 8px;
    bottom: 30%; left: 35%; animation-duration: 20s; animation-direction: reverse;
}
.shape-triangle-2 {
    width: 0; height: 0; background: transparent;
    border-left: 40px solid transparent; border-right: 40px solid transparent;
    border-bottom: 70px solid var(--shape-border); border-top: none;
    top: 25%; right: 15%; animation-duration: 32s; animation-direction: reverse;
}
.shape-circle-4 {
    width: 40px; height: 40px; border-radius: 50%;
    bottom: 45%; right: 10%; animation-duration: 18s;
}
.shape-square-4 {
    width: 90px; height: 90px; border-radius: 12px;
    top: 50%; left: 5%; animation-duration: 36s;
}

.catalog-header {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 40px auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

.catalog-grid {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding-bottom: 60px;
}

.catalog-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    animation: catalogEntrance 0.8s cubic-bezier(0.25, 1, 0.5, 1) both;
    position: relative;
    transform-style: preserve-3d;
    will-change: transform, box-shadow;
}

.catalog-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-20deg);
    z-index: 10;
    transition: all 0.7s ease;
    pointer-events: none;
}

.catalog-card:hover::before {
    left: 150%;
}

@keyframes catalogEntrance {
    0% {
        opacity: 0;
        transform: translateY(50px) rotateX(10deg) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

.catalog-card:hover {
    transform: translateY(-12px) scale(1.03) rotateY(2deg) rotateX(2deg);
    box-shadow: 
        -10px 20px 30px rgba(0, 0, 0, 0.4), 
        0 0 25px var(--accent-glow),
        inset 0 0 0 1px var(--accent);
    border-color: transparent;
}

.catalog-cover {
    width: 100%;
    height: 180px;
    background: var(--bg-tertiary);
    object-fit: cover;
}

.catalog-cover-icon {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}

.catalog-cover-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.6) 100%);
    opacity: 0.5;
    transition: opacity 0.5s ease;
}

.catalog-card:hover .catalog-cover-icon::after {
    opacity: 0.2;
}

.catalog-cover-icon i {
    z-index: 1;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.catalog-card:hover .catalog-cover-icon i {
    transform: scale(1.3) translateY(-5px) rotate(-8deg);
    filter: drop-shadow(0 15px 20px rgba(0,0,0,0.6));
    color: #fff;
}

.catalog-info {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(to bottom, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
}

.catalog-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.4s ease;
}

.catalog-card:hover .catalog-title {
    background: linear-gradient(135deg, #a78bfa, #fbc2eb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: scale(1.02);
    transform-origin: left;
}

.catalog-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
    flex: 1;
}

.catalog-action {
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color var(--transition-fast);
}

.catalog-card:hover .catalog-action {
    color: var(--accent-hover);
    text-shadow: 0 0 10px var(--accent-glow);
}

.catalog-card:hover .catalog-action i {
    transform: translateX(4px);
    transition: transform 0.3s ease;
}

/* Dashboard */
#dashboard-screen {
    align-items: flex-start;
}

.dashboard-wrapper {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.dash-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
}

.dash-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

.btn-secondary {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.dash-stats {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-value span {
    color: var(--accent);
}

.dash-drop-zone {
    background: var(--accent-soft);
    border: 2px dashed var(--accent);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    color: var(--accent);
    transition: var(--transition-fast);
    text-align: center;
}

.dash-drop-zone:hover,
.dash-drop-zone.dragover {
    background: var(--accent);
    color: white;
}

.dash-drop-zone i {
    font-size: 2rem;
}

.dash-drop-zone.disabled {
    background: var(--bg-tertiary);
    border-color: var(--glass-border);
    color: var(--text-dim);
    cursor: not-allowed;
}

.dash-drop-zone.disabled:hover {
    background: var(--bg-tertiary);
    color: var(--text-dim);
}

.dash-msg {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

.dash-msg.error {
    background: rgba(225, 29, 72, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding-bottom: 40px;
}

.file-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: transform var(--transition-fast);
}

.file-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
    border-color: var(--accent-soft);
}

.file-icon {
    width: 48px;
    height: 48px;
    background: rgba(225, 29, 72, 0.1);
    color: var(--danger);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.file-info {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
}

.btn-view {
    flex: 1;
    padding: 10px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-view:hover {
    background: var(--accent-hover);
}

.btn-delete {
    padding: 10px 14px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-delete:hover {
    background: var(--danger);
    color: white;
}

#dashboard-loading {
    text-align: center;
    color: var(--accent);
    padding: 20px;
    font-weight: 500;
}

/* App Viewer & Top Bar */
#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#top-bar {
    height: var(--topbar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    flex-shrink: 0;
}

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

.book-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-indicator {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 6px 18px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.nav-right {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.icon-btn:hover {
    background: var(--accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* Book Stage & Flipbook */
#book-stage {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.book-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
    perspective: 2500px;
}

.book-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 50;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    position: relative;
}

.book-nav::after {
    content: '';
    position: absolute;
    inset: -24px;
    border-radius: 50%;
}

.book-nav:hover {
    transform: scale(1.1);
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.book-nav:disabled {
    opacity: 0.3;
    pointer-events: none;
}

#flipbook-container {
    position: relative;
    background-color: transparent;
    transition: transform 0.3s ease;
}

.my-page {
    background-color: transparent;
}

.page-content {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Thumbnails */
#thumbnail-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 150;
    padding: 12px 24px 16px;
    background: linear-gradient(to top, var(--bg-main) 60%, transparent);
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#thumbnail-dock:hover,
#thumbnail-dock.show {
    opacity: 1;
    transform: translateY(0);
}

#app:not(.fullscreen) #thumbnail-dock {
    opacity: 0.4;
}

#app:not(.fullscreen) #thumbnail-dock:hover {
    opacity: 1;
}

.thumb-container {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: var(--glass-shadow);
    overflow-x: auto;
    max-width: 90vw;
}

.thumb-item {
    flex-shrink: 0;
    width: 56px;
    height: 72px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
    background: #f0f0f0;
}

.thumb-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 16px var(--accent-glow);
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.55rem;
    text-align: center;
    padding: 2px 0;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-weight: 600;
}

/* Viewer Loading */
#viewer-loading {
    position: absolute;
    inset: 0;
    background: var(--bg-main);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
}

.viewer-loader-content {
    text-align: center;
    width: 250px;
}

.viewer-loader-content i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 16px;
}

.loading-track {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 16px;
}

.loading-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    transition: width 0.3s ease;
}

/* Responsiveness */
@media (max-width: 850px) {
    .dash-stats {
        grid-template-columns: 1fr;
    }

    .my-page {
        width: 100%;
    }

    /* Mobile Viewer: full-viewport single-page experience */
    #app {
        height: 100dvh;
        overflow: hidden;
    }

    /* Bottom toolbar for mobile */
    #top-bar {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        height: var(--topbar-height);
        background: var(--glass-bg);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--glass-border);
        border-bottom: none;
        padding: 0 10px;
        z-index: 200;
        justify-content: space-between;
    }

    #app.fullscreen #top-bar {
        position: fixed;
        bottom: 0;
        top: auto;
        opacity: 0;
        pointer-events: none;
        transform: translateY(100%);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #app.fullscreen.show-controls #top-bar {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav-left .book-title {
        display: none;
    }

    #book-stage {
        height: calc(100dvh - var(--topbar-height));
        margin-top: 0;
        overflow: hidden;
        touch-action: none; /* We manage all gestures ourselves */
    }

    #app.fullscreen #book-stage {
        height: 100dvh;
    }

    .book-wrapper {
        position: absolute;
        inset: 0;
        gap: 0;
    }

    /* Flipbook container fills stage on mobile */
    #flipbook-container {
        width: 100% !important;
        height: 100% !important;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    /* Clean, minimal navigation arrows — no background, translucent */
    .book-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 100;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        font-size: 1.6rem;
        color: rgba(255, 255, 255, 0.5);
        width: 44px;
        height: 80px;
        border-radius: 0;
        transition: color 0.2s ease, opacity 0.25s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .book-nav::after {
        /* Enlarge hit area without visual change */
        content: '';
        position: absolute;
        inset: -16px -12px;
    }

    .book-nav:hover,
    .book-nav:active {
        background: none !important;
        color: rgba(255, 255, 255, 0.85);
        transform: translateY(-50%);
        box-shadow: none !important;
    }

    .book-nav.prev {
        left: 4px;
    }

    .book-nav.next {
        right: 4px;
    }

    /* Hide arrows when zoomed in */
    #book-stage.is-zoomed .book-nav {
        opacity: 0;
        pointer-events: none;
    }

    #thumbnail-dock {
        bottom: var(--topbar-height);
    }

    .icon-btn {
        background: transparent;
        border: none;
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

@media (max-width: 500px) {
    .nav-right {
        gap: 2px;
    }
    #page-indicator {
        padding: 4px 10px;
        font-size: 0.8rem;
    }
}

/* Desktop Fullscreen */
@media (min-width: 851px) {
    #app.fullscreen #top-bar {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to bottom, var(--bg-main) 50%, transparent);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-100%);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #app.fullscreen.show-controls #top-bar,
    #app.fullscreen #top-bar:hover {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    #app.fullscreen #book-stage {
        height: 100vh;
    }
}

/* Mobile Landscape Override */
@media (max-width: 850px) and (orientation: landscape) {
    #top-bar {
        bottom: auto !important;
        top: 0 !important;
        border-top: none !important;
        border-bottom: 1px solid var(--glass-border) !important;
    }
    
    #app.fullscreen #top-bar {
        position: fixed !important;
        bottom: auto !important;
        top: 0 !important;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-100%) !important;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #app.fullscreen.show-controls #top-bar {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) !important;
    }

    #thumbnail-dock {
        bottom: 0 !important;
    }
}
