/* ==========================================================================
   Preflight / reset — replaces what Tailwind's CDN preflight used to do.
   Needed now that the CDN script is gone, otherwise the browser's own
   default styling shows through: underlined links, native button chrome,
   default heading/paragraph margins, bulleted lists, etc.
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

h1, h2, h3, h4, h5, h6, p, blockquote, figure { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; margin: 0; padding: 0; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 0;
}
button, input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="search"], input[type="url"],
input[type="date"], input[type="datetime-local"], textarea, select {
  appearance: none;
  -webkit-appearance: none;
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
}
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

img, svg, canvas, video { display: block; max-width: 100%; height: auto; }

table { border-collapse: collapse; border-spacing: 0; }

/* ==========================================================================
   LuckyWheel — Design tokens & component styles
   Palette: deep indigo-night base, molten-amber accent (the "win" color),
   electric-cyan secondary (the "you" highlight on the wheel).
   ========================================================================== */

:root {
  --bg: #0b0e1a;
  --bg-elevated: #12162a;
  --bg-card: #161b31;
  --border: #232945;
  --text: #e7e9f5;
  --text-dim: #8b90ad;
  --accent: #f5a524;       /* amber — prize / CTA */
  --accent-2: #22d3ee;     /* cyan — "you" highlight */
  --accent-3: #a78bfa;     /* violet — secondary */
  --success: #34d399;
  --warning: #f5a524;
  --danger: #f87171;
  --radius: 16px;
  --radius-sm: 10px;

  /* Chrome / structural — admin-editable via Theme & Content */
  --header-bg: #0b0e1acc;
  --sidebar-bg: var(--bg-elevated);
  --navbar-bg: var(--bg-elevated);
  --footer-bg: var(--bg-elevated);
  --btn-bg: var(--accent);
  --btn-bg-hover: #e8891a;
  --btn-text: #1a1200;
  --link-color: var(--accent-2);
  --active-menu-color: var(--accent);
  --modal-bg: var(--bg-card);
  --input-bg: var(--bg-elevated);
  --input-border: var(--border);
  --table-header-bg: var(--bg-elevated);
  --table-row-hover: rgba(255,255,255,.03);
}

[data-theme="light"] {
  --bg: #f6f5f2;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: #e6e3da;
  --text: #1c1a15;
  --text-dim: #6b6656;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: background .25s ease, color .25s ease;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: none;
}

.font-display {
  font-family: 'Sora', 'Inter', sans-serif;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 100%;
}

main {
  max-width: 100vw;
  overflow-x: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--btn-bg), var(--btn-bg-hover));
  color: var(--btn-text);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 6px 20px -6px rgba(245,165,36,.55);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px -6px rgba(245,165,36,.65); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }

.input-field {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.input-field:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(34,211,238,.15);
}
select.input-field {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b90ad' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
}

a { color: var(--link-color); }

table thead tr { background: var(--table-header-bg); }
table tbody tr:hover { background: var(--table-row-hover); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-pending  { background: rgba(245,165,36,.15); color: var(--accent); }
.badge-approved { background: rgba(52,211,153,.15); color: var(--success); }
.badge-rejected { background: rgba(248,113,113,.15); color: var(--danger); }

/* ---------- Mobile bottom nav (app-style) ---------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--navbar-bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  font-size: .68rem;
  color: var(--text-dim);
}
.bottom-nav a.active { color: var(--active-menu-color); }
.bottom-nav svg { width: 22px; height: 22px; }

/* ---------- Desktop sidebar ---------- */
.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  font-size: .92rem;
}
.sidebar a.active, .sidebar a:hover {
  background: rgba(245,165,36,.08);
  color: var(--active-menu-color);
}

/* ---------- Top header bar ---------- */
.topbar {
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  overflow-x: hidden;
}
.topbar h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Wheel ---------- */
.wheel-wrap {
  position: relative;
  width: min(88vw, 380px);
  aspect-ratio: 1/1;
  margin: 0 auto;
}
.wheel-pointer {
  position: absolute;
  top: -6px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 26px solid var(--accent);
  z-index: 10;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
}
.wheel-hub {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 18%; height: 18%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd98a, var(--accent) 70%);
  border: 3px solid var(--bg);
  z-index: 5;
  box-shadow: 0 0 0 3px var(--border);
}

/* ---------- Confetti modal ---------- */
.win-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,6,14,.78);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.win-modal {
  background: linear-gradient(160deg, var(--modal-bg), var(--bg-elevated));
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 0 60px -10px rgba(245,165,36,.5);
  animation: winPop .4s cubic-bezier(.2,1.4,.4,1);
}
@keyframes winPop {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.confetti-piece {
  position: fixed;
  top: -12px;
  width: 8px; height: 14px;
  z-index: 99;
  pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .9; }
}

/* ---------- Misc ---------- */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.pulse-live {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(52,211,153,.6);
  animation: pulseLive 1.6s infinite;
}
@keyframes pulseLive {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); }
  70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

@media (max-width: 767px) {
  .desktop-only { display: none !important; }
  main { padding-bottom: 84px; }
}
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}
