/* ===== RemyTube — YouTube-style dark theme ===== */
:root {
  --bg: #0f0f0f;
  --bg-elev: #1a1a1a;
  --bg-elev2: #272727;
  --border: #303030;
  --text: #f1f1f1;
  --text-dim: #aaaaaa;
  --accent: #ff3d3d;
  --accent-2: #ff6a3d;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.muted { color: var(--text-dim); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,15,15,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; gap: 20px;
  max-width: 1600px; margin: 0 auto; padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; }
.brand-logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 15px; box-shadow: 0 4px 14px rgba(255,61,61,.4);
}
.brand-name { letter-spacing: -.5px; }

.search { flex: 1; max-width: 560px; display: flex; }
.search input {
  flex: 1; background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); padding: 11px 16px; border-radius: 999px 0 0 999px;
  font-size: 15px; outline: none;
}
.search input:focus { border-color: #555; }
.search button {
  background: var(--bg-elev2); border: 1px solid var(--border); border-left: none;
  color: var(--text); padding: 0 20px; border-radius: 0 999px 999px 0;
  cursor: pointer; font-size: 15px;
}
.search button:hover { background: #333; }

.top-actions { display: flex; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  cursor: pointer; border: 1px solid transparent; transition: .15s; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--bg-elev2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: #333; }
.btn-danger { background: #3a1414; color: #ff8a8a; border-color: #5a1e1e; }
.btn-danger:hover { background: #4a1919; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Page ---------- */
.page { max-width: 1600px; margin: 0 auto; padding: 28px 24px 60px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 22px; }
.section-head h1 { font-size: 22px; margin: 0; letter-spacing: -.4px; }

/* ---------- Video grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px 18px;
}
.card { cursor: pointer; }
.card-thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius);
  overflow: hidden; background: var(--bg-elev2);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-thumb img { transform: scale(1.05); }
.card-thumb .play-badge {
  position: absolute; inset: 0; display: grid; place-items: center;
  opacity: 0; transition: .2s; background: rgba(0,0,0,.25);
}
.card:hover .play-badge { opacity: 1; }
.play-badge span {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,61,61,.92); color: #fff; display: grid; place-items: center;
  font-size: 22px; padding-left: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.85); color: #fff; font-size: 12px; font-weight: 600;
  padding: 2px 6px; border-radius: 5px;
}
.card-body { display: flex; gap: 12px; padding: 12px 2px 0; }
.card-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
}
.card-meta { min-width: 0; }
.card-title {
  font-size: 15px; font-weight: 600; line-height: 1.35; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { font-size: 13px; color: var(--text-dim); line-height: 1.4; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 80px 20px; color: var(--text-dim);
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-elev);
}
.empty .big { font-size: 52px; margin-bottom: 14px; }
.empty h2 { color: var(--text); margin: 0 0 8px; }

/* ---------- Watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0,1fr) 380px; gap: 34px; align-items: start; }
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.player-wrap video { width: 100%; display: block; aspect-ratio: 16/9; background: #000; }
.watch-title { font-size: 22px; margin: 20px 0 10px; line-height: 1.3; }
.watch-stats {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: var(--text-dim); font-size: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.channel-row { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.channel-row .card-avatar { width: 44px; height: 44px; font-size: 18px; }
.channel-name { font-weight: 600; }
.desc-box {
  background: var(--bg-elev); border-radius: 12px; padding: 16px; margin-top: 6px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; color: #ddd;
}
.side-title { font-size: 16px; margin: 0 0 14px; }
.side-list { display: flex; flex-direction: column; gap: 10px; }
.side-item { display: flex; gap: 10px; }
.side-item .st-thumb { flex: none; width: 168px; aspect-ratio: 16/9; border-radius: 10px; overflow: hidden; background: var(--bg-elev2); }
.side-item .st-thumb img { width: 100%; height: 100%; object-fit: cover; }
.side-item .st-meta { min-width: 0; }
.side-item .st-title { font-size: 14px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.side-item .st-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.back-link { display: inline-block; color: var(--text-dim); margin-bottom: 16px; font-size: 14px; }
.back-link:hover { color: var(--text); }

/* ---------- Auth / forms ---------- */
.auth-wrap { max-width: 420px; margin: 60px auto; }
.card-panel { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.card-panel h1 { margin: 0 0 6px; font-size: 24px; }
.card-panel .sub { color: var(--text-dim); margin: 0 0 24px; font-size: 14px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: #ccc; }
.field input, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: 10px; font-size: 15px; font-family: inherit; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 110px; }
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: #3a1414; color: #ff9a9a; border: 1px solid #5a1e1e; }
.alert-ok { background: #123222; color: #8ff0bd; border: 1px solid #1e5a3c; }

/* ---------- Admin dashboard ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.admin-head h1 { margin: 0; font-size: 26px; }
.stats { display: flex; gap: 14px; }
.stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; padding: 14px 22px; text-align: center; }
.stat .num { font-size: 24px; font-weight: 800; }
.stat .lbl { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; }

.admin-grid { display: grid; grid-template-columns: 400px 1fr; gap: 28px; align-items: start; }

.upload-panel .drop {
  border: 2px dashed var(--border); border-radius: 12px; padding: 26px; text-align: center;
  color: var(--text-dim); cursor: pointer; transition: .15s; background: var(--bg);
}
.upload-panel .drop:hover, .upload-panel .drop.drag { border-color: var(--accent); color: var(--text); background: #1c1414; }
.upload-panel .drop .big { font-size: 34px; margin-bottom: 8px; }
.file-name { margin-top: 10px; font-size: 13px; color: #9fe6b0; word-break: break-all; }

.progress-wrap { display: none; margin-top: 16px; }
.progress-wrap.show { display: block; }
.progress-bar { height: 10px; background: var(--bg-elev2); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.progress-text { font-size: 13px; color: var(--text-dim); margin-top: 8px; text-align: center; }

.vlist { display: flex; flex-direction: column; gap: 12px; }
.vrow {
  display: flex; gap: 14px; align-items: center; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px;
}
.vrow .vthumb { flex: none; width: 130px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--bg-elev2); }
.vrow .vthumb img { width: 100%; height: 100%; object-fit: cover; }
.vrow .vinfo { flex: 1; min-width: 0; }
.vrow .vinfo h3 { margin: 0 0 4px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow .vinfo .vsub { font-size: 12px; color: var(--text-dim); }
.vrow .vactions { display: flex; gap: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .watch { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px 14px; gap: 12px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .page { padding: 20px 14px 50px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 12px; }
  .card-body { gap: 8px; }
  .card-avatar { width: 30px; height: 30px; font-size: 13px; }
  .brand-name { font-size: 18px; }
  .side-item .st-thumb { width: 130px; }
}
