/* ================================================
   EnglishID — Custom Styles
   Palette: white + blue + gray
   ================================================ */

:root {
  --brand:          #2563eb;
  --brand-dark:     #1d4ed8;
  --brand-soft:     #eff6ff;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --bg:             #f8fafc;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius:         12px;
  --shadow-sm:      0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md:      0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg:      0 12px 32px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

/* ============ NOTICE MARQUEE (copyright bar) ============ */
.notice-bar {
  background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
  color: #78350f;
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 0;
  overflow: hidden;
  border-bottom: 1px solid #fcd34d;
  position: relative;
  z-index: 60;
}
.notice-bar-track {
  display: flex;
  width: max-content;
  animation: marquee 65s linear infinite;
  will-change: transform;
}
.notice-bar:hover .notice-bar-track {
  animation-play-state: paused;
  cursor: default;
}
.notice-text {
  white-space: nowrap;
  padding-right: 100px; /* gap antar copy supaya loop seamless */
}
.notice-text i {
  margin-right: 6px;
  color: #b45309;
}
.notice-text strong { letter-spacing: .02em; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .notice-bar-track { animation: none; padding-left: 16px; }
}

/* ============ POSITION PILL (admin categories) ============ */
.position-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px; height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 13px;
  border: 1px solid #bfdbfe;
}

/* ============ LOGIN PAGE ============ */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 40%, #f0f9ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-wrapper { width: 100%; max-width: 420px; }
.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 64px; height: 64px;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}

.login-logo-img {
  max-width: 220px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ============ APP SHELL ============ */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar  topbar"
    "sidebar main";
}
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}
.brand-text strong { display: block; font-size: 16px; line-height: 1.1; }
.brand-text small  { color: var(--text-muted); font-size: 12px; }
.sidebar-toggle {
  font-size: 24px; color: var(--text); padding: 4px 8px;
}
.role-badge {
  display: inline-flex;
  align-items: center; gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
}
.role-admin     { background: #fee2e2; color: #991b1b; }
.role-user      { background: var(--brand-soft); color: var(--brand-dark); }
.role-user_full {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
}
.role-user_full i { color: #b45309; }

/* Tier badge di tabel admin */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.tier-biasa {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}
.tier-full {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Premium badge di card konten user */
.content-tier-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, .35);
  z-index: 2;
}

/* YouTube play-button overlay (di tengah thumbnail) */
.content-thumb.is-youtube img {
  filter: brightness(0.92);
  transition: filter .25s, transform .4s ease;
}
.content-card:hover .content-thumb.is-youtube img {
  filter: brightness(0.85);
}
.content-yt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 44px;
  background: rgba(255, 0, 0, 0.92);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 30px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .2s ease, background .2s;
}
.content-yt-play i {
  /* Geser sedikit ke kanan supaya optical-center play triangle pas */
  margin-left: 3px;
  line-height: 1;
}
.content-card:hover .content-yt-play {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(255, 0, 0, 1);
}

/* ============ HIDDEN CONTENT (admin-only view) ============ */
/* Card hidden di halaman menu (admin lihat dengan opacity dim) */
.content-card-hidden {
  opacity: 0.65;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 14px,
      rgba(100, 116, 139, .06) 14px,
      rgba(100, 116, 139, .06) 28px
    ),
    var(--surface);
  position: relative;
}
.content-card-hidden:hover { opacity: 1; }
.content-hidden-badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(71, 85, 105, .95);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
/* Geser content-tag (kategori) ke bawah biar tidak tabrak hidden badge */
.content-card-hidden .content-tag { top: 42px; }

/* Row hidden di tabel admin */
.row-hidden td {
  background: #f8fafc;
  color: #64748b;
}
.row-hidden .table-thumb { opacity: 0.55; }
.thumb-hidden-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .35);
  color: #fff;
  border-radius: 6px;
  font-size: 16px;
}

/* Blok field Premium di form admin (description2 + link2) */
.premium-block {
  background: linear-gradient(180deg, #fffbeb 0%, #fefce8 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 1rem;
  position: relative;
}
.premium-block::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  border-radius: 10px 10px 0 0;
}
.premium-block-header {
  font-weight: 700;
  color: #92400e;
  font-size: 14px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #fcd34d;
}
.premium-block-header i { color: #d97706; margin-right: 4px; }
.premium-block .form-control:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
}

/* ============ SIDEBAR ============ */
.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.sidebar-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 18px; width: 20px; text-align: center; color: var(--text-muted); }
.sidebar-link:hover { background: var(--brand-soft); color: var(--brand-dark); }
.sidebar-link:hover i { color: var(--brand); }
.sidebar-link.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, .25);
}
.sidebar-link.active i { color: #fff; }
.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border); }

/* ============ MAIN ============ */
.main-content {
  grid-area: main;
  padding: 32px;
  min-width: 0;
}

/* ============ DASHBOARD HERO ============ */
.hero-card {
  background: linear-gradient(135deg, var(--brand) 0%, #4f46e5 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}
.hero-card h1 { font-size: 28px; font-weight: 700; margin: 0 0 8px; }
.hero-card p  { margin: 0; opacity: .9; max-width: 640px; }

/* ============ STAT CARD ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px; height: 48px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); }

/* ============ LIVE COUNTER (Sedang Online) ============ */
.stat-card-live {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 65%);
  border-color: #bbf7d0;
}
.stat-card-body { min-width: 0; flex: 1; }
.stat-icon-live {
  background: #dcfce7;
  color: #16a34a;
  position: relative;
}
.stat-icon-live i { position: relative; z-index: 1; }
.pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 2px solid #22c55e;
  animation: pulse-ring 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}
@keyframes pulse-ring {
  0%   { opacity: 0.7; transform: scale(1); }
  80%  { opacity: 0;   transform: scale(1.7); }
  100% { opacity: 0;   transform: scale(1.7); }
}
.stat-value-live {
  color: #15803d;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: none; /* override .stat-label */
}
.live-dot {
  width: 6px; height: 6px;
  background: #fff;
  border-radius: 50%;
  animation: blink-dot 1.2s steps(2, end) infinite;
}
@keyframes blink-dot {
  50% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-ring,
  .live-dot { animation: none; }
}

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.page-header h1 { font-size: 24px; margin: 0 0 4px; font-weight: 700; }
.page-header p  { margin: 0; color: var(--text-muted); }

/* ============ CARD GRID (3 kolom desktop) ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 991.98px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}
@media (max-width: 575.98px) {
  .card-grid { grid-template-columns: 1fr; }
}
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.content-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.content-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #f1f5f9;
  overflow: hidden;
}
.content-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease;
}
.content-card:hover .content-thumb img { transform: scale(1.04); }
.content-tag {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(37, 99, 235, .95);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.content-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}
.content-title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}
.content-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.content-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Thumbnail bisa di-klik (link ke konten) */
a.content-thumb {
  text-decoration: none;
  cursor: pointer;
}
a.content-thumb:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: -3px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; color: var(--border-strong); }
.empty-state h3 { margin: 12px 0 4px; font-size: 18px; color: var(--text); }

/* ============ TABLE ============ */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-card table { margin: 0; }
.table-card thead th {
  background: #f8fafc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.table-card td, .table-card th { padding: 14px 16px; vertical-align: middle; }
.table-thumb {
  width: 60px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ============ FORM ============ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 720px;
}
.form-label { font-weight: 500; font-size: 14px; }
.form-control, .form-select {
  border-radius: 8px;
  border-color: var(--border-strong);
  padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.current-image {
  display: inline-block;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}
.current-image img { max-height: 100px; border-radius: 4px; }

/* ============ BUTTON OVERRIDES ============ */
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  font-weight: 500;
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 40;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 20px; }
  .hero-card { padding: 24px; }
}

/* ============ YOUTUBE MODAL PLAYER ============ */
.yt-modal {
  position: fixed;
  inset: 0;
  z-index: 1080;            /* di atas sidebar (50) & notice (60) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: yt-fade-in .18s ease-out;
}
.yt-modal[hidden] { display: none; }
.yt-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.yt-modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 960px;
  background: #0f172a;
  border-radius: 12px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: yt-pop-in .22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.yt-modal-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.yt-modal-title-wrap {
  flex: 1;
  min-width: 0;
}
.yt-modal-eyebrow {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  margin-bottom: 2px;
}
.yt-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yt-modal-close {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.yt-modal-close:hover,
.yt-modal-close:focus-visible {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  outline: none;
}
.yt-modal-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.yt-modal-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Cegah scroll halaman saat modal terbuka */
body.yt-modal-open { overflow: hidden; }

@keyframes yt-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes yt-pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@media (max-width: 575.98px) {
  .yt-modal { padding: 0; }
  .yt-modal-content { border-radius: 0; max-width: none; height: 100%;
                      display: flex; flex-direction: column; }
  .yt-modal-frame { flex: 1; aspect-ratio: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .yt-modal,
  .yt-modal-content { animation: none; }
}
