/* ===== TUBEGRAM shared theme — colourful, glassy, 3D-ish ===== */

:root {
  --c1: #7b2ff7;   /* purple  */
  --c2: #ff3b5c;   /* pink/red */
  --c3: #ffb63e;   /* orange  */
  --c4: #12c2e9;   /* cyan    */
  --bg-deep: #0b0a17;
  --panel: rgba(255,255,255,0.05);
  --panel-border: rgba(255,255,255,0.10);
  --text: #f2f2f7;
  --text-dim: #a9a7bd;
  --grad-main: linear-gradient(135deg, var(--c1), var(--c2) 55%, var(--c3));
  --grad-cool: linear-gradient(135deg, var(--c4), var(--c1));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg-deep);
}

/* animated colourful backdrop glow, sits behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 8%, rgba(123,47,247,0.35), transparent 40%),
    radial-gradient(circle at 88% 15%, rgba(255,59,92,0.30), transparent 45%),
    radial-gradient(circle at 25% 90%, rgba(18,194,233,0.25), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255,182,62,0.25), transparent 40%),
    var(--bg-deep);
  background-repeat: no-repeat;
}

a { color: inherit; }

/* ---------- header ---------- */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(20, 16, 34, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.logo {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo img { width: 26px; height: 26px; border-radius: 8px; display: block; }
.logo span {
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header .nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  padding: 7px 16px;
  border-radius: 20px;
  transition: all .2s ease;
  background: var(--panel);
}
header .nav-link:hover { color: #fff; border-color: var(--c2); box-shadow: 0 0 14px rgba(255,59,92,.45); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  background: var(--grad-main);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(255,59,92,.35), 0 2px 0 rgba(255,255,255,.15) inset;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(255,59,92,.5), 0 2px 0 rgba(255,255,255,.2) inset; }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 8px; }
.btn-secondary { background: rgba(255,255,255,0.08); box-shadow: none; border: 1px solid var(--panel-border); }
.btn-secondary:hover { background: rgba(255,255,255,0.14); box-shadow: 0 0 14px rgba(255,255,255,.15); }
.btn-danger { background: linear-gradient(135deg, #7a1030, #cc2b4e); }
.btn-danger:hover { box-shadow: 0 10px 26px rgba(204,43,78,.5); }

/* ---------- containers ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }

/* ---------- portrait / reels-style grid (TikTok-like tiles) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transform-style: preserve-3d;
  perspective: 800px;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
}
.card:hover {
  transform: translateY(-6px) rotateX(4deg) rotateY(-4deg) scale(1.02);
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 18px 40px rgba(123,47,247,.35), 0 0 0 1px rgba(255,255,255,.08) inset;
}

.thumb {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  position: relative;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad-main);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.thumb .play-badge svg { width: 13px; height: 13px; fill: #fff; margin-left: 2px; }

.card-body { padding: 12px 13px 15px; }
.card-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty { text-align: center; padding: 80px 20px; color: var(--text-dim); }

/* ---------- TikTok-style vertical player (watch page) ---------- */
.reel-wrap {
  max-width: 420px;
  margin: 28px auto;
  padding: 0 16px;
}
.reel {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(123,47,247,.35), 0 0 0 1px rgba(255,255,255,.08) inset, 0 0 40px rgba(255,59,92,.15);
}
.reel video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.reel-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 16px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  pointer-events: none;
}
.reel-info h1 { font-size: 16px; margin: 0 0 6px; }
.reel-info .meta { font-size: 12px; color: #ddd; display: flex; gap: 14px; }

.desc-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 16px;
  font-size: 14px;
  color: #dcdce6;
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: 16px;
}

/* ---------- forms (admin) ---------- */
label { display: block; font-size: 13px; color: var(--text-dim); margin: 16px 0 6px; }
input[type=text], input[type=password], input[type=number], textarea, input[type=datetime-local], input[type=file] {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 14px;
}
input:focus, textarea:focus { outline: none; border-color: var(--c2); box-shadow: 0 0 0 3px rgba(255,59,92,.2); }
textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.hint { font-size: 12px; color: #777; margin-top: 4px; }
.err { background: rgba(204,43,78,.15); border: 1px solid rgba(204,43,78,.5); color: #ff8fa3; padding: 10px; border-radius: 10px; font-size: 13px; margin-top: 16px; }
.ok  { background: rgba(46,204,113,.12); border: 1px solid rgba(46,204,113,.45); color: #7ee6a6; padding: 10px; border-radius: 10px; font-size: 13px; margin-top: 16px; }

/* ---------- admin table ---------- */
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 16px; overflow: hidden; }
th, td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--panel-border); }
th { color: var(--text-dim); font-weight: 700; background: rgba(255,255,255,.03); }
tr:last-child td { border-bottom: none; }
.thumb-sm { width: 46px; height: 70px; object-fit: cover; border-radius: 8px; background: #000; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* login / setup box */
.auth-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 34px;
  border-radius: 22px;
  width: 340px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5), 0 0 40px rgba(123,47,247,.2);
}
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box h1 { font-size: 20px; margin: 0 0 24px; text-align: center; }
