/* styles.css
   Youth League Planner - Premium CSS Design System
   WCAG 2.1 AA Compliant Color Contrast & Keyboard Navigation Styles
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette (Slate Dark Mode-first with sports neon accents) */
  --bg-darkest: #090d16;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --border-color: #3b4252;
  --border-glow: rgba(99, 102, 241, 0.25);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Neon Accents */
  --accent-indigo: #818cf8;
  --accent-indigo-rgb: 129, 140, 248;
  --accent-teal: #2dd4bf;
  --accent-teal-rgb: 45, 212, 191;
  --accent-coral: #fb7185;
  --accent-coral-rgb: 251, 113, 133;
  --accent-amber: #fbbf24;
  
  /* Shadows and Effects */
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 15px rgba(129, 140, 248, 0.2);
  --glass-bg: rgba(30, 41, 59, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(12px);
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-darkest);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(45, 212, 191, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Keyboard Accessibility Focus Outlines */
*:focus-visible {
  outline: 3px solid var(--accent-teal);
  outline-offset: 3px;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* App Container Layout */
.app-container {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  max-width: 100%;
  margin: 0;
  padding: 0;
  transition: opacity 0.3s ease;
  overflow-x: hidden;
}

/* App Main column */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
  height: 100vh;
  position: relative;
  overscroll-behavior-y: none;
}

/* Sidebar layout */
.app-sidebar {
  width: 290px;
  flex-shrink: 0;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  padding: 1.5rem;
  gap: 1.25rem;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.btn-close-sidebar {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.btn-close-sidebar:hover {
  color: var(--text-primary);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--bg-darkest);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-title h1 {
  font-size: 1.35rem;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-title p {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* Persistent Workspace Selectors */
.sidebar-workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.sidebar-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.select-workspace, .select-role {
  width: 100% !important;
  margin: 0 !important;
  padding: 0.35rem 0.5rem !important;
  font-size: 0.85rem !important;
  background-color: var(--bg-darkest) !important;
}

.league-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.35rem;
  margin-top: 0.25rem;
}

.league-quick-actions .btn {
  font-size: 0.7rem;
  padding: 0.35rem 0.25rem;
  border-radius: 6px;
  width: 100%;
}

/* Vertical tabs navigation */
.sidebar-nav {
  width: 100%;
}

.tabs-nav-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tabs-nav-vertical .tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: var(--transition-smooth);
  text-align: left;
}

.tabs-nav-vertical .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.tabs-nav-vertical .tab-btn[aria-selected="true"] {
  color: var(--bg-darkest);
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
  font-weight: 700;
}

.tab-icon {
  font-size: 1.1rem;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
}

/* Mobile Header */
.mobile-header {
  display: none; /* Hidden on desktop */
  height: 60px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.btn-menu-toggle {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* Main Grid & Sections */
main {
  flex-grow: 1;
}

.tab-panel {
  display: none; /* Hide panels unless they are active */
  animation: fadeIn 0.4s ease-out;
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

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

.tab-panel.highlighted {
  border-color: var(--accent-teal);
  box-shadow: 0 0 15px rgba(45, 212, 191, 0.25);
}

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

/* Glassmorphic Panel/Card Components */
.panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-lg);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.panel-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
  color: var(--bg-darkest);
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 15px rgba(45, 212, 191, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

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

.btn-danger {
  background: var(--accent-coral);
  color: var(--bg-darkest);
}

.btn-danger:hover {
  box-shadow: 0 0 15px rgba(251, 113, 133, 0.4);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--accent-indigo);
  color: var(--accent-indigo);
}

.btn-outline:hover {
  background: var(--accent-indigo);
  color: var(--bg-darkest);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  border-radius: 6px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 0.85rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
  outline: none;
}

select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-toggle-password {
  position: absolute;
  right: 0.35rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
  transition: var(--transition-smooth);
  z-index: 10;
}

.btn-toggle-password:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

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

/* Availability Calendar Grid */
.availability-grid-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.avail-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.avail-table th, .avail-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.avail-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
}

.avail-checkbox-cell {
  text-align: center;
}

/* Styled Checkboxes */
.checkbox-container {
  display: inline-flex;
  align-items: center;
  position: relative;
  padding-left: 28px;
  margin-bottom: 0px;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  color: var(--text-primary);
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  height: 20px;
  width: 20px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.checkbox-container:hover input ~ .checkmark {
  border-color: var(--accent-indigo);
}

.checkbox-container input:checked ~ .checkmark {
  background-color: var(--accent-indigo);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.4);
}

.checkmark:after {
  content: "";
  position: absolute;
  display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
  display: block;
}

.checkbox-container .checkmark:after {
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid var(--bg-darkest);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Dashboard Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.metric-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.metric-card.indigo::before { background-color: var(--accent-indigo); }
.metric-card.teal::before { background-color: var(--accent-teal); }
.metric-card.coral::before { background-color: var(--accent-coral); }

.metric-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin: 0.25rem 0;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Teams List Section */
.teams-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.team-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

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

.team-venue {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.team-avail-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 0.5rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  max-height: 80px;
  overflow-y: auto;
}

/* Invitation Badge */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-accepted {
  background: rgba(45, 212, 191, 0.15);
  color: var(--accent-teal);
  border: 1px solid rgba(45, 212, 191, 0.3);
}

.role-badge-admin {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-indigo);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.role-badge-coach {
  background: rgba(45, 212, 191, 0.15);
  color: var(--accent-teal);
  border: 1px solid rgba(45, 212, 191, 0.3);
}

.role-badge-parent {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-coral);
  border: 1px solid rgba(251, 113, 133, 0.3);
}

/* Admin Rules Customizer */
.tiebreaker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: grab;
  transition: var(--transition-smooth);
}

.tiebreaker-item:hover {
  border-color: var(--accent-indigo);
}

.tiebreaker-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tiebreaker-index {
  background: var(--bg-primary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-teal);
}

/* Scheduler & Standings Tabs split */
.sub-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.sub-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sub-tab-btn.active {
  color: var(--accent-teal);
  background: rgba(45, 212, 191, 0.08);
}

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

.app-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.app-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

.app-table td {
  padding: 0.9rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.app-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.app-table .center-align {
  text-align: center;
}

.highlight-row {
  background: rgba(129, 140, 248, 0.05);
}

/* Schedule Game Card */
.game-card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.game-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: grid;
  grid-template-columns: 100px 1fr 180px;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  .game-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  #roster-player-form, #roster-staff-form {
    grid-template-columns: 1fr !important;
  }
}

.game-date-badge {
  font-size: 0.8rem;
  color: var(--accent-teal);
  font-weight: 600;
  background: rgba(45, 212, 191, 0.08);
  padding: 0.5rem;
  border-radius: 6px;
  text-align: center;
}

.game-week {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.game-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.game-team-name {
  flex: 1;
}

.game-team-name.home {
  text-align: right;
}

.game-team-name.away {
  text-align: left;
}

.game-score-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.score-num-input {
  width: 50px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.4rem;
  text-align: center;
  font-weight: bold;
}

.game-venue-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}

@media (max-width: 768px) {
  .game-venue-info {
    align-items: center;
  }
}

/* Tournament Brackets Styling (CSS Grid & Flex) */
.tournament-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}

.bracket-container {
  display: flex;
  overflow-x: auto;
  padding: 2rem 0;
  gap: 3rem;
  min-height: 500px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  min-width: 250px;
}

.bracket-matches-list {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex-grow: 1;
  min-height: 0;
}

.bracket-round-title {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-teal);
  text-transform: uppercase;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(45, 212, 191, 0.2);
  padding-bottom: 0.5rem;
}

/* Bracket List View Mode Toggles */
#bracket-view-area.list-view-mode .bracket-container {
  flex-direction: column !important;
  gap: 1.5rem !important;
  min-height: auto !important;
}
#bracket-view-area.list-view-mode .bracket-round {
  width: 100% !important;
  min-width: unset !important;
}
#bracket-view-area.list-view-mode .bracket-matches-list {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
  gap: 1rem !important;
}
#bracket-view-area.list-view-mode .bracket-match {
  margin: 0 !important;
}
#bracket-view-area.list-view-mode .bracket-match::after {
  display: none !important;
}

.bracket-match {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin: 1rem 0;
  position: relative;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

.bracket-match:hover {
  border-color: var(--accent-indigo);
  box-shadow: var(--shadow-glow);
}

.bracket-match.elimination-match {
  border-left: 3px solid var(--accent-coral) !important;
}

.bracket-match.elimination-match-asymmetric {
  border-left: 3px solid #f59e0b !important;
}

.elim-game-chip {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: #ffffff;
  margin-left: auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.elim-game-chip.amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.bracket-stakes-subtext {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  padding-top: 0.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

/* Line connections for brackets */
.bracket-match::after {
  content: '';
  position: absolute;
  right: -3rem;
  top: 50%;
  width: 3rem;
  height: 2px;
  background-color: var(--border-color);
  z-index: -1;
}

.bracket-round:last-child .bracket-match::after {
  display: none;
}

.bracket-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}

.bracket-team.winner {
  background: rgba(45, 212, 191, 0.08);
  font-weight: bold;
}

.bracket-team.winner .bracket-team-name {
  color: var(--accent-teal);
}

.bracket-team.path-highlight {
  background: rgba(99, 102, 241, 0.15) !important;
  border-left: 3px solid var(--accent-indigo);
  color: var(--text-primary);
}

.bracket-match.match-highlight {
  border-color: var(--accent-indigo) !important;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4) !important;
}

/* Simulator Team Focus & Path Highlighting */
.bracket-match.sim-focused-match {
  border-color: #c084fc !important;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.5) !important;
  transform: scale(1.02);
  transition: all 0.25s ease;
  z-index: 2;
}

.bracket-match.sim-dimmed-match {
  opacity: 0.35;
  filter: grayscale(40%);
  transition: all 0.25s ease;
}

.bracket-team.sim-focused-team {
  background: rgba(168, 85, 247, 0.25) !important;
  border-left: 3px solid #c084fc;
  font-weight: bold;
}
.bracket-team.sim-focused-team .bracket-team-name {
  color: #f3e8ff !important;
}

@keyframes matchPulseKeyframes {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(99, 102, 241, 0.8); border-color: var(--accent-indigo) !important; }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(99, 102, 241, 0); }
}

.bracket-match.match-pulse, .game-card.match-pulse {
  animation: matchPulseKeyframes 1.5s ease-in-out;
  border-color: var(--accent-indigo) !important;
}

/* Postponed indicator card style */
.game-card.postponed {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.02) !important;
}

.postponed-badge {
  font-size: 0.75rem;
  color: var(--accent-coral) !important;
  font-weight: 600;
  background: rgba(244, 63, 94, 0.08);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.eliminated-badge {
  font-size: 0.65rem;
  font-weight: bold;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.4rem;
  white-space: nowrap !important;
  display: inline-block !important;
  flex-shrink: 0;
}

.bracket-team-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
  padding-right: 0.25rem;
}

.bracket-score-input {
  width: 40px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 4px;
  padding: 0.15rem 0.3rem;
  text-align: center;
  font-size: 0.8rem;
}

.bracket-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 0.25rem 0;
}

/* Double Elimination UI Layout */
.double-elim-wrapper {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Pool Play UI Grid */
.pools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.pool-container {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.pool-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-indigo);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

/* Print Friendly Styles */
@media print {
  @page {
    size: landscape;
    margin: 0.5cm;
  }
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-family: system-ui, -apple-system, sans-serif !important;
  }
  .app-container {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
  }
  header, nav, footer, .btn, .btn-primary, .btn-secondary, .btn-danger, 
  .form-container, .tabs-nav, .sub-tabs, .panel-header button, 
  .league-selector-bar, .metrics-grid, .tournament-controls, #seeding-container,
  #schedule-subpanel > .grid-2, #tourney-filter-container {
    display: none !important;
  }
  .panel {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .tab-panel {
    display: none !important;
  }
  .tab-panel.active {
    display: block !important;
    opacity: 1 !important;
  }

  /* Print Schedule only */
  body.print-schedule-only #scheduler-panel {
    display: block !important;
  }
  body.print-schedule-only #scheduler-panel .panel > :not(#schedule-subpanel) {
    display: none !important;
  }
  body.print-schedule-only #schedule-subpanel > :not(#schedule-games-list):not(.panel-header) {
    display: none !important;
  }
  body.print-schedule-only #schedule-games-list {
    display: block !important;
  }
  body.print-schedule-only .game-card {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #cbd5e1 !important;
    page-break-inside: avoid;
    break-inside: avoid;
    box-shadow: none !important;
  }
  body.print-schedule-only .game-confirm-container button {
    display: none !important; /* Hide confirmation buttons when printing */
  }

  /* Print Standings only */
  body.print-standings-only #scheduler-panel {
    display: block !important;
  }
  body.print-standings-only #scheduler-panel .panel > :not(#standings-subpanel) {
    display: none !important;
  }
  body.print-standings-only #standings-subpanel > :not(.table-responsive):not(.panel-header) {
    display: none !important;
  }

  /* Print Bracket only */
  body.print-bracket-only #tournament-panel {
    display: block !important;
  }
  body.print-bracket-only #tournament-panel .panel > :not(#bracket-view-area):not(div:last-child) {
    display: none !important;
  }
  body.print-bracket-only #tournament-panel .panel > div:last-child > h3,
  body.print-bracket-only #tournament-panel .panel > div:last-child > p {
    display: none !important;
  }
  body.print-bracket-only .panel-header {
    display: none !important;
  }
  
  /* Scale bracket columns and gaps down on print to fit multi-round tournaments */
  body.print-bracket-only .bracket-container {
    gap: 1rem !important;
    padding: 0.5rem 0 !important;
  }
  body.print-bracket-only .bracket-round {
    min-width: 170px !important;
    max-width: 170px !important;
  }
  body.print-bracket-only .bracket-match {
    padding: 0.4rem !important;
    margin: 0.4rem 0 !important;
  }
  body.print-bracket-only .bracket-team-name {
    font-size: 0.75rem !important;
    max-width: 100px !important;
  }
  body.print-bracket-only .bracket-score-input,
  body.print-bracket-only .score-num-input {
    font-size: 0.75rem !important;
    padding: 0.1rem 0.2rem !important;
    width: 28px !important;
  }

  /* Table styling for print */
  .app-table {
    width: 100% !important;
    border-collapse: collapse !important;
  }
  .app-table th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 0.5rem !important;
  }
  .app-table td {
    border-bottom: 1px solid #e2e8f0 !important;
    color: #000000 !important;
    padding: 0.5rem !important;
  }

  /* Bracket styles for print */
  .bracket-match {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    color: #000000 !important;
    box-shadow: none !important;
  }
  .bracket-team-name {
    color: #000000 !important;
  }
  .score-num-input, .bracket-score-input {
    border: 1px solid #94a3b8 !important;
    color: #000000 !important;
    background: #ffffff !important;
  }
  .bracket-match-schedule-info button,
  .game-venue-info button {
    display: none !important;
  }

  .bracket-match, .game-card, .draggable-game-card, .pool-container {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* Modal Overlay & Card (for Invites or notifications) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6); /* Slightly more transparent */
  backdrop-filter: blur(12px); /* Stronger glassmorphism blur */
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 2rem 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card, .modal {
  background: rgba(30, 41, 59, 0.95); /* Slightly translucent */
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px; /* Softer corners */
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); /* Deep modern shadow */
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Bouncy entry */
  margin: auto;
}

.modal-overlay.active .modal-card,
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

/* Empty State Styling */
.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  margin: 2rem auto;
  max-width: 600px;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.8;
}
.empty-state-title {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.empty-state-text {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  max-width: 400px;
  line-height: 1.5;
}

/* Game Card Status Borders */
.game-card.status-scheduled, .bracket-match.status-scheduled {
  border-left: 4px solid var(--accent-amber);
}
.game-card.status-played, .bracket-match.status-played {
  border-left: 4px solid var(--accent-teal);
}
.game-card.status-disputed, .bracket-match.status-disputed {
  border-left: 4px solid var(--accent-coral);
}


/* Verification Test UI */
.test-suite {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.test-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.test-info {
  display: flex;
  flex-direction: column;
}

.test-name {
  font-weight: 600;
  font-size: 0.95rem;
}

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

.test-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.test-pass {
  background: rgba(45, 212, 191, 0.15);
  color: var(--accent-teal);
}

.test-fail {
  background: rgba(251, 113, 133, 0.15);
  color: var(--accent-coral);
}

/* Roster UI & Contact styling */
.team-contact-info {
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.contact-label {
  font-weight: 600;
  color: var(--accent-teal);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.15rem;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.contact-link {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.contact-link:hover {
  color: var(--accent-indigo);
  text-decoration: underline;
}

#btn-trigger-csv-file:hover, #btn-download-roster-template:hover {
  border-color: var(--accent-teal);
}

.player-jersey-cell {
  font-family: monospace;
  font-weight: 700;
  color: var(--accent-teal);
}

.player-pos-badge {
  background: rgba(129, 140, 248, 0.15);
  color: var(--accent-indigo);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Chat CSS rules */
.chat-bubble {
  max-width: 80%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  line-height: 1.4;
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-bubble.mine {
  align-self: flex-end;
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid var(--accent-teal);
  color: var(--text-primary);
  border-bottom-right-radius: 2px;
}

.chat-bubble.others {
  align-self: flex-start;
  background: rgba(129, 140, 248, 0.1);
  border: 1px solid var(--accent-indigo);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

.chat-bubble-sender {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-bubble.mine .chat-bubble-sender {
  color: var(--accent-teal);
}

.chat-bubble.others .chat-bubble-sender {
  color: var(--accent-indigo);
}

.chat-bubble-text {
  word-break: break-word;
}

.chat-bubble-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  align-self: flex-end;
  margin-top: 0.15rem;
}

/* Visual Scheduler Grid & Drag-Drop Styles */
.visual-grid-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.5rem;
}

.visual-grid-table th {
  padding: 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.3);
}

.visual-grid-table td {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  vertical-align: top;
}

.grid-field-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
  width: 140px;
  vertical-align: middle !important;
  text-align: center;
  border-right: 2px solid var(--accent-indigo) !important;
}

.grid-drop-cell {
  position: relative;
  transition: var(--transition-smooth);
  min-width: 110px;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.01);
}

.grid-drop-cell.drag-over-valid {
  outline: 2px dashed var(--accent-teal);
  outline-offset: -3px;
  background: rgba(45, 212, 191, 0.08) !important;
}

.grid-drop-cell.drag-over-invalid {
  outline: 2px dashed var(--accent-coral);
  outline-offset: -3px;
  background: rgba(251, 113, 133, 0.08) !important;
}

.draggable-game-card {
  user-select: none;
  cursor: grab;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.7rem;
}

.draggable-game-card:hover {
  border-color: var(--accent-indigo);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(129, 140, 248, 0.15);
}

.draggable-game-card:active {
  cursor: grabbing;
}

.draggable-game-card.postponed {
  border-left: 3px solid var(--accent-coral) !important;
}

.draggable-game-card.tournament {
  border-left: 3px solid var(--accent-teal) !important;
}

.draggable-game-card.regular {
  border-left: 3px solid var(--accent-indigo) !important;
}

.cell-tooltip {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9, 13, 22, 0.95);
  color: #ff8080;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  border: 1px solid rgba(251, 113, 133, 0.4);
  box-shadow: var(--shadow-lg);
}

.suggest-slot-btn {
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-smooth);
  font-size: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggest-slot-btn:hover {
  border-color: var(--accent-teal);
  background: rgba(45, 212, 191, 0.05);
}

/* Viewer Mode Overrides */
body.viewer-mode {
  overscroll-behavior-y: none;
}

body.viewer-mode header,
body.viewer-mode footer,
body.viewer-mode nav,
body.viewer-mode .tabs-nav,
body.viewer-mode .tournament-controls,
body.viewer-mode #seeding-container,
body.viewer-mode .app-sidebar,
body.viewer-mode .sidebar-overlay,
body.viewer-mode .league-selector-bar,
body.viewer-mode .mobile-header {
  display: none !important;
}

body.viewer-mode .layout-wrapper {
  display: block;
}

body.viewer-mode .app-container {
  display: block !important;
  height: auto !important;
  min-height: 100vh;
}

body.viewer-mode .app-main {
  display: block !important;
  height: auto !important;
  min-height: 100vh;
  padding: 1rem !important;
  overflow: visible !important;
}

body.viewer-mode main {
  padding-top: 0 !important;
}

body.viewer-mode #tournament-panel {
  display: block !important;
}

body.viewer-mode .tab-panel:not(#tournament-panel) {
  display: none !important;
}

/* Standalone Tournament overrides */
body.standalone-tournament #btn-auto-seed-standings {
  display: none !important;
}

/* Auth Loading State to prevent layout flashing */
body.auth-loading .app-container,
body.auth-loading .landing-page {
  opacity: 0;
  pointer-events: none;
}

/* Landing Page Styles */
.landing-page {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: radial-gradient(circle at top right, rgba(129, 140, 248, 0.12), transparent 45%),
              radial-gradient(circle at bottom left, rgba(45, 212, 191, 0.08), transparent 45%),
              var(--bg-primary);
  min-height: 100vh;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  transition: opacity 0.3s ease;
}

.landing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.landing-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-teal));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.25rem;
  color: #fff;
}

.landing-logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.landing-hero {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 4rem 2rem;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 3rem;
  align-items: center;
}

@media (max-width: 900px) {
  .landing-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 2rem 1.5rem;
  }
}

.landing-hero-content h2 {
  font-size: 3rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fff 50%, var(--accent-teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 600px) {
  .landing-hero-content h2 {
    font-size: 2.25rem;
  }
}

.landing-hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.landing-hero-actions {
  display: flex;
  gap: 1rem;
}

@media (max-width: 900px) {
  .landing-hero-actions {
    justify-content: center;
  }
}

.landing-hero-preview {
  position: relative;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.landing-hero-preview::before {
  content: '';
  position: absolute;
  top: -10px;
  right: -10px;
  width: 100px;
  height: 100px;
  background: var(--accent-indigo);
  filter: blur(80px);
  z-index: -1;
  opacity: 0.2;
}

/* Mock Bracket Preview Inside Hero */
.mock-bracket {
  display: flex;
  gap: 0.75rem;
  justify-content: space-around;
  font-size: 0.75rem;
  align-items: stretch;
  height: 180px;
}

.mock-round {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.mock-match {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  width: 110px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.mock-match.highlight {
  border-color: var(--accent-teal);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.15);
}

.mock-team {
  display: flex;
  justify-content: space-between;
  padding: 0.15rem 0.25rem;
  color: var(--text-secondary);
}

.mock-team.winner {
  color: var(--text-primary);
  font-weight: 600;
}

/* Features Grid Styles */
.landing-features-sec {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.landing-features-sec h3 {
  font-size: 2.25rem;
  text-align: center;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 3.5rem;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.landing-feature-card {
  background: rgba(30, 41, 59, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.landing-feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-indigo);
}

.landing-feature-icon {
  font-size: 2rem;
  margin-bottom: 1.25rem;
}

.landing-feature-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.landing-feature-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* CTA Section Styles */
.landing-cta-sec {
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.03));
  text-align: center;
  padding: 6rem 2rem;
}

.landing-cta-card {
  max-width: 800px;
  margin: 0 auto;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  backdrop-filter: blur(12px);
}

.landing-cta-card h3 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.landing-cta-card p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 2.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Responsive Sidebar Nav & Drawer Layout */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  
  .mobile-header {
    display: flex;
  }

  .app-main {
    padding: 1rem;
    height: calc(100vh - 60px);
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    background: var(--bg-primary);
  }

  .app-sidebar.sidebar-active {
    transform: translateX(0);
  }

  .btn-close-sidebar {
    display: block;
  }

  .sidebar-overlay.active {
    display: block;
  }
}

@media (max-width: 680px) {
  .brand-title p {
    display: none !important;
  }
}

/* Light Theme Variables Cascadable Override */
body.light-theme {
  --bg-darkest: #f1f5f9;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #e2e8f0;
  --border-color: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  
  background-color: #f8fafc;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(45, 212, 191, 0.03) 0px, transparent 50%);
  color: var(--text-primary);
}

/* Embed Mode Styles (removes margins/paddings and non-essential UI) */
body.embed-mode {
  background-color: transparent !important;
  background-image: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: auto !important;
}

body.embed-mode header,
body.embed-mode footer,
body.embed-mode #viewer-mode-header,
body.embed-mode .tabs-nav,
body.embed-mode .app-sidebar,
body.embed-mode .action-btn {
  display: none !important;
}

body.embed-mode .app-container {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}

body.embed-mode main {
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}

body.embed-mode .panel {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 0.5rem !important;
}

body.embed-mode .bracket-container,
body.embed-mode .table-responsive {
  padding: 0 !important;
  margin: 0 !important;
}

/* Drag and Drop Seeding Styles */
.seeding-team-item {
  transition: all 0.2s ease;
  user-select: none;
}
.seeding-team-item.drag-over {
  border-color: var(--accent-teal) !important;
  background: rgba(45, 212, 191, 0.08) !important;
  transform: scale(1.02);
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.2);
}

/* 2-Column Desktop Grid removed because panels are now displayed one at a time */

/* ==========================================================================
   MOBILE & VIEWER OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 768px) {
  /* Viewer Mode Header Stacking & Horizontal Scroll Toolbar */
  #viewer-mode-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.5rem !important;
    padding: 0.75rem 0.85rem !important;
    margin-bottom: 1rem !important;
  }
  
  #viewer-actions-container {
    width: 100% !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem !important;
    gap: 0.4rem !important;
  }

  #viewer-actions-container .btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-size: 0.78rem !important;
    padding: 0.28rem 0.6rem !important;
  }
  
  #viewer-mode-header h2 {
    font-size: 1.1rem !important;
    word-break: break-word;
  }

  /* Mobile Swipe Hint Badge */
  .mobile-swipe-hint {
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-teal);
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.3);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    margin: 0 auto 0.75rem auto;
    width: fit-content;
    transition: opacity 0.4s ease, transform 0.4s ease;
    user-select: none;
  }

  /* Improve touch scrolling and spacing for bracket on mobile */
  .bracket-container {
    padding: 1rem 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Slightly more compact brackets for phones but easier to tap */
  .bracket-round {
    min-width: 220px;
  }
  
  .bracket-match {
    padding: 0.85rem;
    margin: 0.75rem 0;
  }

  .bracket-team-name {
    font-size: 0.95rem; /* Larger text for readability */
    white-space: normal;
    word-break: break-word;
    flex: 1;
    min-width: 0;
  }
  
  .bracket-score-input {
    width: 45px; /* Slightly wider for better touch targets */
    font-size: 0.9rem;
    padding: 0.35rem 0.25rem;
  }
}

/* ==========================================================================
   PRINT STYLES ("Poster Ready")
   ========================================================================== */
@media print {
  /* Hide non-essential UI */
  .app-sidebar,
  .navbar,
  .tabs-nav,
  .tournament-controls,
  .action-btn,
  .btn,
  #viewer-mode-header,
  #toast-container,
  .modal-overlay {
    display: none !important;
  }

  /* Force light theme for printing to save ink */
  body {
    background: #fff !important;
    color: #000 !important;
  }
  
  /* Reset container widths */
  .app-container, main, .panel {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* Bracket text and border contrast */
  .match-node {
    background: #fff !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
    color: #000 !important;
    break-inside: avoid;
  }
  
  .connector {
    border-color: #000 !important;
  }
  
  /* Schedule table contrast */
  .app-table th, .app-table td {
    border-color: #ccc !important;
    color: #000 !important;
  }
  
  .app-table thead th {
    background: #eee !important;
    color: #000 !important;
  }

  /* Ensure background colors in bracket matches print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* --- TOAST NOTIFICATIONS & ENHANCED UI STYLES --- */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  background: rgba(22, 27, 34, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-item.toast-success {
  border-left: 4px solid #22c55e;
}

.toast-item.toast-info {
  border-left: 4px solid var(--accent-teal, #14b8a6);
}

.toast-item.toast-warning {
  border-left: 4px solid #eab308;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Weekend Date Chips in Portal */
.portal-weekend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 20px;
  background: var(--bg-secondary, rgba(255,255,255,0.05));
  border: 1px solid var(--border-color, rgba(255,255,255,0.15));
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.portal-weekend-chip:hover {
  border-color: var(--accent-teal, #14b8a6);
  background: rgba(20, 184, 166, 0.08);
}

.portal-weekend-chip input[type="checkbox"]:checked + span {
  color: var(--accent-teal, #14b8a6);
  font-weight: 600;
}

.portal-weekend-chip:has(input[type="checkbox"]:checked) {
  border-color: var(--accent-teal, #14b8a6);
  background: rgba(20, 184, 166, 0.15);
  box-shadow: 0 0 10px rgba(20, 184, 166, 0.25);
}

/* Availability Heatmap Matrix Table */
.avail-heatmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.avail-heatmap-table th, .avail-heatmap-table td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  text-align: center;
}

.avail-heatmap-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.heatmap-pill-available {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 0.72rem;
  font-weight: 600;
}

.heatmap-pill-unavailable {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.72rem;
}



