/* =====================================================================
   RewardTube — core stylesheet (no build step required)
   Theme palettes are driven by [data-theme] on <html>. Admin switches the
   active theme; the layout sets the attribute. 6 demo palettes included.
   ===================================================================== */

:root {
  --bg: #0f1523;
  --bg-elev: #161d2f;
  --bg-card: #1a2338;
  --border: #26314c;
  --text: #e7ecf5;
  --text-dim: #9aa7bd;
  --primary: #3b82f6;
  --primary-2: #2563eb;
  --accent: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --header-h: 64px;
}

/* ---- Theme: Carbon (pure dark) ---- */
[data-theme="carbon"] {
  --bg:#0a0a0b; --bg-elev:#131315; --bg-card:#17181b; --border:#2a2b30;
  --text:#f2f2f3; --text-dim:#9b9ca3; --primary:#6366f1; --primary-2:#4f46e5; --accent:#a855f7;
}
/* ---- Theme: Neon ---- */
[data-theme="neon"] {
  --bg:#0d0a1a; --bg-elev:#151030; --bg-card:#1b1440; --border:#2f2260;
  --text:#f3e9ff; --text-dim:#b3a3d6; --primary:#c026d3; --primary-2:#a21caf; --accent:#22d3ee;
  --shadow:0 8px 34px rgba(168,38,211,.25);
}
/* ---- Theme: Ocean ---- */
[data-theme="ocean"] {
  --bg:#07141a; --bg-elev:#0c2029; --bg-card:#0f2932; --border:#1c3f4c;
  --text:#e3f6fb; --text-dim:#8fb6bf; --primary:#06b6d4; --primary-2:#0891b2; --accent:#34d399;
}
/* ---- Theme: Sunset ---- */
[data-theme="sunset"] {
  --bg:#160f0c; --bg-elev:#241512; --bg-card:#2b1a15; --border:#472a20;
  --text:#fbeee6; --text-dim:#c6a595; --primary:#f97316; --primary-2:#ea580c; --accent:#f43f5e;
}
/* ---- Theme: Light (Daylight) ---- */
[data-theme="light"] {
  --bg:#f4f6fb; --bg-elev:#ffffff; --bg-card:#ffffff; --border:#e3e8f0;
  --text:#141a26; --text-dim:#5b6577; --primary:#2563eb; --primary-2:#1d4ed8; --accent:#0891b2;
  --shadow:0 8px 30px rgba(20,26,38,.08);
}

/* ---- Theme: Festival (colorful / vibrant, dark base) ---- */
[data-theme="festival"] {
  --bg:#160b2e; --bg-elev:#20123f; --bg-card:#291650; --border:#3d2270;
  --text:#f7ecff; --text-dim:#c4a9e8; --primary:#ff2d95; --primary-2:#d6006e; --accent:#00e5ff;
  --success:#2dd4bf; --warning:#ffd60a; --danger:#ff4d6d;
  --shadow:0 10px 38px rgba(255,45,149,.28);
}
[data-theme="festival"] body{
  background:
    radial-gradient(900px 500px at 8% -8%, rgba(255,45,149,.30), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(0,229,255,.22), transparent 55%),
    radial-gradient(1000px 600px at 50% 120%, rgba(124,58,237,.30), transparent 60%),
    #160b2e;
}
[data-theme="festival"] .btn-primary,
[data-theme="candy"] .btn-primary{ background:linear-gradient(135deg,#ff2d95,#7c3aed 55%,#00e5ff); }
[data-theme="festival"] .brand .logo-dot,
[data-theme="candy"] .brand .logo-dot{ background:linear-gradient(135deg,#ff2d95,#ffd60a 40%,#00e5ff); }
[data-theme="festival"] .site-header{ border-bottom-color:transparent;
  background:linear-gradient(90deg, color-mix(in srgb,#ff2d95 14%,var(--bg-elev)), color-mix(in srgb,#00e5ff 12%,var(--bg-elev))); }

/* ---- Theme: Candy (light & colorful) ---- */
[data-theme="candy"] {
  --bg:#fdf2fb; --bg-elev:#ffffff; --bg-card:#ffffff; --border:#f4d4ec;
  --text:#3a1140; --text-dim:#9b6a97; --primary:#e5006e; --primary-2:#c2005f; --accent:#7c3aed;
  --success:#10b981; --warning:#f59e0b; --danger:#ef4444;
  --shadow:0 10px 34px rgba(229,0,110,.14);
}
[data-theme="candy"] body{
  background:
    radial-gradient(800px 480px at 0% -10%, rgba(229,0,110,.12), transparent 60%),
    radial-gradient(800px 480px at 100% 0%, rgba(124,58,237,.12), transparent 55%),
    #fdf2fb;
}
[data-theme="candy"] .site-header{ background:linear-gradient(90deg,#fff0fa,#f3eeff); border-bottom-color:#f4d4ec; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }
*, *::before, *::after { box-sizing: border-box; }
img, video, iframe { max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"] body { direction: rtl; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.site-header .container { display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: -.3px; }
.brand .logo-dot { width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent)); }
.nav { display: flex; align-items: center; gap: 6px; margin-inline-start: 8px; }
.nav a { padding: 8px 12px; border-radius: 9px; color: var(--text-dim); font-weight: 600; font-size: 14px; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--bg-card); }
.header-spacer { flex: 1; }
.search-box { position: relative; flex: 0 1 320px; display: none; }
.search-box input { width: 100%; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); outline: none; }
.search-box input:focus { border-color: var(--primary); }

.points-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb,var(--primary) 22%,transparent), color-mix(in srgb,var(--accent) 18%,transparent));
  border: 1px solid color-mix(in srgb,var(--primary) 40%,transparent); font-weight: 700; font-size: 14px; }
.points-pill .coin { width: 16px; height: 16px; border-radius: 50%; background: var(--warning);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--warning) 60%, #000); }

/* ---------------- Buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font-weight: 700; font-size: 14px; transition: transform .05s ease, filter .15s ease; background: var(--bg-card); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-success { background: var(--success); color: #04220f; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Language dropdown ---------------- */
.lang { position: relative; }
.lang-toggle { cursor: pointer; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-card); font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.lang-menu { position: absolute; inset-inline-end: 0; top: 110%; width: 240px; max-height: 340px; overflow: auto;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; display: none; grid-template-columns: 1fr 1fr; gap: 2px; }
.lang-menu.open { display: grid; }
.lang-menu a { padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text-dim); display: flex; gap: 7px; }
.lang-menu a:hover { background: var(--bg-card); color: var(--text); }

/* ---------------- Hero slider ---------------- */
.hero { margin: 18px 0; border-radius: var(--radius); overflow: hidden; position: relative; box-shadow: var(--shadow); }
.slides { display: flex; transition: transform .5s ease; }
.slide { min-width: 100%; position: relative; }
.slide img { width: 100%; height: 360px; object-fit: cover; }
.slide-caption { position: absolute; inset-inline-start: 0; bottom: 0; padding: 28px;
  background: linear-gradient(0deg, rgba(0,0,0,.75), transparent); width: 100%; }
.slide-caption h2 { margin: 0 0 6px; font-size: 30px; color:#fff; }
.slide-caption p { margin: 0 0 14px; color: #dfe6f2; }
.slide-dots { position: absolute; bottom: 14px; inset-inline-end: 18px; display: flex; gap: 7px; }
.slide-dots button { width: 9px; height: 9px; border-radius: 50%; border: none; background: rgba(255,255,255,.45); cursor: pointer; }
.slide-dots button.active { background: #fff; }

/* ---------------- Sections & grid ---------------- */
.section { margin: 26px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 20px; margin: 0; }
.section-head a { color: var(--text-dim); font-weight: 600; font-size: 14px; }

.video-grid { display: grid; gap: 18px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px){ .video-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 820px){ .video-grid { grid-template-columns: repeat(2,1fr); } .search-box{display:none;} }
/* Mobile: exactly 2 columns as requested */
@media (max-width: 560px){ .video-grid { grid-template-columns: repeat(2,1fr); gap: 12px; } }

.vcard { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  transition: transform .12s ease, border-color .15s ease; }
.vcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb,var(--primary) 45%,var(--border)); }
.vthumb { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #000; }
.vthumb img, .vthumb video { width: 100%; height: 100%; object-fit: cover; }
.vthumb video { position: absolute; inset: 0; opacity: 0; transition: opacity .2s ease; }
.vcard:hover .vthumb video { opacity: 1; }
.vthumb .dur { position: absolute; bottom: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.8); color:#fff;
  font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.vthumb .reward { position: absolute; top: 8px; inset-inline-start: 8px; background: color-mix(in srgb,var(--warning) 90%,#000);
  color:#3a2600; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.vmeta { padding: 11px 12px 13px; }
.vmeta h3 { font-size: 14px; margin: 0 0 6px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.vmeta .sub { font-size: 12px; color: var(--text-dim); display: flex; gap: 8px; }

/* ---------------- Ad zone ---------------- */
.ad-zone { margin: 18px 0; text-align: center; }
.ad-zone .ad-label { font-size: 10px; letter-spacing: 1px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 5px; }
.ad-box { background: var(--bg-elev); border: 1px dashed var(--border); border-radius: 12px; padding: 10px;
  min-height: 90px; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* ---------------- Rewarded ad widget ---------------- */
.reward-panel { background: linear-gradient(135deg, var(--bg-elev), var(--bg-card)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.reward-panel h3 { margin: 0 0 4px; }
.reward-stage { aspect-ratio: 16/9; background:#000; border-radius: 12px; overflow: hidden; position: relative;
  display: flex; align-items: center; justify-content: center; margin: 14px 0; }
.reward-stage img, .reward-stage video, .reward-stage iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.reward-progress { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.reward-progress > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,var(--primary),var(--accent)); transition: width .3s linear; }

/* ---------------- Player page ---------------- */
.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; }
.player-wrap video, .player-wrap iframe { width: 100%; height: 100%; border: 0; }
.watch-status { margin-top: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-card); display: flex; align-items: center; gap: 12px; font-weight: 600; }
.watch-status .bar { flex: 1; height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.watch-status .bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg,var(--primary),var(--success)); }

.layout-2col { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
@media (max-width: 960px){ .layout-2col { grid-template-columns: 1fr; } }

/* ---------------- Cards / forms ---------------- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.input, select.input, textarea.input { width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); outline: none; font-size: 14px; }
.input:focus { border-color: var(--primary); }
.auth-wrap { max-width: 440px; margin: 40px auto; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.alert-success { background: color-mix(in srgb,var(--success) 18%,transparent); color: var(--success); border: 1px solid color-mix(in srgb,var(--success) 40%,transparent); }
.alert-error { background: color-mix(in srgb,var(--danger) 16%,transparent); color: var(--danger); border: 1px solid color-mix(in srgb,var(--danger) 40%,transparent); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--bg-elev); border: 1px solid var(--border); color: var(--text-dim); }

/* ---------------- Footer ---------------- */
.site-footer { margin-top: 50px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.site-footer .container { padding: 34px 16px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer h4 { font-size: 14px; margin: 0 0 12px; }
.site-footer a { display: block; color: var(--text-dim); font-size: 13px; padding: 4px 0; }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 16px; color: var(--text-dim); font-size: 13px; }
@media (max-width: 700px){ .site-footer .container { grid-template-columns: 1fr; } }

/* ---------------- Lottery / contest banner ---------------- */
.lottery-banner{display:flex;align-items:center;gap:14px;margin:16px 0;padding:12px 16px;border-radius:var(--radius);
  background:linear-gradient(90deg, color-mix(in srgb,var(--primary) 22%,var(--bg-card)), color-mix(in srgb,var(--accent) 16%,var(--bg-card)));
  border:1px solid color-mix(in srgb,var(--primary) 40%,var(--border));color:var(--text);}
.lottery-banner img{width:74px;height:52px;object-fit:cover;border-radius:8px;flex:0 0 auto;}
.lottery-banner .lb-body{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0;}
.lottery-banner .lb-tag{font-size:11px;font-weight:800;color:var(--accent);letter-spacing:.5px;}
.lottery-banner .lb-prize{font-size:13px;color:var(--text-dim);}
.lottery-banner .lb-count{text-align:center;flex:0 0 auto;}
.lottery-banner .lb-label{display:block;font-size:10px;color:var(--text-dim);text-transform:uppercase;letter-spacing:.5px;}
.lottery-banner .lb-time{font-weight:800;font-size:15px;color:var(--warning);}
.custom-html-zone{margin:12px 0;}

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-elev); border: 1px solid var(--border); border-inline-start: 4px solid var(--success);
  border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 700; animation: slidein .25s ease; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* mobile nav */
.menu-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 22px; cursor: pointer; }
@media (max-width: 820px){
  .menu-toggle { display: block; }
  /* Hidden by default; opens as a dropdown panel under the header. */
  .nav {
    display: none; position: fixed; inset-block-start: var(--header-h); inset-inline: 0;
    flex-direction: column; align-items: stretch; gap: 2px; margin: 0; padding: 10px 12px;
    background: var(--bg-elev); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    z-index: 60; max-height: calc(100vh - var(--header-h)); overflow: auto;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 15px; }
}
/* Compact header on phones so nothing overflows the viewport */
@media (max-width: 600px){
  .site-header .container { gap: 8px; }
  .brand { font-size: 17px; gap: 6px; }
  .brand .logo-dot { width: 22px; height: 22px; }
  .btn-sm { padding: 7px 10px; font-size: 12px; }
  .lang-toggle { padding: 6px 8px; font-size: 13px; }
  .lang-toggle span { display: none; }        /* keep flag + arrow only */
  .points-pill { padding: 6px 10px; }
}
@media (max-width: 380px){
  .brand span:last-child { display: none; }    /* logo dot only on tiny screens */
}
