/* NLC Sports - Modern Design System */
/* Based on SuperDesign patterns */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Design Tokens */
:root {
  /* Colors - Modern dark theme with sports blue accent */
  --background: oklch(0.12 0.01 250);
  --background-elevated: oklch(0.16 0.01 250);
  --foreground: oklch(0.95 0.01 250);
  --foreground-muted: oklch(0.65 0.02 250);
  
  --primary: oklch(0.55 0.22 255);
  --primary-hover: oklch(0.60 0.22 255);
  --primary-foreground: oklch(1 0 0);
  
  --secondary: oklch(0.25 0.03 255);
  --secondary-hover: oklch(0.30 0.03 255);
  
  --accent: oklch(0.70 0.18 35);
  --accent-foreground: oklch(0.12 0 0);
  
  --border: oklch(0.25 0.02 250);
  --border-subtle: oklch(0.20 0.02 250);
  
  /* Semantic colors */
  --success: oklch(0.65 0.20 145);
  --warning: oklch(0.75 0.18 85);
  --error: oklch(0.60 0.22 25);
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* Border radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 oklch(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 oklch(0 0 0 / 0.1), 0 1px 2px -1px oklch(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px oklch(0 0 0 / 0.1), 0 4px 6px -4px oklch(0 0 0 / 0.1);
  
  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition: 200ms ease-out;
  --transition-slow: 300ms ease-out;
  
  /* Layout */
  --sidebar-width: 240px;
}

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

/* Base */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-y: auto;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Layout */
.layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Header */
.top-header {
  background: var(--background-elevated);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3) var(--space-6);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.header-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--foreground);
  flex: 1;
  text-align: center;
}

.header-title a {
  color: var(--foreground);
  text-decoration: none;
}

.header-title a:hover {
  color: var(--primary);
}

/* User Avatar */
.header-user {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid transparent;
}

.header-user:hover {
  transform: scale(1.05);
  border-color: var(--primary-hover);
}

.header-user.guest {
  background: var(--secondary);
  color: var(--foreground-muted);
}

/* Login Modal */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: oklch(0 0 0 / 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.login-modal.active {
  opacity: 1;
  visibility: visible;
}

.login-box {
  background: var(--background-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  width: 100%;
  max-width: 360px;
  transform: translateY(-20px);
  transition: transform var(--transition);
}

.login-modal.active .login-box {
  transform: translateY(0);
}

.login-title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-6);
  text-align: center;
}

.login-field {
  margin-bottom: var(--space-4);
}

.login-field label {
  display: block;
  font-size: var(--text-sm);
  color: var(--foreground-muted);
  margin-bottom: var(--space-2);
}

.login-field input {
  width: 100%;
  padding: var(--space-3);
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
}

.login-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.login-error {
  color: var(--error);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  text-align: center;
  display: none;
}

.login-error.show {
  display: block;
}

.login-buttons {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: var(--font-sans);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

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

.btn-secondary:hover {
  background: var(--secondary-hover);
}

/* User Menu Dropdown */
.user-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: var(--space-2);
  background: var(--background-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  min-width: 150px;
  display: none;
  box-shadow: var(--shadow-lg);
}

.user-menu.show {
  display: block;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: none;
  border: none;
  color: var(--foreground);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.user-menu-item:hover {
  background: var(--secondary);
}

.header-user-wrapper {
  position: relative;
}

/* Main Layout with Sidebar */
.main-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--background-elevated);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-6);
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
}

.sidebar-logo {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-logo::before {
  content: '🏀';
  font-size: 1.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav a {
  color: var(--foreground-muted);
  text-decoration: none;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.sidebar-nav a.active {
  color: var(--primary);
  background: oklch(0.20 0.03 255 / 0.5);
}

/* Main Content */
.content {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-title .count {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--foreground-muted);
}

/* Search Box */
.search-wrapper {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
}

.search-box {
  width: 100%;
  max-width: 400px;
  padding: var(--space-3) var(--space-4);
  padding-left: var(--space-10);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--foreground);
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-box::placeholder {
  color: var(--foreground-muted);
}

.search-box:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px oklch(0.55 0.22 255 / 0.15);
}

/* Tables */
.table-container {
  background: var(--background-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground-muted);
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
  vertical-align: top;
}

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

tr:hover {
  background: oklch(0.18 0.01 250 / 0.5);
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Cards (for school records) */
.record-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: var(--secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--foreground-muted);
  margin-right: var(--space-2);
  margin-bottom: var(--space-1);
  transition: all var(--transition-fast);
}

.record-badge:hover {
  background: var(--secondary-hover);
  color: var(--foreground);
}

.record-badge a {
  color: inherit;
}

.record-badge .wins {
  color: var(--success);
}

.record-badge .losses {
  color: var(--error);
}

/* Season Detail Cards */
.season-card {
  background: var(--background-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
}

.season-header {
  padding: var(--space-3) var(--space-4);
  background: var(--secondary);
  border-bottom: 1px solid var(--border);
}

.season-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: var(--space-1);
}

.season-meta {
  font-size: var(--text-xs);
  color: var(--foreground-muted);
}

.season-games {
  padding: 0;
}

.season-games table {
  width: auto;
}

.season-games th,
.season-games td {
  padding: var(--space-2) var(--space-3);
}

/* Game Type Badges */
.game-type {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.game-type--sect { background: oklch(0.30 0.05 255); color: var(--primary); }
.game-type--regn { background: oklch(0.35 0.10 145); color: var(--success); }
.game-type--semi { background: oklch(0.35 0.10 85); color: var(--warning); }
.game-type--state { background: oklch(0.35 0.12 25); color: var(--error); }
.game-type--tny { background: var(--secondary); color: var(--foreground-muted); }

/* Result Badges */
.result {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 50%;
}

.result--W {
  background: oklch(0.25 0.15 145);
  color: var(--success);
}

.result--L {
  background: oklch(0.25 0.12 25);
  color: var(--error);
}

/* Overtime Badge */
.ot-badge {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--warning);
  background: oklch(0.25 0.05 85);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-12);
  color: var(--foreground-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .content {
    padding: var(--space-4);
  }
  
  .page-title {
    font-size: var(--text-2xl);
  }
  
  table {
    display: block;
    overflow-x: auto;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn var(--transition-slow) ease-out;
}

/* Utility Classes */
.text-muted { color: var(--foreground-muted); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
