/* ===== Variables ===== */
:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-hover: #334155;
  --accent: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --sidebar-w: 260px;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.35);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }
input, textarea, select, button { font-family: inherit; font-size: inherit; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: #0b1120;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  font-size: 1.35rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: var(--text-muted);
  font-size: .95rem;
  transition: background .2s, color .2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(59,130,246,.08);
  color: var(--text);
  border-left-color: var(--accent);
  text-decoration: none;
}

.sidebar-nav a .nav-icon { font-size: 1.15rem; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
}

.sidebar-footer a { color: var(--red); }

/* hamburger toggle */
.hamburger {
  display: none;
  position: fixed;
  top: 16px; left: 16px;
  z-index: 200;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.4rem;
  padding: 8px 12px;
  cursor: pointer;
}

/* ===== Main content ===== */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 32px 36px;
  min-height: 100vh;
}

/* For pages without sidebar */
.no-sidebar .main-content { margin-left: 0; }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 24px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: transform .2s, box-shadow .2s;
  animation: fadeIn .4s ease both;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.4); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== Stats row ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: fadeIn .4s ease both;
}

.stat-card:nth-child(2) { animation-delay: .08s; }
.stat-card:nth-child(3) { animation-delay: .16s; }

.stat-icon { font-size: 2.2rem; }

.stat-info { flex: 1; }

.stat-label { font-size: .85rem; color: var(--text-muted); margin-bottom: 2px; }

.stat-value { font-size: 1.7rem; font-weight: 700; }

/* ===== Action bar ===== */
.action-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn .5s ease both;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  font-size: .9rem;
}

thead th {
  position: sticky;
  top: 0;
  background: #162032;
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover { color: var(--text); }

tbody tr { transition: background .15s; }
tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
tbody tr:hover { background: rgba(59,130,246,.06); }

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* status badges */
.badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-running  { background: rgba(16,185,129,.15); color: var(--green); }
.badge-offline  { background: rgba(148,163,184,.12); color: var(--text-muted); }
.badge-done     { background: rgba(59,130,246,.15); color: var(--accent); }
.badge-fail     { background: rgba(239,68,68,.15); color: var(--red); }
.badge-expired  { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-forbid   { background: rgba(239,68,68,.1); color: #f87171; }

/* progress bar */
.progress-bar {
  width: 120px;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .6s ease;
}

.progress-text { font-size: .8rem; color: var(--text-muted); }

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.25);
}

.form-control::placeholder { color: var(--text-muted); opacity: .6; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}

.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; box-shadow: 0 4px 14px rgba(59,130,246,.35); }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; box-shadow: 0 4px 14px rgba(16,185,129,.35); }

.btn-danger    { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 14px rgba(239,68,68,.35); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--card-hover); }

.btn-sm { padding: 7px 16px; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== Flash messages ===== */
.flash-container { margin-bottom: 20px; }

.flash-msg {
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn .3s ease;
}

.flash-msg.success { background: rgba(16,185,129,.12); color: var(--green); border-left: 4px solid var(--green); }
.flash-msg.error   { background: rgba(239,68,68,.12); color: var(--red); border-left: 4px solid var(--red); }
.flash-msg.info    { background: rgba(59,130,246,.12); color: var(--accent); border-left: 4px solid var(--accent); }

.flash-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: .6;
}

.flash-dismiss:hover { opacity: 1; }

/* ===== Landing page ===== */
.hero {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 60px 24px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 550px;
  margin-bottom: 32px;
}

.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

.features {
  padding: 80px 24px;
  max-width: 960px;
  margin: 0 auto;
}

.features h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s;
  animation: fadeIn .5s ease both;
}

.feature-card:nth-child(2) { animation-delay: .1s; }
.feature-card:nth-child(3) { animation-delay: .2s; }

.feature-card:hover { transform: translateY(-4px); }

.feature-icon { font-size: 2.5rem; margin-bottom: 16px; }
.feature-card h3 { margin-bottom: 8px; font-size: 1.1rem; }
.feature-card p { color: var(--text-muted); font-size: .9rem; }

.landing-footer {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
}

/* ===== Auth pages ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #162032 100%);
}

.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  animation: fadeIn .4s ease;
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.auth-card .auth-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 28px;
}

.auth-card .auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: .88rem;
  color: var(--text-muted);
}

/* OTP input */
.otp-input {
  text-align: center;
  letter-spacing: 12px;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 14px;
}

/* ===== Drag-drop zone ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: rgba(255,255,255,.01);
  margin-bottom: 16px;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59,130,246,.06);
}

.drop-zone-icon { font-size: 2.4rem; margin-bottom: 12px; }

.drop-zone-text { color: var(--text-muted); font-size: .9rem; }
.drop-zone-text strong { color: var(--text); }

.upload-feedback {
  margin-top: 12px;
  font-size: .88rem;
  min-height: 20px;
}

/* ===== Section separators ===== */
.settings-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  animation: fadeIn .4s ease both;
}

.settings-section:nth-child(2) { animation-delay: .08s; }
.settings-section:nth-child(3) { animation-delay: .16s; }

.settings-section h3 {
  margin-bottom: 20px;
  font-size: 1.1rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ===== Theme toggle ===== */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-switch input[type="checkbox"] {
  width: 44px;
  height: 24px;
  appearance: none;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  transition: background .2s;
}

.theme-switch input[type="checkbox"]::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--text);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .2s;
}

.theme-switch input[type="checkbox"]:checked { background: var(--accent); }
.theme-switch input[type="checkbox"]:checked::after { transform: translateX(20px); }

/* ===== Turnstile ===== */
.cf-turnstile { margin-bottom: 18px; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; padding: 24px 16px; padding-top: 64px; }

  .stats-row { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }

  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .hero-buttons { flex-direction: column; }
  .btn-block-mobile { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════
   SZ Pool Components
   ═══════════════════════════════════════ */

.sz-pool-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.sz-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.sz-stat-card.available { border-color: #10b981; }
.sz-stat-card.used { border-color: #f59e0b; }

.sz-stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.sz-stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
}

.sz-stat-card.available .sz-stat-value { color: #10b981; }
.sz-stat-card.used .sz-stat-value { color: #f59e0b; }

.sz-form {
  margin-bottom: 12px;
}

.sz-value-cell {
  font-family: monospace;
  font-size: .85rem;
  word-break: break-all;
}

.btn-sm {
  padding: 4px 10px;
  font-size: .8rem;
  border-radius: 6px;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-danger:hover { background: #dc2626; }

@media (max-width: 600px) {
  .sz-pool-stats { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   Subscription Components
   ═══════════════════════════════════════ */

.sub-status-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  margin-bottom: 28px;
}
.sub-status-card.premium { border-color: #f59e0b; background: linear-gradient(135deg, #1e293b 0%, #2a1f0a 100%); }
.sub-status-card.free { border-color: var(--border); }
.sub-status-icon { font-size: 2.4rem; }
.sub-status-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.sub-status-value { font-size: 1.6rem; font-weight: 700; }
.sub-status-card.premium .sub-status-value { color: #f59e0b; }
.sub-status-card.free .sub-status-value { color: var(--text-muted); }
.sub-status-expires { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

.sub-pricing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  max-width: 480px;
}
.sub-pricing-header { margin-bottom: 8px; }
.sub-pricing-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: 1px;
}
.sub-pricing-price {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--green);
  margin: 12px 0 16px;
}
.sub-pricing-features {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sub-pricing-features li {
  padding: 6px 0;
  font-size: .9rem;
  color: var(--text);
}

.sub-timer {
  text-align: center;
  font-size: 1.1rem;
  color: var(--yellow);
  margin-top: 16px;
}

.sub-qris-status {
  text-align: center;
  margin-top: 12px;
}

.sub-paid-banner {
  background: var(--green);
  color: #fff;
  padding: 16px 24px;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  animation: pulse-glow 1s ease infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 20px 4px rgba(16, 185, 129, 0.3); }
}

.btn-block { width: 100%; text-align: center; }

/* ═══════════════════════════════════════
   Live Log Panel (Terminal Style)
   ═══════════════════════════════════════ */

.log-panel {
  margin-top: 24px;
  background: #0a0e17;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #111827;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.log-body {
  height: 360px;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: 'Consolas', 'Fira Code', 'Courier New', monospace;
  font-size: .8rem;
  line-height: 1.7;
}

.log-body::-webkit-scrollbar { width: 6px; }
.log-body::-webkit-scrollbar-track { background: transparent; }
.log-body::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.log-body::-webkit-scrollbar-thumb:hover { background: #475569; }

.log-line {
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line + .log-line {
  margin-top: 1px;
}

/* +++++++++++++++++++++++++++++++++++++++
   Admin Panel — Dashboard & CRUD
   +++++++++++++++++++++++++++++++++++++++ */

/* ── Top stat cards row ── */
.admin-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .admin-row { grid-template-columns: 1fr; }
}

.admin-card-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.admin-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 10px;
}

.admin-mini-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
  transition: border-color .2s ease;
}

.admin-mini-card:hover {
  border-color: var(--green);
}

.admin-mini-card.wide {
  grid-column: 1 / -1;
}

.admin-mini-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.admin-mini-sub {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.admin-mini-label {
  font-size: .72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-top: 4px;
}

/* Accent colors */
.admin-mini-card.accent-green { border-left: 3px solid #10b981; }
.admin-mini-card.accent-purple { border-left: 3px solid #a78bfa; }
.admin-mini-card.accent-gold { border-left: 3px solid #f59e0b; }

.admin-card-link {
  display: inline-block;
  font-size: .82rem;
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  margin-top: auto;
}

.admin-card-link:hover {
  text-decoration: underline;
}

/* ── Tables side by side ── */
.admin-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .admin-tables-row { grid-template-columns: 1fr; }
}

.admin-table-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  overflow: hidden;
}

.admin-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.admin-table-header h3 {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
}

/* Compact table variant */
table.compact td, table.compact th {
  padding: 8px 10px;
  font-size: .84rem;
}

/* ── Badges ── */
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}

.badge-green  { background: rgba(16,185,129,.15); color: #10b981; }
.badge-yellow { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-red    { background: rgba(239,68,68,.15);  color: #ef4444; }
.badge-purple { background: rgba(139,92,246,.15); color: #a78bfa; }

/* ── Status dots ── */
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-green { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,.5); }
.dot-red   { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,.4); }

/* ── Helper text styles ── */
.admin-link { color: var(--green); text-decoration: none; font-weight: 600; }
.admin-link:hover { text-decoration: underline; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .84rem; }
.text-mono { font-family: monospace; font-size: .84rem; }
.empty-row { text-align: center; color: var(--text-muted); padding: 24px !important; }
