/* ===========================================================
   GOLDEN SCRIPTS — Media Host UI v2
   =========================================================== */
:root {
  --bg:          #050507;
  --bg-1:        #0c0c11;
  --bg-2:        #14141b;
  --bg-3:        #1c1c25;
  --line:        rgba(255,255,255,0.08);
  --line-hot:    rgba(255,255,255,0.14);
  --text:        #f6f6f8;
  --text-muted:  #a4a4ad;
  --text-soft:   #6e6e78;
  --gold:        #f5b700;
  --gold-bright: #ffce29;
  --gold-deep:   #c98f00;
  --red:         #ef4444;
  --red-deep:    #dc2626;
  --green:       #10b981;
  --grad-gold:   linear-gradient(135deg, #ffce29, #f5b700 55%, #c98f00);
  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

/* CRITICAL — keep [hidden] working even when other display rules exist */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(245,183,0,0.10), transparent 65%),
    radial-gradient(900px 600px at 80% 90%, rgba(220,38,38,0.07), transparent 65%);
}
.screen { position: relative; z-index: 1; }
::selection { background: var(--gold); color: #0a0a0a; }

/* =========================================================== BOOT ======= */
#boot-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
  z-index: 1000;
}
.boot-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,206,41,0.15);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================== AUTH ======= */
#login-screen, #setup-screen {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 24px;
  text-align: center;
  isolation: isolate;
}
.auth-card.wide { max-width: 500px; }
.auth-card::before {
  content: ""; position: absolute; inset: -1px;
  border-radius: inherit; padding: 1px;
  background: conic-gradient(from 140deg, transparent 0deg, var(--gold-bright) 90deg, transparent 180deg, var(--red-deep) 270deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.5;
  animation: conic-spin 14s linear infinite;
  pointer-events: none;
}
@keyframes conic-spin { to { transform: rotate(360deg); } }

.auth-logo {
  width: 60px; height: 60px;
  margin: 0 auto 20px;
  display: grid; place-items: center;
  background: rgba(255,206,41,0.12);
  border: 1px solid rgba(255,206,41,0.4);
  border-radius: 18px;
  color: var(--gold-bright);
  box-shadow: 0 12px 30px -10px rgba(245,183,0,0.45);
}
.auth-logo svg { width: 28px; height: 28px; }

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff, var(--gold-bright) 80%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.auth-sub {
  margin: 0 0 28px;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

#login-form, #setup-form {
  display: flex; flex-direction: column; gap: 12px;
}
.auth-card input,
.auth-card button {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(255,206,41,0.2);
}
.auth-card button {
  background: var(--grad-gold);
  color: #0a0a0a;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  margin-top: 6px;
  box-shadow:
    0 0 0 1px rgba(255,206,41,0.4) inset,
    0 12px 28px -10px rgba(245,183,0,0.5);
}
.auth-card button:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255,206,41,0.6) inset,
    0 16px 36px -10px rgba(245,183,0,0.65);
}
.auth-card button:disabled {
  opacity: 0.55; cursor: not-allowed; transform: none;
}

.password-meter {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
  margin-top: 2px;
}
.meter-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 999px; overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0;
  background: var(--red);
  border-radius: 999px;
  transition: width 0.25s, background 0.25s;
}
.meter-fill.weak   { background: var(--red); }
.meter-fill.fair   { background: #f59e0b; }
.meter-fill.strong { background: var(--green); }
.meter-fill.elite  { background: var(--grad-gold); }

.error {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.30);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 13px;
  text-align: left;
}

/* =========================================================== ADMIN ====== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 16px 32px;
  background: rgba(5,5,7,0.85);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px;
  letter-spacing: -0.01em;
}
.brand svg { width: 22px; height: 22px; color: var(--gold-bright); }
.stats {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
  font-size: 13px; color: var(--text-muted);
}
.stat-item span { color: var(--gold-bright); font-weight: 700; }
.stat-divider { color: var(--text-soft); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--line-hot);
  color: var(--text);
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.btn-ghost svg { width: 14px; height: 14px; }
.btn-ghost:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: rgba(255,206,41,0.06);
}

/* Owner dropdown */
.owner-menu { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  min-width: 240px;
  background: var(--bg-2);
  border: 1px solid var(--line-hot);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.55);
  z-index: 30;
  animation: dropdown-in 0.18s var(--ease);
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dropdown-info {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.dropdown-label {
  margin: 0; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700;
}
.dropdown-value {
  margin: 4px 0 2px;
  font-size: 14px; font-weight: 600; color: var(--text);
  word-break: break-all;
}
.dropdown-meta {
  margin: 0; font-size: 12px; color: var(--text-muted);
}
.dropdown-item {
  display: block; width: 100%;
  padding: 11px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  text-align: left;
  font: inherit; font-size: 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.dropdown-item:hover { background: var(--bg-3); }
.dropdown-danger { color: #fca5a5; }
.dropdown-danger:hover { background: rgba(239,68,68,0.10); color: var(--red); }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

/* DROPZONE */
.dropzone {
  position: relative;
  padding: 48px 32px;
  border: 2px dashed var(--line-hot);
  border-radius: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  margin-bottom: 28px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(245,183,0,0.06), var(--bg-1));
}
.drop-icon { width: 44px; height: 44px; color: var(--gold-bright); margin-bottom: 12px; }
.dropzone h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--text); }
.dropzone p { margin: 0; font-size: 13px; color: var(--text-muted); }
.upload-progress { margin-top: 18px; }
.bar { height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.bar-fill { height: 100%; width: 0; background: var(--grad-gold); border-radius: 999px; transition: width 0.2s ease; }
#progress-label { font-size: 12px; color: var(--text-muted); margin: 0; }

/* TOOLBAR */
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
#search-input {
  flex: 1; min-width: 200px;
  padding: 12px 16px;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px; font-family: inherit;
}
#search-input:focus { outline: none; border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(255,206,41,0.15); }
.filter-group {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.filter {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600; font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.filter.active { background: var(--bg-3); color: var(--text); }
.filter:not(.active):hover { color: var(--text); }

/* FILE GRID */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.file-card {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}
.file-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,206,41,0.35);
  box-shadow: 0 20px 40px -20px rgba(245,183,0,0.4);
}
.file-preview {
  aspect-ratio: 16/10;
  background: var(--bg);
  display: grid; place-items: center;
  overflow: hidden; position: relative;
}
.file-preview img, .file-preview video { width: 100%; height: 100%; object-fit: cover; }
.file-preview .video-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 8px;
  background: rgba(5,5,7,0.7);
  border: 1px solid var(--line-hot);
  border-radius: 6px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--gold-bright);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.file-preview .placeholder { color: var(--text-soft); font-size: 12px; }

.file-meta { padding: 14px 14px 12px; }
.file-name {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin: 0 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-info { font-size: 11px; color: var(--text-soft); margin: 0; display: flex; gap: 6px; }
.file-info .dot { color: var(--text-soft); }

.file-actions { display: flex; gap: 6px; padding: 0 12px 12px; }
.file-actions button {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text);
  font-size: 12px; font-weight: 600; font-family: inherit;
  border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.file-actions .btn-copy:hover {
  border-color: var(--gold-bright); color: var(--gold-bright);
  background: rgba(255,206,41,0.06);
}
.file-actions .btn-delete:hover {
  border-color: var(--red); color: var(--red);
  background: rgba(239,68,68,0.06);
}
.file-actions svg { width: 13px; height: 13px; }

.empty-state {
  padding: 80px 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(5,5,7,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: 100%; max-width: 440px;
  padding: 36px 32px 28px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 20px;
  animation: modal-in 0.22s var(--ease);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px;
  background: transparent; border: none;
  font-size: 28px; line-height: 1;
  color: var(--text-soft); cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-card h2 {
  margin: 0 0 22px;
  font-size: 20px; font-weight: 700;
  color: var(--text);
}
#password-form {
  display: flex; flex-direction: column; gap: 12px;
}
#password-form input,
#password-form button {
  padding: 13px 16px;
  border-radius: 11px;
  font-size: 14px; font-family: inherit;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}
#password-form input:focus {
  outline: none;
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 3px rgba(255,206,41,0.2);
}
#password-form button {
  background: var(--grad-gold);
  color: #0a0a0a; font-weight: 700;
  border: none; cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 0 0 1px rgba(255,206,41,0.4) inset, 0 8px 22px -8px rgba(245,183,0,0.5);
}
#password-form button:hover { transform: translateY(-1px); }
.modal-note {
  margin: 16px 0 0;
  font-size: 12px; color: var(--text-soft);
  text-align: center; line-height: 1.5;
}

/* TOASTS */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100; pointer-events: none;
}
.toast {
  padding: 12px 18px;
  background: var(--bg-2);
  border: 1px solid var(--line-hot);
  border-radius: 10px;
  color: var(--text);
  font-size: 13px; font-weight: 500;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
  animation: toast-in 0.3s var(--ease);
  max-width: 360px;
  pointer-events: auto;
}
.toast.success { border-color: rgba(16,185,129,0.4); }
.toast.success::before { content: "✓ "; color: var(--green); font-weight: 700; }
.toast.error { border-color: rgba(239,68,68,0.4); }
.toast.error::before { content: "✗ "; color: var(--red); font-weight: 700; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .topbar { padding: 14px 18px; gap: 12px; flex-wrap: wrap; }
  .stats { margin-left: 0; order: 3; flex-basis: 100%; }
  .container { padding: 20px 16px; }
  .dropzone { padding: 32px 18px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .toast-container { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .dropdown { right: -8px; }
  #owner-email-tag { display: none; }
}
