:root {
  --bg:      #0a0a0a;
  --bg2:     #111111;
  --bg3:     #1a1a1a;
  --bg4:     #222222;
  --border:  #2a2a2a;
  --border2: #333333;
  --accent:  #e8c84a;
  --accent2: #c9a82a;
  --text:    #e8e4dc;
  --text2:   #999;
  --text3:   #666;
  --red:     #c0392b;
  --green:   #27ae60;
  --font-title: 'Bebas Neue', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --font-mono:  'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(232,200,74,0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.hidden { display: none !important; }
.page { display: none; min-height: calc(100vh - 64px); padding-top: 64px; }
.page.active { display: block; }

/* BUTTONS */
.btn-primary {
  background: var(--accent); color: #000; border: none;
  padding: 10px 24px; font-family: var(--font-title);
  font-size: 15px; letter-spacing: 1.5px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-outline {
  background: transparent; color: var(--text);
  border: 1px solid var(--border2); padding: 8px 18px;
  font-family: var(--font-body); font-size: 13px;
  cursor: pointer; transition: all 0.2s;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-back {
  background: none; border: none; color: var(--text2);
  font-family: var(--font-mono); font-size: 12px;
  cursor: pointer; padding: 8px 0; transition: color 0.2s;
}
.btn-back:hover { color: var(--accent); }

.btn-danger {
  background: transparent; color: var(--red);
  border: 1px solid var(--red); padding: 5px 12px;
  font-size: 12px; font-family: var(--font-mono);
  cursor: pointer; transition: all 0.2s;
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-edit {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); padding: 5px 12px;
  font-size: 12px; font-family: var(--font-mono);
  cursor: pointer; transition: all 0.2s;
}
.btn-edit:hover { background: var(--accent); color: #000; }

.btn-copy {
  background: var(--bg4); border: 1px solid var(--border2);
  color: var(--text2); padding: 4px 10px;
  font-size: 11px; font-family: var(--font-mono);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-copy:hover { color: var(--accent); border-color: var(--accent); }

/* HEADER */
#main-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: 64px; background: rgba(10,10,10,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); z-index: 100;
}
.header-inner {
  max-width: 1400px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; padding: 0 32px; gap: 32px;
}
.header-logo { cursor: pointer; user-select: none; display: flex; align-items: center; }
.header-svg-logo { width: 148px; height: auto; }

nav { display: flex; gap: 4px; flex: 1; }
.nav-btn {
  background: none; border: none; color: var(--text3);
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 1px; padding: 6px 14px;
  cursor: pointer; transition: color 0.2s; text-transform: uppercase;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
#user-badge {
  font-family: var(--font-mono); font-size: 11px; color: var(--accent);
  background: rgba(232,200,74,0.1); padding: 4px 10px;
  border: 1px solid rgba(232,200,74,0.2);
}

/* AUTH OVERLAY */
#auth-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px); z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.auth-box {
  background: var(--bg2); border: 1px solid var(--border2);
  padding: 48px; width: 360px;
  display: flex; flex-direction: column; gap: 16px;
  animation: fadeUp 0.3s ease;
}
.auth-logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 8px; }
.auth-svg-logo { width: 220px; height: auto; }
.auth-payoff {
  font-family: var(--font-body); font-size: 12px; font-weight: 300;
  color: var(--text3); letter-spacing: 0.5px; text-align: center;
  font-style: italic;
}
.auth-subtitle { text-align: center; color: var(--text3); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; font-family: var(--font-mono); margin-bottom: 8px; }

/* FORMS */
input[type="text"], input[type="password"], textarea, select {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 10px 14px;
  font-family: var(--font-body); font-size: 14px;
  outline: none; width: 100%; transition: border-color 0.2s; resize: vertical;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select option { background: var(--bg3); }
.form-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.form-row .form-input { flex: 1; min-width: 140px; }
.error-msg { color: #e74c3c; font-size: 12px; font-family: var(--font-mono); text-align: center; }
.msg { font-size: 13px; font-family: var(--font-mono); padding: 8px 12px; margin-top: 8px; }
.msg.success { color: var(--green); border-left: 2px solid var(--green); }
.msg.error   { color: var(--red);   border-left: 2px solid var(--red); }
.hint { color: var(--text3); font-size: 13px; margin-bottom: 16px; }

/* HOME */
.hero-bar {
  max-width: 1400px; margin: 0 auto;
  padding: 48px 32px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.hero-bar h1 { font-family: var(--font-title); font-size: 48px; letter-spacing: 6px; }
.search-wrap { flex: 1; max-width: 360px; }
.search-wrap input { background: var(--bg2); }

.video-grid {
  max-width: 1400px; margin: 0 auto; padding: 0 32px 64px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2px;
}
.loading-state {
  grid-column: 1 / -1; color: var(--text3);
  font-family: var(--font-mono); font-size: 13px;
  padding: 64px 0; text-align: center;
}

.video-card {
  background: var(--bg2); cursor: pointer;
  position: relative; overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  animation: fadeUp 0.4s ease both;
}
.video-card:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(0,0,0,0.5); z-index: 2; }

.video-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--bg3); }
.video-thumb-placeholder {
  width: 100%; aspect-ratio: 16/9; background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 40px;
}
.video-card-info { padding: 14px 16px 16px; }
.video-card-title {
  font-family: var(--font-title); font-size: 18px; letter-spacing: 1px;
  color: var(--text); margin-bottom: 6px; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-card-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text3); display: flex; gap: 12px; }
.video-duration {
  position: absolute; bottom: 74px; right: 10px;
  background: rgba(0,0,0,0.8); color: var(--text);
  font-family: var(--font-mono); font-size: 11px; padding: 2px 7px;
}
.play-overlay {
  position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 16/9;
  background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.video-card:hover .play-overlay { opacity: 1; }
.play-icon {
  width: 56px; height: 56px; border: 2px solid var(--accent); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 20px; padding-left: 4px;
}

/* WATCH */
.watch-layout { max-width: 1100px; margin: 0 auto; padding: 48px 32px 64px; }
.video-container { width: 100%; background: #000; aspect-ratio: 16/9; margin-bottom: 24px; }
#main-video { width: 100%; height: 100%; display: block; }
.video-meta { margin-bottom: 24px; }
.video-meta h2 { font-family: var(--font-title); font-size: 36px; letter-spacing: 2px; margin-bottom: 10px; }
.video-stats { display: flex; gap: 20px; font-family: var(--font-mono); font-size: 12px; color: var(--text3); margin-bottom: 12px; }
#watch-description { color: var(--text2); font-size: 14px; line-height: 1.7; border-left: 2px solid var(--border2); padding-left: 16px; }

/* ADMIN */
.admin-layout { max-width: 1100px; margin: 0 auto; padding: 48px 32px 64px; }
.admin-tabs { display: flex; gap: 2px; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.tab-btn {
  background: none; border: none; color: var(--text3);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 1px;
  padding: 10px 20px; cursor: pointer; text-transform: uppercase;
  transition: color 0.2s; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.admin-card {
  background: var(--bg2); border: 1px solid var(--border);
  padding: 32px; display: flex; flex-direction: column; gap: 20px;
}
.admin-card h3 { font-family: var(--font-title); font-size: 22px; letter-spacing: 2px; color: var(--accent); }

/* UPLOAD */
.upload-zone {
  border: 2px dashed var(--border2); padding: 48px 32px;
  text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--accent); background: rgba(232,200,74,0.04); }
.upload-icon { font-size: 32px; color: var(--accent); margin-bottom: 12px; }
.upload-text { color: var(--text2); font-size: 14px; line-height: 1.8; }
.upload-text span { color: var(--text3); font-size: 13px; }
.upload-zone.has-file { border-color: var(--green); background: rgba(39,174,96,0.04); }
.upload-zone.has-file .upload-icon { color: var(--green); }
.progress-bar { height: 3px; background: var(--border); overflow: hidden; flex: 1; }
#progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; width: 0%; }
#progress-label { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
#upload-progress { display: flex; align-items: center; gap: 12px; }

/* LIST */
.list-container { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; background: var(--bg3);
  border: 1px solid var(--border); transition: border-color 0.2s;
}
.list-item:hover { border-color: var(--border2); }
.list-item-thumb { width: 80px; height: 45px; object-fit: cover; background: var(--bg4); flex-shrink: 0; }
.list-item-info { flex: 1; min-width: 0; }
.list-item-title { font-family: var(--font-title); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-top: 3px; }
.list-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.user-badge-role { font-family: var(--font-mono); font-size: 10px; padding: 2px 8px; border: 1px solid var(--border2); color: var(--text3); }
.user-badge-role.admin { color: var(--accent); border-color: var(--accent); }

/* LINK BOX */
.link-box {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg3); border: 1px solid var(--border);
  flex-wrap: wrap;
}
.link-box-info { display: flex; flex-direction: column; gap: 2px; min-width: 140px; flex-shrink: 0; }
.link-label { font-size: 13px; color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.link-user-tag { font-size: 11px; color: var(--accent); font-family: var(--font-mono); opacity: 0.8; }
.link-url { font-family: var(--font-mono); font-size: 11px; color: var(--text3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* MODAL */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border2);
  padding: 40px; width: 480px;
  display: flex; flex-direction: column; gap: 16px;
  animation: fadeUp 0.25s ease;
}
.modal-box h3 { font-family: var(--font-title); font-size: 22px; letter-spacing: 2px; color: var(--accent); }
.modal-user-info { font-family: var(--font-mono); font-size: 13px; color: var(--text2); margin: -4px 0 4px; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .hero-bar { padding: 32px 16px 24px; }
  .hero-bar h1 { font-size: 32px; }
  .video-grid { padding: 0 16px 48px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .watch-layout, .admin-layout { padding: 24px 16px 48px; }
  .admin-card { padding: 20px; }
  .form-row { flex-direction: column; }
  .form-row .form-input { width: 100%; }
  .link-box { flex-wrap: wrap; }
}
