:root {
    --bg: #0f172a; --bg-card: #1e293b; --bg-input: #0f172a; --border: #1e293b; --border-hover: #334155;
    --text: #e2e8f0; --text-muted: #94a3b8; --text-dim: #64748b; --text-dimmer: #475569;
    --accent: #3b82f6; --accent-hover: #2563eb; --accent-light: #38bdf8; --accent-bg: rgba(59,130,246,0.05); --accent-bg-strong: rgba(59,130,246,0.1);
    --danger: #ef4444; --danger-hover: #dc2626; --warning: #fbbf24;
    --toast-success-bg: #065f46; --toast-success-text: #a7f3d0; --toast-success-border: #047857;
    --toast-error-bg: #7f1d1d; --toast-error-text: #fca5a5; --toast-error-border: #991b1b;
    --toast-info-bg: #1e3a5f; --toast-info-text: #93c5fd; --toast-info-border: #1e40af;
    --overlay-bg: rgba(0,0,0,0.6);
}
[data-theme="light"] {
    --bg: #f8fafc; --bg-card: #ffffff; --bg-input: #f1f5f9; --border: #e2e8f0; --border-hover: #cbd5e1;
    --text: #1e293b; --text-muted: #64748b; --text-dim: #94a3b8; --text-dimmer: #cbd5e1;
    --accent-bg: rgba(59,130,246,0.05); --accent-bg-strong: rgba(59,130,246,0.1);
    --toast-success-bg: #dcfce7; --toast-success-text: #166534; --toast-success-border: #86efac;
    --toast-error-bg: #fee2e2; --toast-error-text: #991b1b; --toast-error-border: #fca5a5;
    --toast-info-bg: #dbeafe; --toast-info-text: #1e40af; --toast-info-border: #93c5fd;
    --overlay-bg: rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; transition: background 0.3s, color 0.3s; }
.hidden { display: none !important; }
.container { max-width: 800px; margin: 0 auto; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; }

/* Header */
header { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--accent-light); text-decoration: none; transition: color 0.2s; display: flex; align-items: center; gap: 10px; }
.logo:hover { color: #7dd3fc; }
.logo i { font-size: 1.6rem; }
#header-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle { font-size: 1.1rem; color: var(--text-muted); }
.theme-toggle:hover { color: var(--text); }

/* Buttons */
.btn { padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: var(--border-hover); color: var(--text); }
.btn-secondary:hover { opacity: 0.85; }
.btn-outline { background: transparent; color: var(--accent-light); border: 2px solid var(--accent-light); }
.btn-outline:hover { background: var(--accent-light); color: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 4px; }
.btn-icon:hover { color: var(--text); }

/* Hero / Auth */
#auth-section { flex: 1; display: flex; align-items: center; justify-content: center; }
.hero { text-align: center; padding: 40px 20px; }
.hero-icon { font-size: 4rem; color: var(--accent); margin-bottom: 20px; display: block; }
.hero h2 { font-size: 2.2rem; margin-bottom: 12px; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 32px; max-width: 400px; margin-left: auto; margin-right: auto; }
.auth-buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Full-page drag overlay */
.drag-overlay { position: fixed; inset: 0; background: var(--overlay-bg); z-index: 300; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.drag-overlay-content { text-align: center; color: var(--accent-light); }
.drag-overlay-content i { font-size: 5rem; margin-bottom: 16px; display: block; animation: bounce 1s infinite; }
.drag-overlay-content p { font-size: 1.4rem; font-weight: 600; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* Upload zone */
.upload-zone { border: 2px dashed var(--border-hover); border-radius: 16px; padding: 50px 20px; text-align: center; cursor: pointer; transition: all 0.3s; margin-bottom: 30px; }
.upload-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.upload-zone.dragover { border-color: var(--accent); background: var(--accent-bg-strong); transform: scale(1.01); }
.upload-icon { font-size: 3rem; color: var(--accent); margin-bottom: 16px; display: block; }
.upload-text { font-size: 1.1rem; color: var(--text); margin-bottom: 8px; }
.upload-hint { color: var(--text-dim); font-size: 0.9rem; }

/* Progress */
.progress-bar { width: 100%; height: 8px; background: var(--bg-card); border-radius: 4px; overflow: hidden; margin: 15px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); transition: width 0.3s; border-radius: 4px; }
.upload-status { text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Section title */
.section-title { font-size: 1.2rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; color: var(--text); }

/* File cards */
.file-card { background: var(--bg-card); border-radius: 12px; padding: 18px; margin-bottom: 12px; transition: all 0.2s; border: 1px solid var(--border); }
.file-card:hover { border-color: var(--border-hover); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.file-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 12px; }
.file-card-header h3 { font-size: 0.95rem; word-break: break-all; display: flex; align-items: center; gap: 8px; }
.file-card-header .file-type-icon { color: var(--accent); font-size: 1.1rem; flex-shrink: 0; }
.file-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.file-meta span { display: flex; align-items: center; gap: 4px; }
.file-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-input { background: var(--bg-input); border: 1px solid var(--border-hover); color: var(--text); padding: 7px 12px; border-radius: 6px; font-size: 0.8rem; flex: 1; min-width: 180px; font-family: monospace; }
.share-input:focus { outline: none; border-color: var(--accent); }
.expiry-badge { color: var(--warning); }
.expiry-badge.expiring-soon { color: var(--danger); }

/* Skeleton loading */
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--border-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 120px; margin-bottom: 12px; }

/* Empty state */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; color: var(--border-hover); }
.empty-state p { font-size: 1rem; }

/* Download page */
.download-card { background: var(--bg-card); border-radius: 16px; padding: 50px 30px; text-align: center; margin-top: 20px; border: 1px solid var(--border-hover); }
.dl-icon { font-size: 3.5rem; color: var(--accent); margin-bottom: 20px; display: block; }
.dl-meta { color: var(--text-muted); margin-bottom: 16px; font-size: 0.95rem; }
.dl-countdown { color: var(--warning); font-size: 0.9rem; margin-bottom: 24px; font-variant-numeric: tabular-nums; }
.dl-preview { margin-bottom: 20px; }
.dl-preview img { max-width: 100%; max-height: 300px; border-radius: 8px; object-fit: contain; }
.dl-preview video { max-width: 100%; max-height: 300px; border-radius: 8px; }
.dl-preview audio { width: 100%; }
.dl-preview iframe { width: 100%; height: 400px; border: none; border-radius: 8px; background: white; }
.error-text { color: var(--danger); margin-top: 16px; }

/* 404 page */
.notfound-card { background: var(--bg-card); border-radius: 16px; padding: 60px 30px; text-align: center; margin-top: 40px; border: 1px solid var(--border-hover); }
.notfound-icon { font-size: 4rem; color: var(--text-dim); margin-bottom: 20px; display: block; }
.notfound-card h2 { margin-bottom: 12px; }
.notfound-card p { color: var(--text-muted); margin-bottom: 28px; max-width: 400px; margin-left: auto; margin-right: auto; }

/* Promo section */
.promo-section { margin-top: 30px; }
.promo-card { background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg) 100%); border: 1px solid var(--border-hover); border-radius: 16px; padding: 36px 28px; text-align: center; }
.promo-icon { font-size: 2rem; color: var(--accent-light); margin-bottom: 14px; display: block; }
.promo-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.promo-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }

/* QR code */
.qr-section { text-align: center; margin: 18px 0 8px; }
#qr-canvas { border-radius: 8px; }
.qr-label { font-size: 0.8rem; color: var(--text-dim); margin-top: 8px; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay-bg); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); padding: 20px; }
.modal { background: var(--bg-card); border-radius: 16px; padding: 28px; max-width: 480px; width: 100%; border: 1px solid var(--border-hover); animation: modalIn 0.2s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h3 { font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.modal-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 18px; }
.share-link-box { display: flex; gap: 8px; margin-bottom: 14px; }
.modal-hint { color: var(--text-dim); font-size: 0.8rem; display: flex; align-items: center; gap: 6px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Toasts */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 10px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; animation: toastIn 0.3s ease-out; min-width: 240px; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.toast-success { background: var(--toast-success-bg); color: var(--toast-success-text); border: 1px solid var(--toast-success-border); }
.toast-error { background: var(--toast-error-bg); color: var(--toast-error-text); border: 1px solid var(--toast-error-border); }
.toast-info { background: var(--toast-info-bg); color: var(--toast-info-text); border: 1px solid var(--toast-info-border); }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* Footer */
footer { margin-top: auto; padding: 24px 0; text-align: center; color: var(--text-dimmer); font-size: 0.85rem; border-top: 1px solid var(--border); }
footer i { margin-right: 4px; }

/* Mobile */
@media (max-width: 600px) {
    .container { padding: 12px; }
    header { padding: 12px 0; margin-bottom: 20px; }
    .logo { font-size: 1.1rem; }
    .hero h2 { font-size: 1.6rem; }
    .hero p { font-size: 0.95rem; }
    .auth-buttons { flex-direction: column; align-items: center; }
    .upload-zone { padding: 35px 16px; }
    .file-meta { gap: 10px; }
    .file-actions { flex-direction: column; }
    .share-input { min-width: 100%; }
    .modal { padding: 20px; }
    #toast-container { bottom: 12px; right: 12px; left: 12px; }
    .toast { min-width: auto; }
    .dl-preview iframe { height: 250px; }
}
