/* ─── MediaVault Design System ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:wght@300;400;500&display=swap');

:root {
  --bg-0:       #0a0a0c;
  --bg-1:       #111115;
  --bg-2:       #18181e;
  --bg-3:       #22222a;
  --bg-4:       #2c2c38;
  --border:     rgba(255,255,255,0.07);
  --border-hi:  rgba(255,255,255,0.14);
  --accent:     #7c6dff;
  --accent-2:   #a78bfa;
  --accent-glow:rgba(124,109,255,0.25);
  --green:      #22c55e;
  --red:        #ef4444;
  --amber:      #f59e0b;
  --text-1:     #f0f0f5;
  --text-2:     #9898a8;
  --text-3:     #5c5c70;
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --font-head:  'Syne', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

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

/* ── Typography ──────────────────────────────────────────────────────────── */
h1,h2,h3,h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { color: var(--text-2); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.container    { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.page-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,12,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 24px;
}
.nav-brand {
  font-family: var(--font-head); font-weight: 800; font-size: 1.2rem;
  color: var(--text-1); text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.nav-brand .logo-mark {
  width: 30px; height: 30px; background: var(--accent);
  border-radius: 8px; display: grid; place-items: center; flex-shrink: 0;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 6px 14px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--text-1); background: var(--bg-3); }
.nav-actions { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
  background: #6b5ce8;
  box-shadow: 0 0 0 6px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-3); color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-4); border-color: var(--border-hi); }
.btn-ghost   { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text-1); background: var(--bg-3); }
.btn-danger  { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-icon { padding: 8px; gap: 0; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-hi); box-shadow: 0 8px 40px rgba(0,0,0,0.4); }
.card-body { padding: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }

/* ── Media Grid ──────────────────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.media-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.media-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--accent-glow); }
.media-thumb {
  aspect-ratio: 16/9; background: var(--bg-3);
  position: relative; overflow: hidden;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb .no-thumb {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  color: var(--text-3); font-size: 2rem;
}
.media-thumb .no-thumb span { font-size: 0.75rem; font-family: var(--font-body); }
.media-type-badge {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  padding: 3px 8px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 500; color: var(--text-1);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.media-type-badge.video { background: rgba(124,109,255,0.8); }
.media-type-badge.image { background: rgba(34,197,94,0.8); }
.media-card-body { padding: 14px; }
.media-title { font-size: 0.9rem; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.media-meta  { font-size: 0.78rem; color: var(--text-3); }
.media-actions { display: flex; gap: 6px; margin-top: 12px; }

/* Play overlay for videos */
.play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.3); opacity: 0; transition: opacity var(--transition);
}
.media-card:hover .play-overlay { opacity: 1; }
.play-btn-circle {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.9); display: flex; align-items: center; justify-content: center;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.85rem; font-weight: 500; color: var(--text-2); }
.form-input, .form-select, .form-textarea {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-1); font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-input::placeholder { color: var(--text-3); }
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Upload zone ─────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-hi); border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all var(--transition); background: var(--bg-1);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent); background: rgba(124,109,255,0.05);
}
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.upload-zone h3 { color: var(--text-1); margin-bottom: 6px; }
.upload-zone p  { font-size: 0.85rem; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity 200ms;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-2); border: 1px solid var(--border-hi);
  border-radius: var(--radius-xl); width: 100%; max-width: 660px;
  max-height: 92vh; overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: transform 200ms cubic-bezier(.34,1.56,.64,1);
}
.modal-backdrop.open .modal { transform: none; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-family: var(--font-head); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── URL copy box ────────────────────────────────────────────────────────── */
.url-copy-box {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden;
}
.url-copy-box input {
  flex: 1; background: none; border: none; padding: 9px 12px;
  color: var(--text-2); font-size: 0.82rem; font-family: monospace; outline: none;
}
.url-copy-btn {
  padding: 9px 14px; background: var(--bg-3); border: none; border-left: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; font-size: 0.82rem; font-weight: 500;
  transition: all var(--transition); white-space: nowrap; font-family: var(--font-body);
}
.url-copy-btn:hover { background: var(--accent); color: #fff; }
.url-copy-btn.copied { background: var(--green); color: #fff; }

/* ── Tags ────────────────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  padding: 3px 10px; border-radius: 100px;
  background: var(--bg-3); color: var(--text-2);
  font-size: 0.78rem; font-weight: 500; border: 1px solid var(--border);
}

/* ── Stats bar ───────────────────────────────────────────────────────────── */
.stats-bar { display: flex; gap: 2px; flex-wrap: wrap; }
.stat-pill {
  padding: 5px 14px; border-radius: 100px; font-size: 0.82rem; font-weight: 500;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; transition: all var(--transition);
}
.stat-pill:hover, .stat-pill.active { background: var(--bg-3); color: var(--text-1); border-color: var(--border-hi); }
.stat-pill .count { color: var(--accent); margin-left: 4px; }

/* ── Search ──────────────────────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-wrap .form-input { padding-left: 38px; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-wrap { height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress-bar  { height: 100%; background: var(--accent); border-radius: 2px; transition: width 200ms; width: 0%; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 18px; border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 500; color: var(--text-1);
  border: 1px solid var(--border); background: var(--bg-3);
  backdrop-filter: blur(12px);
  animation: toastIn 200ms cubic-bezier(.34,1.56,.64,1);
  max-width: 340px;
}
.toast.success { background: rgba(34,197,94,0.2); border-color: rgba(34,197,94,0.35); }
.toast.error   { background: rgba(239,68,68,0.2);  border-color: rgba(239,68,68,0.35); }
@keyframes toastIn { from { opacity:0; transform: translateX(20px); } }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.mt-2   { margin-top: 8px; }
.mt-4   { margin-top: 16px; }
.mt-6   { margin-top: 24px; }
.mt-8   { margin-top: 32px; }
.mb-2   { margin-bottom: 8px; }
.mb-4   { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; }
.hidden { display: none !important; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-2); }
.text-accent { color: var(--accent-2); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 24px; color: var(--text-3); }
.empty-state .icon { font-size: 3rem; display: block; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text-2); margin-bottom: 8px; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Login page ──────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-0); }
.login-card { width: 100%; max-width: 420px; }
.login-logo { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 40px; }
.login-logo .mark { width: 44px; height: 44px; background: var(--accent); border-radius: 12px; display: grid; place-items: center; }
.login-logo h1 { font-size: 1.8rem; }
.login-card .card-body { padding: 32px; }
.login-form { display: flex; flex-direction: column; gap: 20px; }
.error-msg { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 0.9rem; }

/* ── Admin header area ───────────────────────────────────────────────────── */
.page-head { padding: 36px 0 28px; border-bottom: 1px solid var(--border); margin-bottom: 32px; }
.page-head h2 { margin-bottom: 4px; }

/* ── Video player modal ──────────────────────────────────────────────────── */
.video-player-wrap { background: #000; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 16/9; }
.video-player-wrap video { width: 100%; height: 100%; display: block; }

/* ── Sidebar layout ──────────────────────────────────────────────────────── */
.admin-layout { display: flex; gap: 0; min-height: calc(100vh - 60px); }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg-1); border-right: 1px solid var(--border);
  padding: 24px 12px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: all var(--transition);
}
.sidebar-link:hover  { color: var(--text-1); background: var(--bg-3); }
.sidebar-link.active { color: var(--text-1); background: var(--bg-3); }
.sidebar-link .icon  { width: 18px; height: 18px; opacity: 0.7; }
.sidebar-section { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 12px 12px 4px; font-weight: 600; }
.main-content { flex: 1; padding: 32px; overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px 16px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
}
