/**
 * Basketball League Manager - CSS Styles
 * Professional styling for the basketball league management system
 */

/* CSS Variables for Theming */
:root {
  /* Athlete Institute Theme (charcoal / gold / grey / white - see base.css) */
  --primary: #9c8757;
  --primary-light: #b8a375;
  --primary-dark: #7d6c43;
  --primary-rgb: 156, 135, 87;
  /* Secondary/tertiary complete the 3-color Color Theme alongside --primary above (age
     badge, live-scoreboard foul badge - see the league_config table comment in
     config/database.php). These are fallback values only - the admin's actual chosen
     Color Theme (System Configuration > Color Theme, gear icon) overrides all 6
     primary/secondary/tertiary variables via a <style> block index.php injects into
     <head> after this file loads. Distinct from the --bg-tertiary/--text-tertiary/
     --border-tertiary neutral-scale tokens below, which are unrelated. */
  --secondary: #1e293b;
  --secondary-dark: #0f172a;
  --tertiary: #f59e0b;
  --success: #10b981;
  --success-rgb: 16, 185, 129;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  --danger: #ef4444;
  --danger-rgb: 239, 68, 68;
  --info: #3b82f6;
  --info-rgb: 59, 130, 246;

  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f4f2;
  --bg-tertiary: #ece9e4;

  /* Text Colors */
  --text-primary: #1e1e1e;
  --text-secondary: #86888b;
  --text-tertiary: #a7a9ac;

  /* Border Colors */
  --border-primary: #c7c9cc;
  --border-secondary: #a7a9ac;
  --border-tertiary: #e5e4e2;

  /* Card Styling */
  --card-bg: #ffffff;
  --card-border: #c7c9cc;

  /* Modal Styling */
  --modal-bg: #ffffff;
  --modal-overlay: rgba(30, 30, 30, 0.5);

  /* Radius scale */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadow scale - layered for more natural depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.06), 0 6px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.1);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.2s var(--ease);
  --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), 0.28);
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --primary: #b8a375;
  --primary-light: #cdbb92;
  --primary-dark: #9c8757;
  --primary-rgb: 184, 163, 117;
  --secondary: #1e293b;
  --secondary-dark: #0f172a;
  --tertiary: #f59e0b;
  --success: #34d399;
  --success-rgb: 52, 211, 153;
  --warning: #fbbf24;
  --warning-rgb: 251, 191, 36;
  --danger: #f87171;
  --danger-rgb: 248, 113, 113;
  --info: #60a5fa;
  --info-rgb: 96, 165, 250;

  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;

  --text-primary: #f5f5f4;
  --text-secondary: #b3b3b3;
  --text-tertiary: #86888b;

  --border-primary: #333333;
  --border-secondary: #444444;
  --border-tertiary: #2a2a2a;

  --card-bg: #1a1a1a;
  --card-border: #2f2f2f;

  --modal-bg: #1e1e1e;
  --modal-overlay: rgba(0, 0, 0, 0.75);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4);
  --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), 0.35);
}

/* Auto theme (System Configuration > Theme = "Auto") - only takes effect when no
   explicit [data-theme] attribute is on <html> at all (light/dark from System
   Configuration render that attribute server-side and always win over this). */
/* Deliberately does NOT redefine --primary/--primary-light/--primary-dark/--primary-rgb/
   --secondary/--secondary-dark/--tertiary: this selector's specificity (0,3,0) is higher
   than the injected <head> Color Theme override's plain `:root{}` (0,1,0), so redefining
   them here would win the cascade even over a later-in-document custom color - the
   opposite of what should happen. Leaving them out lets --focus-ring's
   var(--primary-rgb) keep resolving to whichever value actually wins normally. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --success: #34d399;
    --success-rgb: 52, 211, 153;
    --warning: #fbbf24;
    --warning-rgb: 251, 191, 36;
    --danger: #f87171;
    --danger-rgb: 248, 113, 113;
    --info: #60a5fa;
    --info-rgb: 96, 165, 250;

    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;

    --text-primary: #f5f5f4;
    --text-secondary: #b3b3b3;
    --text-tertiary: #86888b;

    --border-primary: #333333;
    --border-secondary: #444444;
    --border-tertiary: #2a2a2a;

    --card-bg: #1a1a1a;
    --card-border: #2f2f2f;

    --modal-bg: #1e1e1e;
    --modal-overlay: rgba(0, 0, 0, 0.75);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4);
    --focus-ring: 0 0 0 3px rgba(var(--primary-rgb), 0.35);
  }
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Consistent keyboard-focus ring for every interactive element that opts in */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* App Layout */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Navigation */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-primary);
  /* 112px = #league-icon's 80px logo (index.php) + this padding's 16px top/bottom
     - no longer load-bearing elsewhere (index.php's main content row used to size
     itself off a hardcoded calc(100vh - 60px) tied to this exact value, but that
     switched to flex:1/min-height:0 when the site footer was added - see
     includes/footer.php's own comment), so this is free to change on its own. */
  height: 112px;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--card-bg);
  border-right: 1px solid var(--border-primary);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.slink {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

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

.slink.active {
  background: var(--bg-tertiary);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sfooter {
  margin-top: auto;
  padding: 1rem 1.5rem;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: var(--bg-primary);
}

/* Print support - hides the app chrome (top nav/sidebar) so any view's own
   content prints cleanly on its own page, full width (removing .sidebar from the
   flex row lets .main-content's flex:1 fill the space automatically - no separate
   width override needed). .screen-only/.print-only let a view swap in
   print-specific content (e.g. team-player-stats.php's Print button vs. its
   "Printed on" line) without needing per-view print CSS. */
.print-only { display: none; }
@media print {
  .topnav, .sidebar, .screen-only { display: none !important; }
  .print-only { display: block; }
  .main-content { padding: 0; overflow: visible; }
  body { background: #fff; color: #000; }
}

/* Typography */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.btn-orange {
  background: var(--secondary);
  color: white;
  border-color: var(--secondary);
}

.btn-orange:hover {
  background: var(--secondary-dark);
  border-color: var(--secondary-dark);
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 12px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

/* Forms */
.form-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field.form-full {
  grid-column: 1 / -1;
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.form-input {
  padding: 0.75rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.form-input.field-valid {
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23198754'%3e%3cpath d='M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425a.247.247 0 0 1 .02-.022Z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem 1rem;
  padding-right: 3rem;
}

.form-input.field-invalid {
  border-color: var(--danger);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23dc3545'%3e%3cpath d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem 1rem;
  padding-right: 3rem;
}

.form-input.color-input {
  padding: 0.25rem;
  width: 4.5rem;
  height: 2.75rem;
  cursor: pointer;
}

/* Color Theme preset cards + the "Custom" tile in System Configuration - see
   renderThemeColorPicker() in script.js. Selection is a fixed --info ring rather than
   --primary itself, since --primary is literally the value being chosen here and
   using it to highlight its own picker would be confusing (and wouldn't reflect the
   in-progress choice until after a save+reload anyway). */
.theme-swatch {
  padding: 1rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: center;
}
.theme-swatch.selected {
  border-color: var(--info);
  box-shadow: 0 0 0 2px var(--info);
}
.theme-swatch-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin: 0 auto 0.5rem;
  border: 2px solid var(--border-secondary);
}
.theme-swatch-custom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--modal-bg);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Team Cards */
.team-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  cursor: pointer;
}

.team-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.team-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.team-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}

.age-badge {
  background: var(--secondary);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 500;
}

/* Game Cards */
.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.game-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.game-matchup {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-team {
  color: var(--text-primary);
}

.game-team-color {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-secondary);
}

.game-team-color-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 1px solid var(--border-primary);
  flex-shrink: 0;
}

.game-vs {
  color: var(--text-secondary);
  font-weight: 400;
}

.game-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-status {
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.game-status.scheduled {
  background: rgba(var(--info-rgb), 0.15);
  color: var(--info);
}

.game-status.live {
  background: rgba(var(--success-rgb), 0.15);
  color: var(--success);
  position: relative;
  padding-left: 1.25rem;
}

.game-status.live::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  transform: translateY(-50%);
  animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(var(--success-rgb), 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(var(--success-rgb), 0); }
}

.game-status.finished {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Organization Management Styles */
.organization-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
  cursor: pointer;
}

.organization-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.organization-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.organization-details {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.organization-detail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.organization-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-tertiary);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.organization-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.organization-actions {
  display: flex;
  gap: 0.5rem;
}

.organization-filters {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 2rem;
}

.filter-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select {
  padding: 0.5rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.search-input {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  min-width: 200px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.filter-stats {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Game Creation Styles */
.game-creation-form {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.game-form-section {
  margin-bottom: 2rem;
}

.game-form-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-selector {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
}

.team-select-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.team-select-card:hover {
  border-color: var(--primary);
  background: var(--bg-tertiary);
}

.team-select-card.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.team-select-card.empty {
  border-style: dashed;
  color: var(--text-secondary);
}

.vs-divider {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row-full {
  grid-column: 1 / -1;
}

.game-format-selector {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.format-option {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.format-option:hover {
  border-color: var(--primary);
}

.format-option.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* Deletion and Data Management Styles */
.delete-button {
  background: var(--danger);
  color: white;
  border: none;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.delete-button:hover {
  background: #b91c1c;
  transform: scale(1.05);
}

.confirmation-modal {
  background: var(--modal-overlay);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.confirmation-dialog {
  background: var(--modal-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-xl);
}

.confirmation-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.confirmation-message {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.confirmation-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.info {
  background: var(--info);
}

.toast.warning {
  background: var(--warning);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Live Scoresheet Styles */
.scoresheet-header-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

.scoreboard-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: center;
}

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

.scoreboard-team-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scoreboard-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.scoreboard-score {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.75rem;
}

.score-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.scoreboard-center {
  text-align: center;
  min-width: 180px;
}

.scoreboard-period {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.scoreboard-clock {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  margin: 0.25rem 0;
}

.team-fouls-badge {
  background: var(--tertiary);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

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

.roster-table th {
  text-align: left;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-primary);
}

.roster-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-tertiary);
  color: var(--text-primary);
}

.foul-count {
  font-weight: 700;
}

.foul-count.fouled-out {
  color: var(--danger);
}

.running-score-log {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-secondary) transparent;
}

.running-score-log::-webkit-scrollbar {
  width: 8px;
}

.running-score-log::-webkit-scrollbar-thumb {
  background: var(--border-secondary);
  border-radius: var(--radius-xs);
}

.running-score-log::-webkit-scrollbar-track {
  background: transparent;
}

.running-score-entry {
  display: grid;
  grid-template-columns: 50px 1fr 1fr 90px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-tertiary);
  font-size: 0.875rem;
}

.rs-period {
  font-weight: 700;
  color: var(--text-secondary);
}

.rs-team.home {
  color: var(--primary);
  font-weight: 600;
}

.rs-team.visiting {
  color: var(--info);
  font-weight: 600;
}

.rs-detail {
  color: var(--text-primary);
}

.rs-running {
  text-align: right;
  font-weight: 600;
  color: var(--text-secondary);
}

.officials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.final-score-table {
  width: 100%;
  border-collapse: collapse;
}

.final-score-table th,
.final-score-table td {
  padding: 0.6rem;
  text-align: center;
  border: 1px solid var(--border-primary);
}

.final-score-table th:first-child,
.final-score-table td:first-child {
  text-align: left;
}

@media (max-width: 900px) {
  .scoresheet-header-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    width: 200px;
  }
  
  .form-grid,
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .team-selector {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .vs-divider {
    order: 2;
    font-size: 1.25rem;
  }
  
  .organization-filters .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    min-width: auto;
  }
  
  .filter-stats {
    margin-left: 0;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .sidebar {
    display: none;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .topnav {
    padding: 0.75rem 1rem;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .card {
    margin-bottom: 1rem;
  }
}

/* Auth Screens (login / forced password change) - standalone pages with no app shell.
   .auth-page is the sticky-footer wrapper: min-height:100vh + flex-column so
   .auth-container (flex:1) centers the card in whatever space is left above
   .app-footer, which then sits flush at the bottom of the viewport on short
   pages instead of floating right under the card. */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  padding: 1rem;
}

.auth-box {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
}

.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 1.5rem;
}

.auth-error {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 14px;
  margin-bottom: 1rem;
}

/* Site footer (includes/footer.php) - shown on every app screen (bottom of .app's
   flex column, see index.php) and the login page (bottom of .auth-page, see
   views/login.php). Deliberately a fixed light band rather than following the
   page's own light/dark theme: GETHOOPFLOW_logo.png has a flat near-white
   background baked in (not transparent), so a dark-mode footer would show it
   sitting in a visible light box - a fixed light band matches the asset on
   either theme instead of needing a separate dark-mode logo variant. */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  text-align: center;
  flex-shrink: 0;
}

.app-footer img {
  height: 28px;
  width: auto;
  display: block;
}

.app-footer-text {
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.5;
}

.app-footer-text a {
  color: #334155;
  text-decoration: underline;
}

/* Roles & Permissions checkbox grid */
.permission-group {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.permission-group-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.permission-actions {
  margin-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.permission-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 14px;
}
