/* SHARP Raffle System — Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; }

body { font-family: 'Inter', Arial, Helvetica, sans-serif; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Sidebar ─── */
#sidebar {
  transition: width 0.3s ease, transform 0.3s ease;
  min-height: 100vh;
}
#sidebar.collapsed { width: 0 !important; overflow: hidden; }

/* ─── Nav active item ─── */
.nav-item { position: relative; }
.nav-item.active {
  background-color: #E60012 !important;
  color: #fff !important;
}
.nav-item.active svg { color: #fff !important; }
.nav-item:not(.active):hover { background-color: #1f2937; color: #fff; }

/* ─── Toast ─── */
#toast {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
#toast.toast-show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ─── Status Badges ─── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-draft     { background: #f3f4f6; color: #4b5563; }
.badge-testing   { background: #fef9c3; color: #a16207; }
.badge-completed { background: #dbeafe; color: #1d4ed8; }
.badge-archived  { background: #e5e7eb; color: #6b7280; }
.badge-success   { background: #dcfce7; color: #15803d; }
.badge-failed    { background: #fee2e2; color: #b91c1c; }
.badge-official  { background: #ede9fe; color: #6d28d9; }
.badge-partial   { background: #ffedd5; color: #c2410c; }
.badge-outofstock { background: #fee2e2; color: #b91c1c; }
.badge-flow      { background: #dbeafe; color: #1d4ed8; }
.badge-spin      { background: #ede9fe; color: #6d28d9; }
.badge-digit     { background: #fef9c3; color: #a16207; }
.badge-claimed       { background: #dcfce7; color: #15803d; }
.badge-notclaimed    { background: #f3f4f6; color: #4b5563; }
.badge-pending       { background: #fef9c3; color: #a16207; }
.badge-cancelled     { background: #fee2e2; color: #b91c1c; }
.badge-superadmin    { background: #fee2e2; color: #b91c1c; }
.badge-hqadmin       { background: #dbeafe; color: #1d4ed8; }
.badge-branchadmin   { background: #dcfce7; color: #15803d; }
.badge-operator      { background: #fef9c3; color: #a16207; }
.badge-viewer        { background: #f3f4f6; color: #4b5563; }

/* ─── Table ─── */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead th {
  background: #f9fafb;
  color: #374151;
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #f9fafb; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── Cards ─── */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ─── Digit Display ─── */
.digit-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'Courier New', 'Lucida Console', monospace;
}
.digit-group { display: flex; gap: 6px; }
.digit-char {
  background: #0f172a;
  color: #E60012;
  font-size: 5rem;
  font-weight: 900;
  min-width: 72px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px solid #1e293b;
  box-shadow: 0 0 20px rgba(230,0,18,0.25), inset 0 2px 4px rgba(0,0,0,0.4);
  text-shadow: 0 0 30px rgba(230,0,18,0.8);
  transition: none;
  line-height: 1;
}
.digit-sep {
  color: #E60012;
  font-size: 4rem;
  font-weight: 900;
  text-shadow: 0 0 20px rgba(230,0,18,0.6);
  align-self: center;
}
.digit-char.rolling { animation: digitFlash 0.08s ease-in-out; }

@keyframes digitFlash {
  0%   { opacity: 0.6; }
  50%  { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ─── Spin Wheel ─── */
.wheel-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 28px solid #E60012;
  filter: drop-shadow(0 2px 6px rgba(230,0,18,0.5));
  z-index: 10;
}

/* ─── Winner Card Animation ─── */
@keyframes winnerReveal {
  0%   { transform: scale(0.6) translateY(20px); opacity: 0; }
  70%  { transform: scale(1.04) translateY(0); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.winner-card { animation: winnerReveal 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ─── Confetti ─── */
.confetti-piece {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ─── Dropzone ─── */
.dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  transition: border-color 0.2s, background-color 0.2s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over { border-color: #E60012; background: #fff1f2; }

/* ─── Spinner ─── */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinner { animation: spin 0.8s linear infinite; }

/* ─── Checklist ─── */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.875rem;
}
.checklist-item.done { background: #f0fdf4; color: #15803d; }
.checklist-item.pending { background: #fafafa; color: #6b7280; }
.checklist-item .check-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.checklist-item.done .check-icon { background: #16a34a; color: #fff; }
.checklist-item.pending .check-icon { background: #e5e7eb; color: #9ca3af; }

/* ─── Progress bar ─── */
.progress-bar { height: 6px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #E60012, #ff3333); transition: width 0.4s ease; }

/* ─── Mobile sidebar overlay ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 1024px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
  }
  #sidebar.mobile-open {
    transform: translateX(0);
    width: 256px !important;
  }
  .sidebar-overlay { display: none; }
  .sidebar-overlay.show { display: block; }
}

/* ─── Raffle Flow shuffle text ─── */
@keyframes shuffleFlash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}
.shuffle-text { animation: shuffleFlash 0.1s ease-in-out; font-family: 'Inter', sans-serif; }

/* ─── Modal ─── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Tab underline ─── */
.tab-btn {
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: #111; }
.tab-btn.active { color: #E60012; border-color: #E60012; }

/* ─── Raffle display pages (dark bg) ─── */
.raffle-page-bg {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  min-height: 100vh;
}

/* ─── Print / Export clean ─── */
@media print {
  #sidebar, header, .no-print { display: none !important; }
  main { margin: 0; padding: 0; }
}
