/* ============================================
   BetOpus Design System — CSS Foundation
   BetOpus UI Redesign
   ============================================ */

/* === CSS Variables === */
:root {
  /* Backgrounds */
  --bg-primary:      #1a1a1a;
  --bg-secondary:    #2a2a2a;
  --bg-tertiary:     #333333;
  --bg-input:        #242424;

  /* Accent (orange) */
  --accent:          #E87443;
  --accent-hover:    #F08A5D;
  --accent-muted:    rgba(232, 116, 67, 0.12);
  --accent-glow:     0 0 20px rgba(232, 116, 67, 0.25);

  /* Text */
  --text-primary:    #E8E0D8;
  --text-secondary:  #A89F97;
  --text-muted:      #6B6460;

  /* Borders */
  --border:          #333333;
  --border-subtle:   #2a2a2a;

  /* Status */
  --success:         #4CAF50;
  --error:           #EF5350;
  --warning:         #FFB74D;
  --info:            #64B5F6;

  /* Fonts */
  --font-sans:       'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:       'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Radii */
  --radius-sm:       4px;
  --radius-md:       8px;
  --radius-lg:       12px;
  --radius-xl:       16px;
}

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* === Body === */
body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
  font-size: 15px;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Text Selection === */
::selection {
  background: var(--accent-muted);
  color: var(--text-primary);
}

/* === Container === */
.container { max-width: 1200px; margin: 0 auto; }

/* === Page Header === */
.page-header {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
  overflow: hidden;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* === Logo === */
.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo:hover { color: var(--accent); }

.logo-icon {
  width: 24px;
  height: 24px;
  border-radius: 0;
  flex-shrink: 0;
}

/* === Navigation Tabs === */
.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-tab.active {
  color: var(--accent);
  background: var(--accent-muted);
}

.nav-admin .nav-tab {
  color: var(--text-muted);
}

.nav-admin .nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-admin .nav-tab.active {
  color: var(--accent);
  background: var(--accent-muted);
}

/* === Header Right === */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#authArea {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* === Auth Button === */
.auth-btn {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s;
}

.auth-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-tertiary);
}

/* === Online Counter === */
.online-counter {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
}

.online-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-online 2s ease-in-out infinite;
}

@keyframes pulse-online {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === Stats Strip === */
.stats-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  gap: 24px;
  flex-wrap: wrap;
  background: transparent;
}

.stats-main {
  display: flex;
  align-items: center;
  gap: 22px;
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: filter 0.2s;
}

.stat-block:hover {
  filter: brightness(1.3);
}

.stat-num {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-block.win .stat-num { color: var(--success); }
.stat-block.lose .stat-num { color: var(--error); }
.stat-block.skip .stat-num { color: var(--text-muted); }
.stat-block.ai-info .stat-num { color: var(--accent); }

.stat-divider {
  color: var(--border);
  font-size: 18px;
  line-height: 32px;
}

.stat-divider::before {
  content: ':';
}

/* === AI Badge (shimmer) === */
.ai-badge {
  background: linear-gradient(90deg, #b85a30 0%, #E87443 30%, #F08A5D 50%, #E87443 70%, #b85a30 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* === Admin Only === */
.admin-only { display: none; }

/* === Buttons === */
.btn-primary {
  font-family: var(--font-sans);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  font-family: var(--font-sans);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-save {
  font-family: var(--font-sans);
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.btn-save:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* === Cards === */
.card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s;
}

.card:hover {
  border-color: rgba(232, 116, 67, 0.2);
}

/* === Modals === */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active { display: flex; }

/* === Stats History Modal === */
.stats-history-modal {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  width: 800px;
  max-width: 90%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stats-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
}

.stats-history-header h3 {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
  margin: 0;
}

.stats-history-close {
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
  user-select: none;
}

.stats-history-close:hover {
  color: var(--text-primary);
}

.stats-history-controls {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.period-btn {
  font-size: 11px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.period-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.15);
}

.period-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: rgba(232, 116, 67, 0.3);
}

.stats-history-meta {
  display: flex;
  gap: 20px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.stat-meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-meta-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-meta-value {
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stats-history-chart {
  padding: 22px;
  height: 400px;
  flex: 1;
  overflow: hidden;
}

#statsHistoryChart {
  width: 100% !important;
  height: 100% !important;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.modal-buttons button {
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: transparent;
  color: var(--text-secondary);
}

.modal-buttons button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-buttons .btn-save {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.modal-buttons .btn-save:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* X button (top-right corner) */
.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-family: var(--font-sans);
  line-height: 1;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* Full-width close button (bottom of modal) */
.modal-close-btn {
  font-family: var(--font-sans);
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 16px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* === Modal Control === */
.modal-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-control label {
  color: var(--text-muted);
  font-size: 13px;
  min-width: 100px;
}

.modal-control input[type="text"],
.modal-control input[type="number"],
.modal-control input[type="password"] {
  font-family: var(--font-sans);
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.modal-control input:focus {
  border-color: rgba(232, 116, 67, 0.5);
}

/* === Form Inputs (global) === */
.form-input {
  font-family: var(--font-sans);
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: rgba(232, 116, 67, 0.5);
}

.form-input::placeholder { color: var(--text-muted); }

/* === Toggle Switch === */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 15px;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
  left: 21px;
  background: #fff;
}

.toggle-label {
  cursor: pointer;
}

.toggle-label.active {
  color: var(--accent);
}

/* === Site Logo (Avatar) === */
.site-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid var(--border-subtle);
  background: var(--bg-primary);
  padding: 2px;
  transition: transform 0.2s, border-color 0.2s;
}

.site-logo:hover {
  transform: scale(1.1);
  border-color: var(--border);
}

/* === Footer === */
.site-footer {
  text-align: center;
  padding: 30px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.support-email {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* === Header Loader (FOUC prevention) === */
#header-root:empty { min-height: 110px; }

/* === Utility === */
.scrollbar-hidden::-webkit-scrollbar { display: none; }
.scrollbar-hidden { -ms-overflow-style: none; scrollbar-width: none; }
