/* =====================================================================
   StreamHub — Public Site Stylesheet
   Modern, responsive, dark-themed video platform UI.
   ===================================================================== */

:root {
  --bg: #0d0e14;
  --bg-alt: #14161f;
  --surface: #1a1d29;
  --surface-hover: #21243333;
  --border: #2a2d3d;
  --text: #eef0f6;
  --text-muted: #9a9db3;
  --primary: #6366f1;
  --primary-hover: #7d80f5;
  --accent: #22d3ee;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --max-width: 1280px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 700; line-height: 1.25; }
p { margin: 0 0 1em; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #8385f7); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-hover), #9294f8); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-block { width: 100%; justify-content: center; }

/* ---- Pills / tags ---- */
.pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(99,102,241,0.15);
  color: #a5a7f9;
  font-size: 0.78rem;
  font-weight: 600;
}
.pill-accent { background: rgba(34,211,238,0.18); color: var(--accent); }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,14,20,0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
}
.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}
.search-form {
  flex: 1;
  display: flex;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.search-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  padding: 10px 16px;
  font-size: 0.92rem;
}
.search-form button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0 16px;
  cursor: pointer;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
  font-weight: 600;
  font-size: 0.94rem;
}
.main-nav a { color: var(--text-muted); transition: color 0.15s; }
.main-nav > a:hover { color: var(--text); }
.dropdown { position: relative; }
.dropdown-toggle {
  background: none; border: none; color: var(--text-muted);
  font-weight: 600; font-size: 0.94rem; cursor: pointer; font-family: inherit;
}
.dropdown-menu {
  position: absolute;
  top: 130%;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  min-width: 200px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: all 0.15s ease;
}
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown-menu a {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-weight: 500;
}
.dropdown-menu a:hover { background: var(--bg-alt); }
.dropdown-menu .count { color: var(--text-muted); font-weight: 400; }
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span { width: 22px; height: 2px; background: var(--text); }

/* ---- Hero ---- */
.hero { padding: 28px 0 10px; }
.hero-card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 380px;
  background: var(--surface);
}
.hero-card img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.hero-overlay {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px;
  background: linear-gradient(0deg, rgba(10,10,15,0.95) 5%, rgba(10,10,15,0.4) 60%, transparent 100%);
}
.hero-overlay h1 { font-size: clamp(1.5rem, 3vw, 2.4rem); max-width: 700px; margin-top: 10px; }
.hero-overlay p { max-width: 600px; color: #d3d5e2; }

/* ---- Section head / tabs ---- */
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.tabs { display: flex; gap: 8px; background: var(--surface); padding: 4px; border-radius: 999px; border: 1px solid var(--border); }
.tab { padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 0.88rem; color: var(--text-muted); }
.tab.active { background: var(--primary); color: #fff; }

/* ---- Video grid & cards ---- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}
.video-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.video-card-thumb { position: relative; display: block; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.8); color: #fff; font-size: 0.72rem; font-weight: 600;
  padding: 2px 7px; border-radius: 4px;
}
.lock-badge {
  position: absolute; top: 8px; left: 8px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(245,158,11,0.92); color: #1a1200; font-size: 0.72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.video-card-body { padding: 14px 16px 16px; }
.video-card-body h3 { font-size: 1rem; margin-bottom: 8px; }
.video-card-body h3 a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; color: var(--text-muted); }

.empty-state, .result-count { color: var(--text-muted); padding: 20px 0; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.page-link { padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 0.9rem; }
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-dots { padding: 8px 4px; color: var(--text-muted); }

/* ---- Video page ---- */
.video-page { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.video-main { min-width: 0; }
.player-wrap { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-embed, .player-embed iframe, .player-embed video { width: 100%; height: 100%; border: 0; }
.player-embed.is-hidden { visibility: hidden; }
.lock-overlay { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; }
.lock-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(18px) brightness(0.4); transform: scale(1.1); }
.lock-content { position: relative; z-index: 1; text-align: center; max-width: 420px; padding: 24px; color: #fff; }
.lock-content svg { margin-bottom: 10px; color: var(--accent); }
.lock-content p { color: #d3d5e2; font-size: 0.92rem; }
.share-unlock-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; color: #fff;
}
.share-btn-fb { background: #1877f2; }
.share-btn-wa { background: #25d366; }
.share-btn-tw { background: #111; border: 1px solid #444; }
.share-btn-tg { background: #229ed9; }
.link-copy-fallback { margin-top: 14px; background: none; border: none; color: var(--text-muted); text-decoration: underline; cursor: pointer; font-size: 0.85rem; }

.processing-overlay { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; }
.spin-icon { animation: spin 1.6s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.ad-gate-overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}
.ad-gate-content { text-align: center; max-width: 480px; width: 100%; }
.ad-gate-message { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 14px; }
.ad-gate-slot { min-height: 90px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; overflow: auto; }
.ad-gate-placeholder { color: var(--text-muted); font-size: 0.82rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 24px; width: 100%; }
.ad-gate-continue:disabled { opacity: 0.55; cursor: not-allowed; }

.download-btn { display: inline-flex !important; }
.download-btn.is-hidden { display: none !important; }

.video-info { padding: 22px 0; border-bottom: 1px solid var(--border); }
.video-info h1 { font-size: 1.5rem; }
.share-row { display: flex; align-items: center; gap: 10px; margin: 16px 0; }
.share-label { color: var(--text-muted); font-weight: 600; font-size: 0.88rem; }
.share-icon {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-weight: 700; font-size: 0.85rem; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.share-icon:hover { color: #fff; }
.share-icon.fb:hover { background: #1877f2; }
.share-icon.tw:hover { background: #111; }
.share-icon.wa:hover { background: #25d366; }
.share-icon.tg:hover { background: #229ed9; }
.share-icon.li:hover { background: #0a66c2; }
.video-description { color: #cdd0e0; white-space: pre-line; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tag { background: var(--surface); border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; color: var(--text-muted); }

/* ---- Comments ---- */
.comments-section { padding: 28px 0; }
.comment-form { display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin-bottom: 28px; }
.comment-form input, .comment-form textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 12px 14px; font-family: inherit; font-size: 0.92rem; resize: vertical;
}
.comment-note { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.comment-list li { border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.comment-time { color: var(--text-muted); font-size: 0.78rem; margin-left: 8px; }
.comment-list p { margin-top: 6px; color: #cdd0e0; }

/* ---- Sidebar / related videos ---- */
.video-sidebar h2 { font-size: 1.1rem; }
.video-list-vertical { display: flex; flex-direction: column; gap: 12px; }
.mini-card { display: flex; gap: 10px; }
.mini-card img { width: 140px; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.mini-card h4 { font-size: 0.88rem; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-card span { font-size: 0.76rem; color: var(--text-muted); }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; background: var(--bg-alt); }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; padding: 44px 20px; }
.footer-col h4 { color: var(--text-muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.footer-col a { display: block; color: var(--text-muted); padding: 4px 0; font-size: 0.9rem; }
.footer-col a:hover { color: var(--text); }
.footer-social { display: flex; gap: 10px; margin-top: 14px; }
.footer-social-icon {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem;
  padding: 0; transition: background 0.15s ease, color 0.15s ease;
}
.footer-social-icon:hover { color: #fff; }
.footer-social-icon.fb:hover { background: #1877f2; }
.footer-social-icon.tw:hover { background: #111; }
.footer-social-icon.ig:hover { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.footer-social-icon.yt:hover { background: #ff0000; }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; }
.footer-bottom p { margin: 0; color: var(--text-muted); font-size: 0.82rem; text-align: center; }

/* ---- Flash messages ---- */
.site-flash { margin-top: 18px; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 0.9rem; }
.site-flash-success { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.site-flash-error { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

/* ---- Static pages (privacy, disclaimer, contact, custom) ---- */
.static-page { max-width: 780px; }
.page-content { color: #cdd0e0; line-height: 1.7; }
.page-content h2 { font-size: 1.25rem; margin-top: 1.4em; color: var(--text); }
.page-content p { margin-bottom: 1em; }
.page-content ul, .page-content ol { margin: 0 0 1em; padding-left: 1.4em; }
.page-content a { color: var(--accent); text-decoration: underline; }

/* ---- Category page ---- */
.category-desc { color: var(--text-muted); margin-top: -10px; margin-bottom: 24px; }

/* ---- Telegram join popup ---- */
.tg-popup-overlay {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 7, 12, 0.75); padding: 20px;
}
.tg-popup-box {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 28px 28px; max-width: 380px; width: 100%; text-align: center;
}
.tg-popup-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text-muted);
  font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 4px;
}
.tg-popup-close:hover { color: var(--text); }
.tg-popup-icon { font-size: 2.4rem; color: #229ed9; margin-bottom: 10px; }
.tg-popup-box h3 { margin: 0 0 8px; font-size: 1.15rem; }
.tg-popup-box p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.tg-popup-dismiss {
  display: block; width: 100%; margin-top: 10px; background: none; border: none; color: var(--text-muted);
  font-size: 0.85rem; cursor: pointer; text-decoration: underline;
}

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .video-page { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .search-form { order: 3; max-width: none; flex-basis: 100%; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 20px; gap: 12px; }
  .nav-toggle { display: flex; margin-left: auto; }
  .main-nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 4px;
    margin-left: 0;
  }
  .main-nav.open { display: flex; }
  .dropdown-menu { position: static; opacity: 1; visibility: visible; transform: none; display: none; box-shadow: none; }
  .dropdown.open .dropdown-menu { display: block; }
  .hero-card { min-height: 280px; }
  .hero-overlay { min-height: 280px; padding: 24px; }
  .footer-inner { grid-template-columns: 1fr; padding: 32px 20px; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
}
