/* =========================================
   ADMIN PANEL — Custom CSS (no Tailwind)
   ========================================= */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: #09090b;
  color: #efeff1;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}
body.admin-body.centered { align-items: center; }
/* When authenticated, use the full screen — no width cap, minimal padding. */
body.admin-body.top-aligned {
  align-items: flex-start;
  padding: 0;
}

/* ---- Card ---- */
.admin-card {
  width: 100%;
  max-width: 1444px;
  background: #18181b;
  border: 1px solid #2d2d33;
  border-radius: 16px;
  overflow: hidden;
}
/* Authenticated view fills the screen edge-to-edge. */
body.admin-body.top-aligned .admin-card {
  max-width: none;
  border: none;
  border-radius: 0;
  min-height: 100vh;
}

/* ---- Login ---- */
.admin-login {
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}
.admin-login__logo {
  width: 48px; height: 48px;
  background: #155EEF;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
  margin-bottom: 16px;
}
.admin-login__title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
/* Full-colour image logo on the login screen — transparent box. */
.admin-login__logo--img { background: transparent; overflow: hidden; }
.admin-login__logo--img img { width: 100%; height: 100%; object-fit: contain; }
.admin-login__sub { color: #adadb8; font-size: 13px; margin-bottom: 24px; }
.admin-login form { display: flex; flex-direction: column; gap: 10px; }
.admin-login input[type="password"] {
  width: 100%;
  background: #09090b;
  border: 1px solid #2d2d33;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: #efeff1;
  outline: none;
}
.admin-login input[type="password"]:focus { border-color: #155EEF; }

/* ---- Header ---- */
.admin-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2d2d33;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-header__brand { display: flex; align-items: center; gap: 10px; }
.admin-header__logo {
  width: 32px; height: 32px;
  background: #155EEF;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff;
}
/* Full-colour image logo: no purple fill, just the rounded image. */
.admin-header__logo--img { background: transparent; overflow: hidden; }
.admin-header__logo--img img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.admin-header__info { display: flex; flex-direction: column; }
.admin-header__role { font-size: 10px; font-weight: 700; color: #155EEF; text-transform: uppercase; letter-spacing: 0.5px; }
.admin-header__domain { font-size: 13px; font-weight: 600; color: #adadb8; }
.admin-header__actions { display: flex; align-items: center; gap: 8px; }

.admin-header__live {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid #2d2d33;
  border-radius: 8px;
}
.admin-header__live-dot {
  width: 8px; height: 8px;
  border-radius: 50%; flex-shrink: 0;
}
.admin-header__live-dot--green {
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
  animation: live-pulse 1.6s infinite;
}
.admin-header__live-dot--gray  { background: #71717a; }
.admin-header__live-label { font-size: 12px; font-weight: 700; color: #adadb8; }

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  border-radius: 8px; border: none;
  font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn--primary { background: #155EEF; color: #fff; }
.btn--primary:hover { background: #0F4FC0; }
.btn--outline { background: transparent; color: #efeff1; border: 1px solid #2d2d33; }
.btn--outline:hover { background: #1f1f23; }
.btn--danger { background: #dc2626; color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--success { background: #059669; color: #fff; }
.btn--success:hover { background: #047857; }
.btn--amber { background: #f59e0b; color: #1a1200; }
.btn--amber:hover { background: #d97a06; }
.btn--ghost { background: transparent; color: #adadb8; border: none; }
.btn--ghost:hover { color: #efeff1; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--full { width: 100%; }

/* GCash panel's save button only — keep .btn--full at 100% everywhere else (login, stream switcher, ticker, ad codes) */
#panel-gcash .btn--full { width: 30%; }
.btn--icon { padding: 8px; border-radius: 8px; }

/* ---- Tabs ---- */
/* ---- Left-sidebar tab layout ---- */
.admin-layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 73px); /* fill below the header */
}
.admin-panels { flex: 1; min-width: 0; }

.admin-tabs-wrap { position: relative; flex: 0 0 auto; }
.admin-tabs {
  display: flex;
  flex-direction: column;
  width: 190px;
  border-right: 1px solid #2d2d33;
  border-bottom: none;
  overflow-y: auto;
  scrollbar-width: none;
  height: 100%;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  font-size: 13px; font-weight: 600;
  color: #71717a;
  background: none; border: none;
  border-left: 3px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  text-align: left;
}
.tab-btn__icon { flex-shrink: 0; opacity: 0.9; }
.tab-btn:hover { color: #efeff1; background: rgba(255,255,255,0.03); }
.tab-btn.active {
  color: #155EEF;
  border-left-color: #155EEF;
  border-bottom-color: transparent;
  background: rgba(21,94,239,0.08);
}

/* The horizontal scroll fade/arrow is only needed for the old top layout. */
.admin-tabs-fade { display: none; }

/* ---- Tab panels ---- */
.tab-panel {
  display: none;
  padding: 24px;
  /* Cap content width on the full-screen layout so inputs/URLs stay a
     comfortable reading width instead of stretching across the whole panel. */
  max-width: 920px;
}
.tab-panel.active { display: block; }

/* ---- Form elements ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11.5px; font-weight: 700;
  color: #adadb8; text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.form-label span { font-weight: 400; text-transform: none; letter-spacing: 0; color: #71717a; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #1f1f23;
  border: 1px solid #2d2d33;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #efeff1;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus { border-color: #155EEF; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-textarea.mono { font-family: 'Monaco', 'Menlo', monospace; font-size: 12px; }
.form-file {
  width: 100%;
  background: #1f1f23;
  border: 1px solid #2d2d33;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #adadb8;
}
.form-hint { font-size: 11.5px; color: #71717a; margin-top: 5px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-input { flex: 1; }

/* ---- Toggle switch ---- */
.toggle-wrap {
  display: flex; align-items: center; justify-content: space-between;
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
}
.toggle-info { flex: 1; }
.toggle-info__title { font-size: 14px; font-weight: 600; color: #efeff1; }
.toggle-info__sub { font-size: 12px; color: #71717a; margin-top: 2px; }
.toggle {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0; margin-left: 16px;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle__track {
  position: absolute; inset: 0;
  background: #3f3f46;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle__track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle__track { background: #155EEF; }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); }

/* ---- Cards / boxes ---- */
.info-box {
  display: flex; align-items: center; gap: 14px;
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 12px; padding: 16px; margin-bottom: 20px;
}
.info-box__dot {
  width: 14px; height: 14px;
  border-radius: 50%; flex-shrink: 0;
}
.info-box__dot--green { background: #34d399; box-shadow: 0 0 8px #34d399; }
.info-box__dot--gray  { background: #71717a; }
.info-box__title { font-size: 15px; font-weight: 700; }
.info-box__sub   { font-size: 12px; color: #71717a; margin-top: 2px; }

.section-box {
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 12px; padding: 16px; margin-bottom: 16px;
}
.section-box--accent {
  background: rgba(21,94,239,0.08);
  border-color: rgba(21,94,239,0.3);
}

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert--success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #34d399; }
.alert--error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.alert--warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }

/* ---- Description text ---- */
.section-desc { font-size: 13px; color: #71717a; margin-bottom: 20px; line-height: 1.6; }
.section-desc a { color: #155EEF; }

/* ---- Preview image ---- */
.preview-img {
  width: 100%; max-height: 320px;
  object-fit: contain;
  border-radius: 10px;
  background: #09090b;
  border: 1px solid #2d2d33;
  display: block; margin-bottom: 16px;
}
.preview-img--sm {
  width: 260px;
  max-width: 100%;
  max-height: none;
  margin-bottom: 12px;
}

/* ---- Combined banner/background tab ---- */
.media-section {
  background: #18181b;
  border: 1px solid #2d2d33;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.media-section:last-child { margin-bottom: 0; }
.media-section__title { font-size: 14px; font-weight: 700; color: #efeff1; margin: 0 0 4px; }
.media-section__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.media-section__form { display: flex; align-items: center; gap: 8px; }
.media-section__form .form-file { max-width: 220px; }

/* ---- Avatar ---- */
.avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.avatar-circle {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #155EEF;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Viewers table ---- */
.viewers-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.viewers-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  color: #71717a; border-bottom: 1px solid #2d2d33;
}
.viewers-table td { padding: 10px 12px; border-bottom: 1px solid #1f1f23; vertical-align: middle; }
.viewers-table tr:last-child td { border-bottom: none; }
.viewers-table tr:hover td { background: #1f1f23; }

/* ---- Preset buttons ---- */
.preset-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.preset-btn {
  padding: 5px 12px;
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 6px; font-size: 12px; font-weight: 600;
  color: #adadb8; cursor: pointer;
  transition: all 0.15s;
}
.preset-btn:hover { background: #155EEF; color: #fff; border-color: #155EEF; }
.preset-btn.active { background: #155EEF; color: #fff; border-color: #155EEF; }

/* ---- Blog list ---- */
.blog-list { display: flex; flex-direction: column; gap: 8px; }
.blog-item {
  display: flex; align-items: center; gap: 10px;
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 10px; padding: 12px 14px;
}
.blog-item__info { flex: 1; min-width: 0; }
.blog-item__title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blog-item__meta { font-size: 11.5px; color: #71717a; margin-top: 2px; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge--green { background: rgba(16,185,129,0.15); color: #34d399; }
.badge--gray  { background: rgba(113,113,122,0.2); color: #71717a; }

/* ---- Blog form ---- */
.blog-form {
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 12px; padding: 16px; margin-bottom: 20px;
  display: none;
}
.blog-form.open { display: block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.form-check input { width: 16px; height: 16px; accent-color: #155EEF; cursor: pointer; }

/* ---- Schedule rows ---- */
.schedule-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.schedule-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }

/* ---- GCash preview ---- */
.gcash-preview {
  display: flex; align-items: center; gap: 12px;
  background: #1f1f23; border: 1px solid #2d2d33;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 20px;
}
.gcash-preview img { height: 40px; width: auto; object-fit: contain; }
.gcash-preview__num { font-size: 20px; font-weight: 800; }
.gcash-preview__qr { margin-left: auto; }
.gcash-preview__qr img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; border: 1px solid #2d2d33; }

/* ---- Smartlink section ---- */
.smartlink-section {
  background: #1f1f23; border: 1px solid rgba(21,94,239,0.3);
  border-radius: 12px; padding: 16px; margin-top: 8px;
}
.smartlink-section__title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.smartlink-section__desc { font-size: 12px; color: #71717a; margin-bottom: 14px; }

/* ---- Header/Footer ---- */
.admin-footer {
  padding: 16px 20px;
  border-top: 1px solid #2d2d33;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.admin-footer__text { font-size: 12px; color: #71717a; }

/* ---- Misc utils ---- */
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.w-full { width: 100%; }
.ml-auto { margin-left: auto; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.font-bold { font-weight: 700; }
.text-white { color: #fff; }
.text-muted { color: #71717a; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .schedule-row { grid-template-columns: 1fr 1fr; }
  .admin-header { gap: 10px; }
  .tab-panel { padding: 16px; }
  /* On phones the left sidebar wastes width — stack tabs back on top as a
     horizontal scroller. */
  .admin-layout { flex-direction: column; }
  .admin-tabs {
    flex-direction: row;
    width: 100%;
    height: auto;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid #2d2d33;
  }
  .tab-btn {
    padding: 12px 14px;
    font-size: 12px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }
  .tab-btn.active { border-left-color: transparent; border-bottom-color: #155EEF; }
}

/* ---- News ticker preview ---- */
.news-ticker {
  display: flex;
  align-items: center;
  height: 34px;
  background: #09090b;
  border: 1px solid #2d2d33;
  border-radius: 6px;
  overflow: hidden;
}
.news-ticker__label {
  flex: 0 0 auto;
  background: #155EEF;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
}
.news-ticker__viewport {
  flex: 1 1 auto;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}
.news-ticker__track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: news-ticker-scroll linear infinite;
}
.news-ticker__item {
  display: inline-block;
  padding-right: 64px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}
@keyframes news-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--ticker-shift, -20%)); }
}

/* ---- Countdown tab: simple inline checkbox rows ---- */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #efeff1;
  user-select: none;
}
.toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #0F4FC0;
  cursor: pointer;
}

/* ---- Automation tab ---- */
.auto-section {
  border: 1px solid #2d2d33;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 18px;
  background: rgba(255,255,255,0.02);
}
.auto-section__title {
  font-size: 14px;
  font-weight: 700;
  color: #efeff1;
  margin-bottom: 4px;
}
.auto-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.auto-row .form-input { flex: 1; min-width: 120px; }
.auto-row__check {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: #AFA9EC; white-space: nowrap; cursor: pointer;
}
.auto-row__check input { width: 15px; height: 15px; accent-color: #0F4FC0; }
.auto-row__mins {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #71717a; white-space: nowrap;
}
.auto-row__del { flex: 0 0 auto; color: #f87171; }

/* ---- copy-row (overlay URL, etc.) ---- */
.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row .form-input { flex: 1; min-width: 0; }
.copy-row .btn { white-space: nowrap; }

/* ---- Security alert banner ---- */
.security-banner {
  background: linear-gradient(90deg, rgba(220,38,38,0.16), rgba(220,38,38,0.06));
  border-bottom: 1px solid rgba(220,38,38,0.35);
}
.security-banner__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
}
.security-banner__icon { font-size: 18px; flex-shrink: 0; }
.security-banner__text { flex: 1; min-width: 0; }
.security-banner__title { font-weight: 700; color: #fca5a5; font-size: 13.5px; }
.security-banner__sub { font-size: 12px; color: #d4a5a5; margin-top: 2px; }
.security-banner__dismiss {
  flex-shrink: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #efeff1;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
}
.security-banner__dismiss:hover { background: rgba(255,255,255,0.14); }

/* ---- Theme chooser swatches ---- */
.theme-swatch {
  display: block;
  cursor: pointer;
  background: #1f1f23;
  border: 2px solid #2d2d33;
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 180px;
  transition: border-color 0.15s, background 0.15s;
}
.theme-swatch:hover { border-color: #3a3a42; }
.theme-swatch--active { border-color: #155EEF; background: rgba(21,94,239,0.08); }
.theme-swatch__preview { display: flex; gap: 6px; margin-bottom: 10px; }
.theme-swatch__dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255,255,255,0.08); }
.theme-swatch__label { font-size: 13.5px; font-weight: 700; color: #efeff1; }
.theme-swatch__sub { font-size: 11px; color: #71717a; margin-top: 2px; }
