/* ══════════════════════════════════════════════════════════════════════════
   Epic Warriors Clubhouse - Design System
   ══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */

:root {
  /* Primary colors */
  --midnight: #0B0F14;
  --emerald: #0E3B2E;
  --fairway: #1F6F4A;
  --gold: #D4AF37;
  --gold-bright: #E5C54B;
  --gold-dim: #B8962F;
  --white: #F2F2F2;

  /* Extended palette */
  --danger: #EF4444;
  --success: #22C55E;
  --muted: #7D8790;
  --panel-dark: #141A22;
  --panel-border: #1E2A36;
  --panel-hover: #1A2230;

  /* Status colors */
  --amber: #F59E0B;
  --hot-gold: #FFD700;

  /* Glass effect */
  --glass-bg: rgba(11, 15, 20, 0.65);
  --glass-border: rgba(212, 175, 55, 0.3);

  /* Typography */
  --font-heading: 'Cinzel', 'Playfair Display', serif;
  --font-body: 'Inter', 'Source Sans Pro', sans-serif;

  /* Spacing */
  --max-width: 960px;
  --section-pad-y: 40px;
  --section-pad-x: 20px;
  --radius: 12px;
  --radius-sm: 8px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-med: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */

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

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

body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--white);
  background-color: var(--midnight);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover { color: var(--gold-bright); }

img { max-width: 100%; height: auto; display: block; }

/* ── Background ────────────────────────────────────────────────────────── */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('/images/hero-bg.webp') center/cover no-repeat;
}

.page-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 767px) {
  .page-bg {
    background-image: url('/images/hero-bg-mobile.webp');
  }
}

/* ── Navigation ────────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 20, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  padding: 0 var(--section-pad-x);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--gold);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.nav-brand img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}

.nav-links a {
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Hamburger menu */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  margin: 5px 0;
  transition: all var(--transition-fast);
  border-radius: 2px;
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 767px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(11, 15, 20, 0.97);
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    border-bottom: 1px solid var(--panel-border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 8px 0; font-size: 1rem; }
}

/* ── Main Content Container ────────────────────────────────────────────── */

.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--section-pad-y) var(--section-pad-x);
}

/* ── Typography ────────────────────────────────────────────────────────── */

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--gold);
  line-height: 1.3;
}

h1 { font-size: 2rem; font-weight: 700; letter-spacing: 2px; }
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.875rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.text-gold { color: var(--gold); }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }

/* ── Hero Section ──────────────────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 60px 20px 48px;
  animation: fadeIn var(--transition-slow) ease-out;
}

.hero-crest {
  width: 220px;
  height: 220px;
  margin: 0 auto 24px;
  filter: drop-shadow(0 4px 24px rgba(212, 175, 55, 0.3));
}

.hero h1 {
  font-size: 2.5rem;
  letter-spacing: 4px;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--white);
  margin-bottom: 8px;
  opacity: 0.9;
}

.hero-tagline {
  font-size: 0.875rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .hero { padding: 40px 16px 32px; }
  .hero-crest { width: 140px; height: 140px; }
  .hero h1 { font-size: 1.75rem; letter-spacing: 2px; }
  .hero-subtitle { font-size: 1rem; }
}

/* ── Glass Panel ───────────────────────────────────────────────────────── */

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 24px;
}

/* ── Solid Panel ───────────────────────────────────────────────────────── */

.panel {
  background: var(--panel-dark);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.4;
}

.btn-primary {
  background: var(--gold);
  color: var(--midnight);
}

.btn-primary:hover {
  background: var(--gold-bright);
  transform: scale(1.02);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
  color: var(--midnight);
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-bright);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-danger:hover {
  background: #DC2626;
  transform: scale(1.02);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--panel-border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 42, 54, 0.5);
  vertical-align: middle;
}

tbody tr:nth-child(even) {
  background: rgba(20, 26, 34, 0.5);
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--panel-hover);
}

/* Leaderboard specific */
.rank-num {
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
}

.score-perfect {
  color: var(--hot-gold);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

.score-perfect::after {
  content: ' ★';
  font-size: 0.75rem;
}

.score-zero {
  color: #ef4444;
  font-weight: 700;
}

.score-poor {
  color: #f87171;
}

.score-weak {
  color: #d97706;
}

/* Status flags */
.flag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.flag-inactive { background: rgba(245, 158, 11, 0.2); color: var(--amber); }
.flag-low { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.flag-hot { background: rgba(255, 215, 0, 0.2); color: var(--hot-gold); }
.flag-under { background: rgba(239, 68, 68, 0.2); color: var(--danger); }

/* ── Participation Bar ─────────────────────────────────────────────────── */

.progress-track {
  background: var(--panel-border);
  border-radius: 12px;
  height: 20px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  height: 100%;
  border-radius: 12px;
  transition: width var(--transition-slow);
  min-width: 2px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Stats Cards ───────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel-dark);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(20, 26, 34, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.form-control::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237D8790'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Alerts / Feedback ─────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.alert-info {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: var(--gold);
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-btn:hover { color: var(--white); }

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.tab-content {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-content.active {
  display: block;
}

/* ── Quick Link Cards ──────────────────────────────────────────────────── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.link-card:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.link-card-icon {
  font-size: 1.5rem;
}

.link-card-title {
  font-family: var(--font-heading);
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 600;
}

.link-card-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Loading / Empty States ────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--panel-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-state,
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  background: rgba(11, 15, 20, 0.92);
  border-top: 1px solid var(--panel-border);
  padding: 20px var(--section-pad-x);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-inner a {
  color: var(--muted);
  font-size: 0.75rem;
}

.footer-inner a:hover { color: var(--gold); }

/* ── Animations ────────────────────────────────────────────────────────── */

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

.animate-in {
  animation: slideUp var(--transition-slow) ease-out both;
}

/* Staggered row animation */
.stagger-row {
  animation: fadeIn 0.3s ease-out both;
}

/* ── Reduced Motion ────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Utility Classes ───────────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.hidden { display: none !important; }

/* ── Modal / Dialog ────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--panel-dark);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 {
  margin-bottom: 16px;
}

/* ── WYSIWYG Editor ────────────────────────────────────────────────────── */

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: rgba(20, 26, 34, 0.8);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.editor-toolbar button {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  color: var(--white);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.editor-toolbar button:hover {
  background: var(--panel-hover);
  border-color: var(--gold);
}

.editor-area {
  min-height: 200px;
  padding: 16px;
  background: rgba(20, 26, 34, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.6;
  outline: none;
}

.editor-area:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

/* ── Search ────────────────────────────────────────────────────────────── */

.search-input {
  padding: 8px 14px 8px 36px;
  background: rgba(20, 26, 34, 0.8) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%237D8790'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.442.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.875rem;
  width: 100%;
  max-width: 300px;
  transition: border-color var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  :root {
    --section-pad-y: 24px;
    --section-pad-x: 16px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .modal { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
}
