/************************************************************
 *  ROOT VARIABLES
 ************************************************************/
:root {
  --bg-main: #050816;
  --bg-card: #111827;
  --bg-card-soft: #0b1020;
  --accent: #fbbf24;
  --accent-soft: rgba(251, 191, 36, 0.15);
  --accent-strong: #f59e0b;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --border-soft: rgba(148, 163, 184, 0.35);
  --danger: #f97373;
  --success: #34d399;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.8);
  --transition-fast: 0.18s ease-out;
}

/************************************************************
 *  GLOBAL
 ************************************************************/
*,
*::before,
*::after {
  box-sizing: border-box;
}

body.theme-dark {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, #1f2937 0, transparent 55%),
    radial-gradient(circle at bottom right, #111827 0, transparent 55%),
    var(--bg-main);
  color: var(--text);
}

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/************************************************************
 *  HEADER
 ************************************************************/
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 6vw;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  backdrop-filter: blur(14px);
  background: linear-gradient(to right, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.65));
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #facc15, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #111827;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.7);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.main-nav a {
  margin-left: 18px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  position: relative;
  padding-bottom: 4px;
}

.main-nav a.active,
.main-nav a:hover {
  color: var(--text);
}

.main-nav a.active::after,
.main-nav a:hover::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 65%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(to right, #facc15, #f97316);
}

/************************************************************
 *  CONTENT WRAPPER
 ************************************************************/
.content {
  flex: 1;
  padding: 26px 6vw 40px;
}

.content.narrow {
  max-width: 900px;
  margin: 0 auto;
}

/************************************************************
 *  HERO (TITLE)
 ************************************************************/
.hero-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-header-text h1 {
  font-size: 2rem;
  margin-bottom: 6px;
}

.hero-header-text span {
  color: #f97316;
}

/************************************************************
 *  HERO INFO CARDS
 ************************************************************/
.hero-info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-info-centered {
  margin-top: 12px;
  margin-bottom: 18px;
  justify-content: center;
}

.info-card {
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(17, 24, 39, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.35);
  min-width: 150px;
}

.info-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.info-card .value {
  margin-top: 4px;
  font-weight: 600;
}

/************************************************************
 *  LIVE CARD
 ************************************************************/
.hero-live-card {
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.16), transparent 65%),
              var(--bg-card);
  border: 1px solid rgba(248, 250, 252, 0.06);
  padding: 18px;
  box-shadow: var(--shadow-soft);
  max-width: 540px;
  margin-inline: auto;
}

.live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.9);
}

.live-label {
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}

.live-market {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/************************************************************
 *  COUNTDOWN
 ************************************************************/
.countdown-wrapper {
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(24, 31, 49, 0.95));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.35);
  margin-bottom: 18px;
}

.countdown-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.countdown {
  display: flex;
  gap: 10px;
}

.time-box {
  flex: 1;
  text-align: center;
  border-radius: 999px;
  padding: 8px 0;
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.2), #020617);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.time-box span {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
}

.time-box small {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/************************************************************
 *  RESULT DISPLAY
 ************************************************************/
.result-display {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(8, 47, 73, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.result-main-number {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 10px 0;
  border-radius: 999px;
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.22), #020617);
  border: 1px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.38);
}

.result-main-number.waiting {
  font-size: 1rem;
  letter-spacing: normal;
  border-style: dashed;
  box-shadow: none;
}

.result-sub {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
}

.result-sub > div {
  flex: 1;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.small-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.small-value {
  font-weight: 600;
  margin-top: 4px;
}

/************************************************************
 *  FULL RESULT PAGE
 ************************************************************/
.result-full-card {
  margin-top: 18px;
  border-radius: 18px;
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.15), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.55);
  padding: 16px;
}

.result-full-row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.result-full-row:last-child {
  border-bottom: none;
}

.result-full-label {
  width: 140px;
  font-size: 0.85rem;
  color: #9ca3af;
}

.result-full-main {
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  font-weight: 700;
}

.result-full-sub {
  font-size: 1rem;
  font-weight: 600;
}

.result-full-badges {
  flex: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge-number {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.6);
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.15), #020617);
}

.badge-number.badge-soft {
  border-color: rgba(59, 130, 246, 0.6);
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.18), #020617);
}

.badge-empty {
  font-size: 0.8rem;
  color: #6b7280;
}

/************************************************************
 *  TABLES (History & Admin)
 ************************************************************/
.history-table-wrapper {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background: var(--bg-card-soft);
  overflow: hidden;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.history-table thead {
  background: rgba(15, 23, 42, 0.95);
}

.history-table th,
.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.9);
}

.history-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.88);
}

/************************************************************
 *  BUTTONS
 ************************************************************/
.btn-ghost,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-ghost {
  border: 1px solid var(--accent);
  color: var(--accent-strong);
}

.btn-ghost:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.btn-ghost-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-primary {
  background: linear-gradient(to right, #facc15, #f97316);
  color: #111827;
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/************************************************************
 *  LINK BUTTONS (VIEW / EDIT / DELETE)
 ************************************************************/
.link-view,
.link-edit,
.link-delete {
  font-size: 0.78rem;
  margin-right: 6px;
  text-decoration: none;
}

.link-view { color: #facc15; }
.link-edit { color: #38bdf8; }
.link-delete { color: #f97373; }

.link-view:hover,
.link-edit:hover,
.link-delete:hover {
  text-decoration: underline;
}

/************************************************************
 *  INPUT + MINI BUTTONS (ADMIN)
 ************************************************************/
.input-with-btn {
  display: flex;
  gap: 6px;
}

.input-with-btn input,
.input-with-btn textarea {
  flex: 1;
}

.btn-mini {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.95);
  color: #e5e7eb;
  font-size: 0.75rem;
  padding: 4px 8px;
  cursor: pointer;
}

.btn-mini:hover {
  background: rgba(30, 64, 175, 0.9);
}

/************************************************************
 *  FOOTER
 ************************************************************/
.main-footer {
  padding: 12px 6vw 18px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(15, 23, 42, 0.9);
  background: rgba(15, 23, 42, 0.96);
}

.main-footer-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/************************************************************
 *  ADMIN SIDEBAR
 ************************************************************/
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 230px;
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.12), transparent 55%),
              #020617;
  border-right: 1px solid rgba(15, 23, 42, 0.9);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-logo {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #facc15, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.7);
}

.admin-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.admin-menu a.active,
.admin-menu a:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.9);
}

.logout-link {
  color: #f97373 !important;
}

.admin-user {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/************************************************************
 *  ADMIN MAIN
 ************************************************************/
.admin-main {
  flex: 1;
  padding: 20px 24px 30px;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.admin-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Admin cards */
.admin-cards {
  margin-top: 18px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-card {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.card-value {
  margin-top: 6px;
  font-size: 1.3rem;
  font-weight: 700;
}

.card-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/************************************************************
 *  ADMIN FORMS
 ************************************************************/
.admin-section {
  margin-top: 24px;
}

.admin-form {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-soft);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-form label,
.auth-form label {
  flex: 1;
  min-width: 170px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-form label span,
.auth-form label span {
  display: block;
  margin-bottom: 4px;
}

.admin-form input[type="text"],
.admin-form input[type="date"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 7px 9px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text);
  font-size: 0.85rem;
}

.admin-form input:focus,
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.45);
}

/************************************************************
 *  ALERTS
 ************************************************************/
.alert {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #bbf7d0;
}

.alert-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fecaca;
}

/************************************************************
 *  AUTH PAGE
 ************************************************************/
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  max-width: 360px;
  border-radius: var(--radius-xl);
  padding: 24px 20px;
  background: radial-gradient(circle at top, rgba(251, 191, 36, 0.22), transparent 70%),
              var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 14px;
}

/************************************************************
 *  RESPONSIVE
 ************************************************************/
@media (max-width: 900px) {
  .hero-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .content {
    padding-inline: 4vw;
  }
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .admin-menu {
    display: flex;
    flex: 1;
    gap: 6px;
  }
  .admin-main {
    padding-inline: 4vw;
  }
}
