/* =====================================================
   GHINS e-sport Tracker — Vanilla CSS
   ===================================================== */

:root {
  --bg:            #06041A;
  --surface:       rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --purple:        #7C3AED;
  --purple-mid:    #8B5CF6;
  --purple-light:  #A78BFA;
  --purple-dark:   #4C1D95;
  --purple-glow:   rgba(124,58,237,0.25);
  --text:          #E2E8F0;
  --text-muted:    #94A3B8;
  --text-dim:      #475569;
  --green:         #10B981;
  --green-dim:     rgba(16,185,129,0.15);
  --red:           #EF4444;
  --red-dim:       rgba(239,68,68,0.15);
  --yellow:        #F59E0B;
  --yellow-dim:    rgba(245,158,11,0.15);
  --radius:        14px;
  --radius-sm:     8px;
  --sidebar:       240px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    repeating-linear-gradient(132deg,
      transparent 0px, transparent 40px,
      rgba(109,40,217,.03) 40px, rgba(109,40,217,.03) 41px),
    repeating-linear-gradient(52deg,
      transparent 0px, transparent 40px,
      rgba(109,40,217,.03) 40px, rgba(109,40,217,.03) 41px),
    radial-gradient(ellipse 80% 60% at -10% -10%, rgba(109,40,217,.2) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 110% 110%, rgba(109,40,217,.15) 0%, transparent 60%);
}

/* =====================================================
   SPLASH
   ===================================================== */
.splash {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100vh; gap: 24px;
}
.splash-logo {
  font-size: 52px; font-weight: 900; letter-spacing: 8px;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(124,58,237,.2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   LOGIN
   ===================================================== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}
.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 48px 40px;
  text-align: center;
  max-width: 420px; width: 100%;
  box-shadow: 0 0 80px rgba(124,58,237,.15), inset 0 1px 0 rgba(255,255,255,.06);
}
.login-logo {
  font-size: 40px; font-weight: 900; letter-spacing: 5px;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}
.login-tag {
  font-size: 11px; letter-spacing: 2.5px; color: var(--text-dim);
  text-transform: uppercase; margin-bottom: 32px;
}
.login-desc {
  font-size: 14px; color: var(--text-muted); line-height: 1.7; margin-bottom: 28px;
}
.login-info {
  background: rgba(124,58,237,.08);
  border: 1px solid rgba(124,58,237,.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 12px; color: var(--text-muted);
  margin-top: 16px; text-align: left; line-height: 1.6;
}

/* =====================================================
   BOUTONS
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; font-family: inherit;
  text-decoration: none; white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #6D28D9); color: #fff;
  box-shadow: 0 4px 15px rgba(124,58,237,.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(124,58,237,.5); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-discord {
  background: #5865F2; color: #fff; width: 100%; padding: 14px;
  font-size: 15px; border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(88,101,242,.3);
}
.btn-discord:hover { background: #4752c4; transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger {
  background: rgba(239,68,68,.12); color: var(--red);
  border: 1px solid rgba(239,68,68,.2);
}
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 5px; }

/* =====================================================
   LAYOUT
   ===================================================== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: rgba(255,255,255,0.025);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 24px 20px 4px;
  font-size: 22px; font-weight: 900; letter-spacing: 3px;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-sub {
  font-size: 9px; color: var(--text-dim);
  letter-spacing: 2px; text-transform: uppercase;
  padding: 0 20px 20px;
}
.sidebar-sep { border: none; border-top: 1px solid var(--border); margin: 0 16px 8px; }
.sidebar-section {
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim);
  padding: 8px 20px 4px;
}
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; margin: 2px 8px;
  border-radius: var(--radius-sm); color: var(--text-muted);
  cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all .15s; border: none; background: transparent;
  width: calc(100% - 16px); text-align: left; font-family: inherit;
}
.nav-btn:hover { background: var(--surface-hover); color: var(--text); }
.nav-btn.active {
  background: linear-gradient(135deg, rgba(124,58,237,.25), rgba(109,40,217,.12));
  color: var(--purple-light);
  border: 1px solid rgba(124,58,237,.2);
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  margin-top: auto; padding: 14px;
  border-top: 1px solid var(--border);
}
.user-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED, #4C1D95);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--purple-light); font-weight: 500; }
.logout-btn {
  background: transparent; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px; border-radius: 6px;
  font-size: 18px; transition: color .15s; line-height: 1;
}
.logout-btn:hover { color: var(--red); }

/* Main content */
.main { display: flex; flex-direction: column; min-height: 100vh; }
.page-header { padding: 28px 32px 0; }
.page-title { font-size: 26px; font-weight: 800; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.page-content { padding: 24px 32px 48px; flex: 1; }

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.card-glow { box-shadow: 0 0 30px rgba(124,58,237,.07); }
.card-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 16px;
}
.card-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-muted);
}

/* Stat cards */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  position: relative; overflow: hidden; transition: border-color .2s;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--purple), transparent);
}
.stat-card:hover { border-color: rgba(124,58,237,.3); }
.stat-icon { font-size: 22px; margin-bottom: 12px; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-wrap { position: relative; height: 240px; }

/* =====================================================
   TABLES
   ===================================================== */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,.04); transition: background .12s; }
tbody tr:hover { background: var(--surface-hover); }
tbody td { padding: 12px 14px; }
tbody tr:last-child { border-bottom: none; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
}
.badge-purple { background: rgba(124,58,237,.18); color: var(--purple-light); }
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-gray   { background: rgba(255,255,255,.06); color: var(--text-muted); }

/* Score bar */
.score-bar { display: flex; align-items: center; gap: 8px; }
.score-track {
  flex: 1; height: 4px; background: rgba(255,255,255,.06);
  border-radius: 100px; overflow: hidden;
}
.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--purple), var(--purple-light));
  border-radius: 100px; transition: width .5s ease;
}
.score-val { font-size: 12px; font-weight: 700; color: var(--purple-light); min-width: 30px; text-align: right; }

/* Ranks */
.rank { font-weight: 800; font-size: 13px; color: var(--text-dim); }
.rank-1 { color: #FFD700; }
.rank-2 { color: #C0C0C0; }
.rank-3 { color: #CD7F32; }

/* =====================================================
   FORMS
   ===================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .8px;
}
input, select, textarea {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px;
  font-family: inherit; padding: 10px 14px;
  transition: border-color .2s, box-shadow .2s;
  color-scheme: dark; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
option { background: #0F0F26; color: var(--text); }
textarea { resize: vertical; min-height: 80px; }

/* Criteria sliders */
.criteria-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.criterion { display: flex; flex-direction: column; gap: 10px; }
.criterion-hd { display: flex; justify-content: space-between; align-items: center; }
.criterion-lbl {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .8px;
}
.criterion-val {
  font-size: 20px; font-weight: 800; color: var(--purple-light); min-width: 20px; text-align: right;
}
input[type="range"] {
  -webkit-appearance: none;
  height: 5px; background: rgba(255,255,255,.08);
  border-radius: 100px; border: none; padding: 0; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--purple); border-radius: 50%;
  box-shadow: 0 0 8px rgba(124,58,237,.6);
  border: 2px solid rgba(255,255,255,.8);
}
input[type="range"]:focus { box-shadow: none; border: none; }

.total-box {
  background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(109,40,217,.06));
  border: 1px solid rgba(124,58,237,.22);
  border-radius: var(--radius); padding: 20px; text-align: center;
}
.total-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.total-num { font-size: 52px; font-weight: 900; line-height: 1; }
.total-max { font-size: 18px; color: var(--text-dim); }

/* =====================================================
   SESSION ITEMS
   ===================================================== */
.session-list { display: flex; flex-direction: column; gap: 10px; }
.session-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color .2s;
}
.session-item:hover { border-color: rgba(124,58,237,.25); }
.session-date {
  background: linear-gradient(135deg, rgba(124,58,237,.18), rgba(109,40,217,.08));
  border: 1px solid rgba(124,58,237,.2);
  border-radius: 10px; padding: 10px 14px; text-align: center; min-width: 58px;
}
.session-day { font-size: 24px; font-weight: 800; color: var(--purple-light); line-height: 1; }
.session-month { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.session-info { flex: 1; }
.session-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.session-meta { font-size: 12px; color: var(--text-muted); }
.session-time { font-size: 13px; font-weight: 600; color: var(--purple-light); }

/* =====================================================
   ALERTS / TOASTS
   ===================================================== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 16px;
}
.alert-error  { background: var(--red-dim);  border: 1px solid rgba(239,68,68,.25);  color: #FCA5A5; }
.alert-success{ background: var(--green-dim); border: 1px solid rgba(16,185,129,.25); color: #6EE7B7; }
.alert-info   { background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.25); color: var(--purple-light); }

#toast {
  position: fixed; bottom: 24px; right: 24px;
  background: rgba(12,8,35,.97);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px; font-size: 14px; font-weight: 500;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  z-index: 9999; max-width: 320px;
  transform: translateY(120px); opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: rgba(16,185,129,.4); }
#toast.error   { border-color: rgba(239,68,68,.4); }

/* =====================================================
   EMPTY STATES
   ===================================================== */
.empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; gap: 10px;
}
.empty-icon { font-size: 48px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-dim); }
.empty-desc  { font-size: 13px; color: var(--text-dim); max-width: 280px; line-height: 1.5; }

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal {
  background: #0D0A28;
  border: 1px solid var(--border);
  border-radius: 20px; padding: 28px;
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
}
.modal-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 22px; padding: 2px; line-height: 1;
  border-radius: 6px; transition: color .15s;
}
.modal-close:hover { color: var(--text); }

/* =====================================================
   ADMIN
   ===================================================== */
.role-select {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-size: 12px; font-family: inherit;
  padding: 4px 8px; cursor: pointer; color-scheme: dark;
}

/* =====================================================
   UTILITIES
   ===================================================== */
.flex   { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.mb-24  { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 11px; }
.font-bold  { font-weight: 700; }
.w-full     { width: 100%; }
.sep { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .criteria-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .page-content { padding: 16px 16px 40px; }
  .page-header { padding: 20px 16px 0; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; }
}
