/* ============================================
   Free FileHub - Modern Design
   ============================================ */
:root {
  --bg-deep: #070b14;
  --bg-main: #0b1020;
  --bg-card: #121a2f;
  --bg-card-hover: #18223a;
  --bg-elevated: #1a243d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-text: linear-gradient(135deg, #60a5fa, #a78bfa, #f472b6);
  --success: #10b981;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.25);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', 'DM Sans', sans-serif;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
.ambient { position: fixed; border-radius: 50%; filter: blur(120px); pointer-events: none; z-index: 0; opacity: 0.4; }
.ambient-one { width: 500px; height: 500px; background: radial-gradient(circle, rgba(59,130,246,0.25), transparent 70%); top: -150px; right: -100px; }
.ambient-two { width: 400px; height: 400px; background: radial-gradient(circle, rgba(139,92,246,0.2), transparent 70%); bottom: 10%; left: -100px; }
a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; display: block; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(7,11,20,0.85);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--gradient); border-radius: 10px; font-size: 1.1rem; font-weight: 700; color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.brand small { display: block; font-size: 0.65rem; font-weight: 500; color: var(--text-dim); letter-spacing: 0.04em; margin-top: 1px; }
.main-nav { display: flex; gap: 6px; }
.main-nav a { padding: 8px 16px; border-radius: 8px; font-size: 0.92rem; font-weight: 500; color: var(--text-muted); transition: all var(--transition); }
.main-nav a:hover, .main-nav a.active { color: var(--text); background: var(--primary-soft); }
.nav-cta {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
  background: var(--gradient); color: #fff !important; font-weight: 600; font-size: 0.9rem;
  border-radius: 10px; box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 22px rgba(59,130,246,0.45); }
.menu-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.5rem; cursor: pointer; }

/* Main */
.site-main { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 24px 60px; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 40px; align-items: center; padding: 60px 0 50px; }
.eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--primary); background: var(--primary-soft);
  padding: 5px 12px; border-radius: 20px; margin-bottom: 16px;
}
.hero h1 { font-family: var(--font-display); font-size: clamp(2.4rem, 5vw, 3.4rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.03em; margin-bottom: 18px; }
.gradient-text { background: var(--gradient-text); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { font-size: 1.08rem; color: var(--text-muted); max-width: 480px; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 36px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 24px;
  background: var(--gradient); color: #fff; font-weight: 600; font-size: 0.95rem;
  border-radius: 12px; box-shadow: 0 6px 20px rgba(59,130,246,0.35); border: none; cursor: pointer;
  transition: all var(--transition); font-family: inherit;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(59,130,246,0.5); }
.btn-secondary {
  display: inline-flex; align-items: center; padding: 13px 24px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  color: var(--text); font-weight: 600; font-size: 0.95rem; border-radius: 12px;
  transition: all var(--transition); cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.hero-stats { display: flex; gap: 32px; }
.hero-stats strong { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; display: block; }
.hero-stats span { font-size: 0.82rem; color: var(--text-dim); }

.hero-art { position: relative; height: 340px; display: flex; align-items: center; justify-content: center; }
.orb {
  width: 180px; height: 180px; border-radius: 50%; background: var(--gradient);
  display: grid; place-items: center;
  box-shadow: 0 0 80px rgba(59,130,246,0.4), 0 0 120px rgba(139,92,246,0.2);
  animation: float 6s ease-in-out infinite;
}
.orb-icon { font-size: 3rem; color: #fff; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }
.float-card {
  position: absolute; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-sm); animation: float 5s ease-in-out infinite;
}
.float-card b { display: block; font-size: 0.88rem; font-weight: 600; }
.float-card span { font-size: 0.75rem; color: var(--text-dim); }
.float-a { top: 30px; left: 10px; animation-delay: -1s; }
.float-b { bottom: 40px; right: 10px; animation-delay: -2.5s; }

/* Layout */
.layout-grid { display: grid; grid-template-columns: 1fr 300px; gap: 36px; margin-top: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; }
.section-head h2 { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; margin-top: 6px; }
.section-head p { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }
.text-link { font-size: 0.9rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.text-link:hover { color: #60a5fa; }

/* File Cards */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 48px; }
.file-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: all var(--transition);
}
.file-card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); background: var(--bg-card-hover); }
.file-thumb { position: relative; aspect-ratio: 16/10; background: var(--bg-elevated); overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.file-card:hover .file-thumb img { transform: scale(1.05); }
.thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; color: var(--text-dim); background: var(--bg-elevated); }
.file-card-body { padding: 16px 18px 18px; }
.tag {
  display: inline-block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--primary); background: var(--primary-soft);
  padding: 3px 9px; border-radius: 6px; margin-bottom: 8px;
}
.file-card-body h3 { font-size: 1.02rem; font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.file-card-body h3 a:hover { color: var(--primary); }
.file-card-body > p {
  font-size: 0.86rem; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 14px;
}
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; color: var(--text-dim); }
.card-meta a { font-weight: 600; color: var(--primary); }

/* Articles */
.article-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.article-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 20px; transition: all var(--transition);
}
.article-card:hover { border-color: var(--border-strong); background: var(--bg-card-hover); transform: translateY(-2px); }
.article-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); border-radius: 10px; font-size: 1.1rem; margin-bottom: 14px;
}
.article-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.article-card p { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 14px; }
.read-more { font-size: 0.85rem; font-weight: 600; color: var(--primary); }

/* Sidebar */
.sidebar-panel { position: sticky; top: 80px; align-self: start; }
.sidebar-heading { margin-bottom: 20px; }
.sidebar-heading h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; line-height: 1.25; margin-top: 6px; }
.search-form {
  display: flex; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; margin-bottom: 24px;
}
.search-form:focus-within { border-color: var(--primary); }
.search-form input {
  flex: 1; background: transparent; border: none; outline: none;
  padding: 12px 14px; color: var(--text); font-size: 0.92rem; font-family: inherit;
}
.search-form input::placeholder { color: var(--text-dim); }
.search-form button { background: transparent; border: none; color: var(--text-muted); padding: 0 14px; cursor: pointer; font-size: 1.1rem; }
.side-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 12px; }
.category-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 28px; }
.category-links a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; font-size: 0.92rem; font-weight: 500; color: var(--text-muted); transition: all var(--transition);
}
.category-links a:hover, .category-links a.active { background: var(--bg-card); color: var(--text); }
.category-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex-shrink: 0; }
.category-links a b { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); background: var(--bg-elevated); padding: 2px 8px; border-radius: 20px; }
.side-promo {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px; text-align: center;
}
.promo-icon {
  width: 44px; height: 44px; margin: 0 auto 12px; display: grid; place-items: center;
  background: var(--gradient); border-radius: 12px; font-size: 1.2rem; color: #fff;
}
.side-promo h4 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; }
.side-promo p { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 14px; }
.side-promo a { font-size: 0.88rem; font-weight: 600; color: var(--primary); }

/* Footer */
.footer { position: relative; z-index: 1; background: var(--bg-main); border-top: 1px solid var(--border); padding: 48px 28px 28px; margin-top: 40px; }
.footer-top { max-width: 1240px; margin: 0 auto 36px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.footer-copy { font-size: 0.9rem; color: var(--text-muted); max-width: 280px; }
.footer h4 { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 14px; }
.footer a { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 8px; }
.footer a:hover { color: var(--text); }
.footer-bottom {
  max-width: 1240px; margin: 0 auto; padding-top: 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; font-size: 0.84rem; color: var(--text-dim);
}

/* ========== POPUP (Restored) ========== */
.offer-popup-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(11, 16, 32, 0.75); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  z-index: 99999; display: flex; justify-content: center; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
.offer-popup-overlay.active { opacity: 1; visibility: visible; }
.offer-popup-card {
  background: #161f38; border: 1px solid rgba(255,255,255,0.15); border-radius: 16px;
  width: 90%; max-width: 450px; padding: 30px 25px; box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  text-align: center; position: relative; color: #fff;
  transform: scale(0.8); transition: transform 0.3s ease;
}
.offer-popup-overlay.active .offer-popup-card { transform: scale(1); }
.offer-popup-close {
  position: absolute; top: 12px; right: 15px; background: transparent; border: none;
  color: #a0aec0; font-size: 22px; font-weight: bold; cursor: pointer;
}
.offer-popup-close:hover { color: #fff; }
.offer-badge {
  display: inline-block; background: linear-gradient(135deg, #ff416c, #ff4b2b);
  color: #fff; font-size: 12px; font-weight: 700; text-transform: uppercase;
  padding: 5px 12px; border-radius: 20px; margin-bottom: 15px;
}
.offer-title { font-size: 22px; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
.offer-desc { font-size: 14px; color: #cbd5e1; margin-bottom: 25px; line-height: 1.5; }
.offer-btn {
  display: block; width: 100%; padding: 14px 20px;
  background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; font-weight: 700;
  font-size: 16px; text-decoration: none; border-radius: 8px;
  box-shadow: 0 4px 15px rgba(37,99,235,0.4); transition: transform 0.2s, box-shadow 0.2s;
}
.offer-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(37,99,235,0.6); }

/* File Detail Page */
.file-detail { max-width: 800px; margin: 40px auto; }
.file-detail-header { margin-bottom: 28px; }
.file-detail-header h1 { font-family: var(--font-display); font-size: 1.8rem; margin: 10px 0; }
.file-meta-row { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-muted); font-size: 0.9rem; margin-top: 12px; }
.file-desc { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; line-height: 1.7; color: var(--text-muted); }
.download-box {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center;
}
.download-box .file-size { font-size: 0.9rem; color: var(--text-dim); margin-bottom: 16px; }

/* Admin Styles */
.admin-body { background: var(--bg-deep); }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--bg-main); border-right: 1px solid var(--border);
  padding: 24px 16px; flex-shrink: 0;
}
.admin-sidebar .brand { margin-bottom: 32px; padding: 0 8px; }
.admin-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-radius: 10px; font-size: 0.92rem; font-weight: 500; color: var(--text-muted);
  margin-bottom: 4px; transition: all var(--transition);
}
.admin-nav a:hover, .admin-nav a.active { background: var(--primary-soft); color: var(--text); }
.admin-content { flex: 1; padding: 32px; overflow-x: auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.admin-header h1 { font-family: var(--font-display); font-size: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center;
}
.stat-card strong { display: block; font-size: 1.8rem; font-family: var(--font-display); margin-bottom: 4px; }
.stat-card span { font-size: 0.85rem; color: var(--text-dim); }
.admin-table {
  width: 100%; border-collapse: collapse; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--bg-elevated); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
.admin-table td { font-size: 0.9rem; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-card-hover); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; font-family: inherit; }
.btn-edit { background: var(--primary-soft); color: var(--primary); }
.btn-delete { background: rgba(239,68,68,0.15); color: #f87171; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px; background: var(--bg-main); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 0.95rem; font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { min-height: 120px; resize: vertical; }
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.alert-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  padding: 36px; max-width: 400px; width: 100%; box-shadow: var(--shadow);
}
.login-card h1 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 8px; text-align: center; }
.login-card p { color: var(--text-muted); text-align: center; margin-bottom: 24px; font-size: 0.9rem; }

/* Responsive */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0 30px; text-align: center; }
  .hero p { margin-left: auto; margin-right: auto; }
  .hero-actions, .hero-stats { justify-content: center; }
  .hero-art { height: 260px; order: -1; }
  .layout-grid { grid-template-columns: 1fr; }
  .sidebar-panel { position: static; order: -1; }
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .main-nav { display: none; }
  .menu-toggle { display: block; }
  body.nav-open .main-nav {
    display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg-main); border-bottom: 1px solid var(--border); padding: 12px; gap: 4px;
  }
  .nav-cta { display: none; }
  .site-main { padding: 0 16px 40px; }
  .file-grid { grid-template-columns: 1fr; }
  .footer { padding: 36px 16px 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
  .admin-content { padding: 20px 16px; }
}
.muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }