/* ==========================================
   Villa Sahores - FEFI Dashboard
   Modern Design System
   ========================================== */

/* CSS Variables */
:root {
  /* Brand Colors */
  --brand-green: #1a8c4a;
  --brand-green-light: #22a85a;
  --brand-green-dark: #14683a;
  --brand-black: #0a0a0a;
  
  /* Light Theme */
  --bg: #f5f5f5;
  --bg-alt: #ebebeb;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  
  --text: #0a0a0a;
  --text-secondary: #525252;
  --text-muted: #737373;
  --text-on-brand: #ffffff;
  
  /* Semantic Colors */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #ca8a04;
  --warning-bg: #fef9c3;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  
  /* Effects */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --bg-alt: #171717;
    --surface: #171717;
    --surface-elevated: #1f1f1f;
    --border: #262626;
    --border-light: #1f1f1f;
    
    --text: #fafafa;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    
    --success-bg: rgba(22, 163, 74, 0.15);
    --warning-bg: rgba(202, 138, 4, 0.15);
    --danger-bg: rgba(220, 38, 38, 0.15);
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  }
}

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

/* Base */
html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

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

a:hover {
  color: var(--brand-green-light);
}

/* Sport Selector */
.sport-selector {
  background: var(--brand-black);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sport-selector::-webkit-scrollbar {
  display: none;
}

.sport-selector-row {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  padding: 4px;
  max-width: 600px;
  width: fit-content;
  min-width: 0;
}

.sport-btn {
  flex: 1 0 auto;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  transition: all var(--transition-base);
  white-space: nowrap;
}

.sport-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}

.sport-btn.active {
  background: var(--brand-green);
  color: white;
  box-shadow: 0 2px 8px rgba(26, 140, 74, 0.4);
}

@media (max-width: 600px) {
  .sport-selector {
    padding: 8px 0;
  }

  .sport-selector-row {
    max-width: none;
  }

  .sport-btn {
    padding: 8px 14px;
    font-size: 12px;
  }
}

/* Utility: hide on mobile */
.hide-mobile { }
@media (max-width: 480px) {
  .hide-mobile { display: none; }
}

/* Hero Header */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--brand-black) 0%, #1a1a1a 100%);
  padding: 32px 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(26, 140, 74, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(26, 140, 74, 0.1) 0%, transparent 40%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.club-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--brand-green);
  box-shadow: 0 0 20px rgba(26, 140, 74, 0.4);
}

.hero-text h1 {
  font-size: 28px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 4px;
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.tournament-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(26, 140, 74, 0.2);
  border: 1px solid rgba(26, 140, 74, 0.4);
  padding: 10px 16px;
  border-radius: var(--radius-full);
}

.badge-label {
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.badge-zona {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-green-light);
  background: rgba(26, 140, 74, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.updated {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* Navigation Bar */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  backdrop-filter: blur(12px);
}

.cat-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px;
}

.cat-selector::-webkit-scrollbar {
  display: none;
}

.cat-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.cat-btn:hover {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--text-muted);
}

.cat-btn.active {
  background: var(--brand-green);
  color: white;
  border-color: var(--brand-green);
  box-shadow: 0 2px 8px rgba(26, 140, 74, 0.3);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 24px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--brand-green);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-green);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  margin-bottom: 24px;
}

.col-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.col-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-featured {
  border-color: var(--brand-green);
  box-shadow: 0 0 0 1px var(--brand-green), var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.icon {
  width: 18px;
  height: 18px;
  color: var(--brand-green);
}

.card-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-green);
  background: rgba(26, 140, 74, 0.1);
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

.card-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Match Content */
.match-content {
  padding: 24px 20px;
}

.match-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
}

.team-block {
  text-align: center;
}

.team-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.team-name.highlight {
  color: var(--brand-green);
}

.team-condition {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.vs-badge {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
  border: 2px solid var(--border);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.match-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.match-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.match-meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.match-prediction {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(26, 140, 74, 0.08);
  border: 1px solid rgba(26, 140, 74, 0.2);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text);
}

.match-prediction strong {
  color: var(--brand-green);
}

/* Scouting Section */
.match-scouting {
  margin-top: 16px;
}

.match-scouting:empty {
  display: none;
}

.scouting-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #6366f1;
  cursor: pointer;
  transition: all var(--transition-base);
}

@media (prefers-color-scheme: light) {
  .scouting-header {
    color: #4f46e5;
  }
}

.scouting-header:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.12) 100%);
}

.scouting-header .scouting-icon {
  font-size: 16px;
}

.scouting-header .scouting-toggle {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.scouting-list {
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.scouting-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(99, 102, 241, 0.08);
  transition: background var(--transition-fast);
}

.scouting-item:last-child {
  border-bottom: none;
}

.scouting-item:hover {
  background: rgba(99, 102, 241, 0.04);
}

.scouting-cat-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 6px;
}

.scouting-text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.scouting-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.scouting-list.collapsed {
  max-height: 0;
  opacity: 0;
}

/* Form Row */
.form-row {
  display: flex;
  gap: 10px;
  padding: 20px;
  flex-wrap: wrap;
}

.form-pill {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: transform var(--transition-fast);
}

.form-pill:hover {
  transform: scale(1.1);
}

.form-pill.W {
  background: var(--success-bg);
  color: var(--success);
}

.form-pill.D {
  background: var(--warning-bg);
  color: var(--warning);
}

.form-pill.L {
  background: var(--danger-bg);
  color: var(--danger);
}

.form-empty {
  padding: 20px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Standings Table */
.table-wrapper {
  overflow-x: auto;
}

.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.standings th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.standings th.center {
  text-align: center;
}

.standings td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.standings td.center {
  text-align: center;
}

.standings tbody tr:hover {
  background: var(--bg-alt);
}

.standings tr:last-child td {
  border-bottom: none;
}

.standings tr.highlight {
  background: rgba(26, 140, 74, 0.08);
}

.standings tr.highlight:hover {
  background: rgba(26, 140, 74, 0.12);
}

.standings tr.highlight td {
  font-weight: 600;
}

.standings tr.highlight .team-col {
  color: var(--brand-green);
}

.standings .pts {
  font-weight: 700;
  color: var(--text);
}

.standings .pos {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.team-col {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  max-height: 400px;
  overflow-y: auto;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.history-item:hover {
  background: var(--bg-alt);
}

.history-item:last-child {
  border-bottom: none;
}

.history-result {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.history-result.W {
  background: var(--success-bg);
  color: var(--success);
}

.history-result.D {
  background: var(--warning-bg);
  color: var(--warning);
}

.history-result.L {
  background: var(--danger-bg);
  color: var(--danger);
}

.history-rival {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.history-rival-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-rival-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.history-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  background: var(--bg-alt);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

/* Schedule Grid */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1px;
  background: var(--border);
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  transition: background var(--transition-fast);
}

.schedule-item:hover {
  background: var(--bg-alt);
}

.schedule-item.played {
  opacity: 0.5;
}

.schedule-num {
  font-weight: 700;
  font-size: 12px;
  color: var(--brand-green);
  background: rgba(26, 140, 74, 0.1);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  min-width: 40px;
  text-align: center;
}

.schedule-info {
  flex: 1;
  min-width: 0;
}

.schedule-rival {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-condition {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.schedule-address {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-date {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* Footer */
footer {
  background: var(--brand-black);
  padding: 32px 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand-green);
}

.footer-text p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.footer-credits {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

.footer-credits a {
  color: var(--brand-green-light);
}

/* Loading State */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .two-col {
    grid-template-columns: 1fr;
  }
  
  .col-side {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .col-side {
    grid-template-columns: 1fr;
  }
  
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .hero-right {
    align-items: flex-start;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .main-content {
    padding: 24px 16px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-value {
    font-size: 24px;
  }
  
  .hero-text h1 {
    font-size: 22px;
  }
  
  .club-logo {
    width: 64px;
    height: 64px;
  }
  
  .match-teams {
    gap: 12px;
  }
  
  .team-name {
    font-size: 15px;
  }
  
  .standings th,
  .standings td {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Futsal Extras */
.location-link {
  color: var(--brand-green-light);
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.location-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.history-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.btn-planilla {
  background: var(--bg-alt);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.btn-planilla:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.schedule-venue {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
