:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --accent: #f59e0b;
  --accent-light: #fef3c7;
  --danger: #ef4444;
  --success: #10b981;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --nav-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", Oxygen, Ubuntu, Cantarell, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-height) + 1rem); /* Space for Android bottom nav */
}

/* App Header */
.app-header {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

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

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pwa-badge {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Header Controls & Action Buttons */
.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-header-back {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
}

.btn-header-back:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-header-auth {
  background: #f59e0b;
  color: #78350f;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.btn-header-auth:hover {
  background: #d97706;
  color: white;
}

.event-selector-box select {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  background: white;
  color: var(--text-main);
  max-width: 180px;
  outline: none;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

/* Install Banner (A2HS) */
.install-banner {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: white;
  padding: 0.75rem 1rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.install-banner-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.install-icon {
  font-size: 1.5rem;
}

.install-text {
  flex: 1;
}

.install-text strong {
  font-size: 0.9rem;
  display: block;
}

.install-text p {
  font-size: 0.75rem;
  opacity: 0.9;
}

.btn-install {
  background: var(--accent);
  color: #78350f;
  border: none;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}

.btn-dismiss {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.1rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  opacity: 0.8;
}

/* Urgent Banner */
.urgent-banner {
  background-color: #fee2e2;
  border-bottom: 2px solid var(--danger);
  color: #991b1b;
  padding: 0.75rem 1rem;
  font-weight: 600;
  animation: pulse-border 2s infinite;
}

.urgent-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

/* Main Layout */
.main-container {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 1rem;
  flex: 1;
  width: 100%;
}

.view-section {
  animation: fade-in 0.2s ease-in-out;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Home View & Hero */
.home-hero-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.hero-text-block h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.event-summary-card {
  background: var(--card-bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.event-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.event-title-group {
  flex: 1;
  min-width: 250px;
}

.btn-back-link {
  background: none;
  border: none;
  color: var(--primary-light);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 0.35rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-back-link:hover {
  text-decoration: underline;
}

.event-status-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-outline-refresh {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-outline-refresh:hover {
  background: #f1f5f9;
}

.event-sub-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-top: 0.5rem;
}

.event-summary-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.meta-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.poll-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  background: #f1f5f9;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.4);
}

/* Event Completed Banner */
.event-completed-card {
  background: #ecfdf5;
  border: 2px solid var(--success);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  animation: slide-in 0.3s ease-out;
}

/* Race Admin Controls Card */
.race-admin-controls-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  animation: slide-in 0.2s ease-out;
}

.race-admin-controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.race-admin-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-badge-icon {
  font-size: 1.3rem;
}

.race-admin-title h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.race-admin-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.control-group-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-control-sm {
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: white;
}

.btn-advance-ring {
  margin-top: 0.75rem;
  width: 100%;
  font-weight: 600;
}

.completed-icon {
  font-size: 2rem;
}

.completed-info {
  flex: 1;
  min-width: 200px;
}

.completed-info h3 {
  color: #065f46;
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.completed-info p {
  color: #047857;
  font-size: 0.85rem;
}

.status-live-chip {
  font-size: 0.75rem;
  background: #dcfce7;
  color: #166534;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Desktop Tabs (Hidden on mobile) */
.desktop-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border);
  padding-top: 0.75rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

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

/* Announcements */
.announcements-area {
  margin-bottom: 1rem;
}

.announcement-card {
  background: #eff6ff;
  border-left: 4px solid var(--primary-light);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #1e3a8a;
}

.tab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.tab-header-row h3 {
  font-size: 1.1rem;
}

.legend-chip {
  font-size: 0.75rem;
  background: var(--accent-light);
  color: #92400e;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Live Rings Grid */
.rings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.ring-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.ring-card.has-favorite {
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.ring-header {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.ring-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
}

.badge-paused {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-setup {
  background: #fef3c7;
  color: #b45309;
}

.badge-fav-tag {
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 800;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.race-section {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.race-section:last-child {
  border-bottom: none;
}

.race-section.current {
  background: #f8fafc;
  border-left: 4px solid var(--primary-light);
}

.race-section.favorite-target {
  background: #fffbeb !important;
  border-left: 4px solid var(--accent) !important;
}

.section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.matchup {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.matchup .fav-highlight {
  color: #b45309;
  font-weight: 800;
  background: #fef3c7;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.vs {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.race-meta-details {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

/* Schedules Tab */
.schedule-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.control-group select {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  background: white;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.table-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.schedule-table th, .schedule-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.schedule-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.schedule-table tr.fav-row,
.schedule-table tr.row-selected-race {
  background-color: #fffbeb;
  font-weight: 600;
}

.schedule-table tr.fav-row td,
.schedule-table tr.row-selected-race td {
  border-bottom-color: #fde68a;
}

.btn-remind {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-remind:hover {
  background: #f1f5f9;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-remind-active {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #b45309;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.schedule-reminder-hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* My Favorites Tab */
.favorites-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.fav-form-group {
  margin: 1.25rem 0;
}

.fav-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
}

.input-with-btn input {
  flex: 1;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  outline: none;
}

.btn {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
}

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

.fav-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  min-height: 40px;
}

.fav-chip {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fav-chip button {
  background: none;
  border: none;
  color: #92400e;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
}

.fav-warning-settings {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.fav-warning-settings select {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
}

/* Events Tab */
.search-box input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  outline: none;
}

.events-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.event-item-card {
  background: var(--card-bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.event-item-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

.event-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.event-description-snippet {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.3;
}

.event-card-footer {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.view-board-btn {
  color: var(--primary-light);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.empty-events-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  grid-column: 1 / -1;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: #ffffff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 1000;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.nav-item.active {
  color: var(--primary);
  font-weight: 700;
}

.nav-icon {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 0.7rem;
}

.fav-count-badge {
  position: absolute;
  top: 6px;
  right: 25%;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 9999px;
}

/* Mobile Media Queries */
@media (max-width: 768px) {
  .desktop-tabs {
    display: none;
  }

  .bottom-nav-bar {
    display: flex;
  }

  .app-header {
    padding: 0.6rem 0.8rem;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .main-container {
    margin: 0.5rem auto;
    padding: 0 0.5rem;
  }

  .event-summary-card {
    padding: 1rem;
  }

  .rings-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .table-wrapper {
    font-size: 0.8rem;
  }

  .schedule-table th, .schedule-table td {
    padding: 0.5rem 0.6rem;
  }
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 1.5rem;
  margin-top: auto;
}

/* Admin Portal & Superuser Management Styles */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 480px;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input, .form-group select {
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.9rem;
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.btn-block {
  width: 100%;
}

.quick-login-helper {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
}

.helper-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.quick-login-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-outline-danger {
  background: transparent;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.btn-outline-danger:hover {
  background: #fef2f2;
}

.btn-danger-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  cursor: pointer;
}

.btn-danger-sm:hover {
  background: #fecaca;
}

.btn-edit-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.35rem;
}

.btn-edit-sm:hover {
  background: #bae6fd;
}

.admin-session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.session-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.session-role-badge {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.session-club-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.session-email {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.9rem;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

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

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

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-input {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  min-width: 250px;
}

.users-table td {
  vertical-align: middle;
}

.role-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  display: inline-block;
  text-transform: uppercase;
}

.role-pill-superuser {
  background: #fdf4ff;
  color: #86198f;
  border: 1px solid #f0abfc;
}

.role-pill-admin {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.role-pill-race_admin {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.role-pill-flyballer {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.admin-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.info-tile {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
}

.info-tile strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.alert-box {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.alert-box.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-box.alert-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-box.alert-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

/* Club Admin Event Portal & Sub-Navigation Styles */
.admin-sub-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.admin-sub-nav .btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.code-textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  resize: vertical;
  width: 100%;
}

.code-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.full-width-form {
  max-width: 100%;
}

.events-table td {
  vertical-align: middle;
}

.event-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  display: inline-block;
  text-transform: uppercase;
}

.status-upcoming {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.status-in_progress {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.status-completed {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.status-cancelled {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.action-buttons-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mb-4 {
  margin-bottom: 1.5rem;
}

@keyframes pulse-border {
  0%, 100% { border-color: #ef4444; }
  50% { border-color: #f87171; }
}

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

/* Toast Notifications Container & Items */
.toast-notification-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast-notification-item {
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  animation: slide-in 0.25s ease-out forwards;
  pointer-events: auto;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease-out, transform 0.35s ease-out;
}
