/* ═══════════════════════════════════════════════════════════════════════════
   LIMINAL REVIEW PORTAL
   Dark cinematic aesthetic — immersive, professional, atmospheric
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --bg-deep: #0a0a0f;
    --bg-surface: #12121a;
    --bg-card: #1a1a26;
    --bg-card-hover: #222233;
    --bg-elevated: #252538;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text-primary: #e8e8f0;
    --text-secondary: rgba(232, 232, 240, 0.55);
    --text-muted: rgba(232, 232, 240, 0.3);
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.15);
    --accent-hover: #7d75ff;
    --green: #4ade80;
    --amber: #fbbf24;
    --red: #f87171;
    --folder-color: #6c63ff;
    --video-color: #f472b6;
    --image-color: #34d399;
    --document-color: #60a5fa;
    --archive-color: #fbbf24;
    --file-color: var(--text-secondary);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', monospace;
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Atmospheric Background ───────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(108, 99, 255, 0.05) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 80% 90%, rgba(244, 114, 182, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo img {
    height: 36px;
    opacity: 0.92;
    transition: opacity 0.2s;
}
.header-logo:hover img { opacity: 1; }

.header-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-card);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.btn-logout {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}
.btn-logout:hover { color: var(--text-primary); }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: calc(100vh - 120px);
}

/* ── Breadcrumbs ──────────────────────────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}
.breadcrumb-item:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

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

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
    flex: 1;
    max-width: 360px;
    transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

.file-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
}

/* ── File Grid ────────────────────────────────────────────────────────────── */
.file-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.file-item:hover {
    background: var(--bg-card);
    border-color: var(--border);
}

.file-item--folder { color: var(--text-primary); }

/* ── File Icons ───────────────────────────────────────────────────────────── */
.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.file-icon--folder {
    background: rgba(108, 99, 255, 0.1);
    color: var(--folder-color);
}
.file-icon--video {
    background: rgba(244, 114, 182, 0.1);
    color: var(--video-color);
}
.file-icon--image {
    background: rgba(52, 211, 153, 0.1);
    color: var(--image-color);
}
.file-icon--document {
    background: rgba(96, 165, 250, 0.1);
    color: var(--document-color);
}
.file-icon--archive {
    background: rgba(251, 191, 36, 0.1);
    color: var(--archive-color);
}
.file-icon--file {
    background: rgba(232, 232, 240, 0.05);
    color: var(--file-color);
}

/* ── File Info ─────────────────────────────────────────────────────────────── */
.file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── File Actions ─────────────────────────────────────────────────────────── */
.file-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.btn-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.15s;
}
.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.file-item .file-actions .btn-icon {
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.file-item:hover .file-actions .btn-icon { opacity: 1; }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    gap: 1rem;
}

/* ── Preview Page ─────────────────────────────────────────────────────────── */
.preview-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-back:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.preview-title-group { flex: 1; min-width: 0; }

.preview-filename {
    font-size: 1rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bg-deep);
    background: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    flex-shrink: 0;
}
.btn-download:hover { background: var(--accent-hover); }

.preview-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.preview-video {
    width: 100%;
    max-height: 80vh;
    background: #000;
}

.preview-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.preview-pdf {
    width: 100%;
    height: 80vh;
    border: none;
}

.preview-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-muted);
}

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.login-card {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.login-logo {
    margin-bottom: 1.5rem;
}
.login-logo img {
    height: 44px;
    opacity: 0.92;
}

.login-title {
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.login-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--red);
    font-size: 0.82rem;
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.login-form { display: flex; flex-direction: column; gap: 0.8rem; }

.input-group input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.9rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--accent); }
.input-group input::placeholder { color: var(--text-muted); }

.btn-login {
    width: 100%;
    background: var(--accent);
    color: var(--bg-deep);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.7rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-login:hover { background: var(--accent-hover); }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
}

.login-footer { text-align: center; }

.footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}
.footer-text a {
    color: var(--text-secondary);
    transition: color 0.2s;
}
.footer-text a:hover { color: var(--accent); }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-inner { padding: 0.6rem 1rem; }
    .main-content { padding: 1rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: none; }
    .file-item { padding: 0.6rem 0.7rem; gap: 0.7rem; }
    .file-icon { width: 34px; height: 34px; }
    .file-item .file-actions .btn-icon { opacity: 1; }
    .preview-nav { flex-wrap: wrap; }
    .preview-filename { font-size: 0.85rem; }
}
