/* ============================================
   RaffleKit — Admin Panel Styles
   ============================================ */

.admin-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 48px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-card h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.login-error { background: var(--danger-light); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 16px; display: none; }
.login-error.show { display: block; }

/* ---- Admin layout ---- */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 240px;
  background: #0f172a;
  color: rgba(255,255,255,.8);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo { font-size: 24px; }
.sidebar-title { font-size: 16px; font-weight: 800; color: #fff; margin-top: 4px; }
.sidebar-subtitle { font-size: 11px; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 12px 20px 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,.7);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active { background: rgba(14,165,233,.2); color: #38bdf8; border-right: 3px solid #38bdf8; }
.sidebar-link .link-icon { font-size: 18px; width: 22px; text-align: center; }
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px 0;
  transition: color .15s;
  font-family: var(--font);
}
.sidebar-logout:hover { color: var(--danger); }

/* ---- Admin main content ---- */
.admin-main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-topbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.admin-topbar-left { display: flex; align-items: center; gap: 12px; }
.admin-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}
.admin-page-title { font-size: 18px; font-weight: 800; color: var(--text); }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-light);
  padding: 4px 10px;
  border-radius: 100px;
}
.live-dot { width: 7px; height: 7px; background: var(--success); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.admin-content { padding: 28px; flex: 1; }

/* ---- Dashboard stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}
.stat-card-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.stat-card-value { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.highlight { background: var(--primary); color: #fff; border-color: transparent; }
.stat-card.highlight .stat-card-label { color: rgba(255,255,255,.7); }
.stat-card.highlight .stat-card-value { color: #fff; }
.stat-card.highlight .stat-card-sub { color: rgba(255,255,255,.6); }

/* ---- Admin cards ---- */
.admin-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: hidden;
}
.admin-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-card-title { font-size: 16px; font-weight: 700; color: var(--text); }
.admin-card-body { padding: 24px; }

/* ---- Table ---- */
.table-container { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .actions { display: flex; gap: 6px; }

/* ---- Search + filter bar ---- */
.table-controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-input { flex: 1; min-width: 200px; }
.filter-select {
  padding: 9px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg-white);
  color: var(--text);
  outline: none;
}
.filter-select:focus { border-color: var(--primary); }

/* ---- Draw section ---- */
.draw-baskets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.draw-basket-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px;
  text-align: center;
  transition: all .2s;
}
.draw-basket-card.draw-done { border-color: var(--success); background: var(--success-light); }
.draw-basket-icon { font-size: 36px; margin-bottom: 10px; }
.draw-basket-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.draw-basket-eligible { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.draw-winner-box { background: var(--bg); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 12px; }
.draw-winner-box .winner-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.draw-winner-box .winner-val { font-size: 15px; font-weight: 800; color: var(--success); }

/* ---- Winner draw modal ---- */
.draw-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.75);
  backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all .25s;
}
.draw-modal-overlay.open { opacity: 1; visibility: visible; }
.draw-modal-box {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  transform: scale(.9) translateY(30px);
  transition: transform .25s;
}
.draw-modal-overlay.open .draw-modal-box { transform: scale(1) translateY(0); }
.draw-modal-header { padding: 24px 24px 18px; border-bottom: 1px solid var(--border); }
.draw-modal-title { font-size: 20px; font-weight: 800; }
.draw-modal-body { padding: 24px; }
.draw-modal-footer { padding: 16px 24px 24px; border-top: 1px solid var(--border); }

/* ---- Slot machine animation ---- */
.slot-machine {
  background: linear-gradient(135deg, #0c4a6e, #0284c7);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin: 20px 0;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.slot-machine::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,255,255,.1) 0%, transparent 70%);
}
.slot-display {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: .1em;
  font-family: 'Courier New', monospace;
  position: relative;
  line-height: 1;
  margin-bottom: 8px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-spinning .slot-display { animation: slotRoll .08s steps(1) infinite; }
@keyframes slotRoll {
  0% { content: ''; }
}
.slot-ticket-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .7; margin-bottom: 4px; }
.slot-winner-name { font-size: 16px; font-weight: 700; opacity: .9; margin-top: 6px; min-height: 22px; }
.btn-spin {
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.4);
  color: #fff;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all .2s;
  font-family: var(--font);
}
.btn-spin:hover { background: rgba(255,255,255,.3); }

/* ---- Witness panel ---- */
.witness-panel {
  margin-top: 20px;
}
.witness-panel-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.witness-row {
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color .2s;
}
.witness-row.approved { border-color: var(--success); background: var(--success-light); }
.witness-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.witness-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.witness-approved-badge { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--success); }
.witness-input-row { display: flex; gap: 8px; }
.witness-input-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
.witness-input-row input:focus { border-color: var(--primary); }
.btn-witness-approve {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn-witness-approve:hover { background: var(--primary-dark); }
.btn-witness-approve:disabled { opacity: .4; cursor: not-allowed; }
.witness-approved-name { font-size: 15px; font-weight: 700; color: var(--success); }

/* Draw history table */
.draw-cert {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px;
}
.draw-cert-header { text-align: center; margin-bottom: 20px; }
.draw-cert-title { font-size: 22px; font-weight: 800; color: var(--text); }
.draw-cert-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.draw-cert-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.draw-cert-field { background: #fff; padding: 12px; border-radius: var(--radius-sm); }
.draw-cert-field .cf-label { font-size: 11px; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 3px; }
.draw-cert-field .cf-value { font-size: 15px; font-weight: 700; color: var(--text); }
.draw-cert-witnesses { margin-top: 16px; background: #fff; border-radius: var(--radius-sm); padding: 12px; }
.draw-cert-witnesses-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-light); margin-bottom: 8px; }
.witness-sig-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.witness-sig-row:last-child { border-bottom: none; }

/* ---- Prize basket manager ---- */
.basket-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.basket-admin-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.basket-admin-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--primary-light);
}
.basket-admin-body { padding: 16px; }
.basket-admin-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.basket-admin-value { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.basket-admin-actions { display: flex; gap: 8px; }

/* ---- Settings ---- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }

/* ---- Basket edit modal ---- */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all .2s;
}
.admin-modal-overlay.open { opacity: 1; visibility: visible; }
.admin-modal-box {
  background: var(--bg-white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform .2s;
}
.admin-modal-overlay.open .admin-modal-box { transform: translateY(0); }
.admin-modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.admin-modal-title { font-size: 17px; font-weight: 800; }
.admin-modal-body { padding: 24px; }
.admin-modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Responsive admin ---- */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-hamburger { display: block; }
  .admin-content { padding: 20px 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .draw-cert-fields { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .data-table { font-size: 13px; }
  .data-table td, .data-table th { padding: 10px 10px; }
}

/* ═══ GST Toggle ══════════════════════════════════════════════ */
.gst-toggle-wrap { display: inline-flex; align-items: center; }
.gst-toggle {
  width: 44px; height: 24px; border-radius: 999px;
  background: #cbd5e1; position: relative; cursor: pointer;
  transition: background 0.2s;
}
.gst-toggle.on { background: #7c3aed; }
.gst-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.gst-toggle.on .gst-toggle-thumb { transform: translateX(20px); }

/* ═══ Export Option Cards ════════════════════════════════════ */
.export-option-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s;
}
.export-option-card:hover { border-color: #bae6fd; }
.export-option-icon { font-size: 1.6rem; }
.export-option-label { font-weight: 700; font-size: 0.95rem; color: #1e293b; }
.export-option-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; flex: 1; margin-bottom: 0.25rem; }
.export-option-card .btn { margin-top: auto; align-self: flex-start; }

/* ═══ Onboarding Checklist ═══════════════════════════════════ */
.ob-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.6rem;
}
.ob-item:hover { background: #f0f9ff; }
.ob-item.done { background: #f0fdf4; border-color: #bbf7d0; opacity: 0.7; }
.ob-check {
  font-size: 1.3rem;
  color: #0284c7;
  flex-shrink: 0;
  width: 26px;
  text-align: center;
  line-height: 1.4;
}
.ob-item.done .ob-check { color: #16a34a; }
.ob-body strong { display: block; font-size: 0.92rem; color: #1e293b; margin-bottom: 0.2rem; }
.ob-body p { font-size: 0.82rem; color: #64748b; margin: 0 0 0.3rem; }
.ob-action { font-size: 0.78rem; color: #0284c7; font-weight: 600; }
.ob-item.done .ob-action { color: #16a34a; }
