html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

/* Custom styles for race analysis */
.card {
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.card-header h5 {
  margin-bottom: 0;
}

.table-responsive {
  overflow-x: auto;
}

.table th {
  background-color: #f8f9fa;
}

#splitChartContainer {
  min-height: 400px;
  width: 100%;
}

/* Styling for athlete split details modal */
#athleteSplitModal .modal-body {
  padding: 20px;
}

#modalAthleteName {
  font-weight: 600;
  color: #2c3e50;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

/* Filter form styling */
#raceFilterForm .form-label {
  font-weight: 500;
}

.btn-primary {
  background-color: var(--lapsplits-red);
  border-color: var(--lapsplits-shadow);
}

.btn-primary:hover {
  background-color: var(--lapsplits-red-hover);
  border-color: var(--lapsplits-shadow-hover);
}

/* Loading spinner */
.loading-spinner {
  margin-left: 10px;
  vertical-align: middle;
}

/* Required field indicator */
.required-field::after {
  content: "*";
  color: red;
  margin-left: 4px;
}

/* Form validation styling */
.is-invalid {
  border-color: #dc3545 !important;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
  display: none;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #dc3545;
}

.is-invalid ~ .invalid-feedback {
  display: block;
}

/* Sortable table styling */
th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 20px !important;
}

th.sortable:hover {
  background-color: #eaeaea;
}

th.sortable::after {
  content: "↕";
  position: absolute;
  right: 5px;
  color: #999;
}

th.sort-asc::after {
  content: "↑";
  color: #333;
}

th.sort-desc::after {
  content: "↓";
  color: #333;
}

#cumulativeTimesTable td,
#splitTimesTable td {
  text-align: right;
}

#cumulativeTimesTable td:nth-child(1),
#cumulativeTimesTable td:nth-child(2),
#splitTimesTable td:nth-child(1),
#splitTimesTable td:nth-child(2) {
  text-align: left;
}

/* Highlight fastest split time */
.fastest-split {
  font-weight: bold;
  color: #28a745 !important;
  background-color: rgba(40, 167, 69, 0.1);
}

/* Table section styling */
#cumulativeTimesTable, #splitTimesTable {
  font-size: 0.9rem;
}

/* Weather card styling */
#weatherInfo .card-header.bg-info {
  background-color: #17a2b8 !important;
}

#weatherInfo .card-header.bg-light {
  background-color: #f8f9fa !important;
  border-bottom: 1px solid rgba(0,0,0,.125);
}

#weatherInfo .card-body {
  padding: 1rem;
}

#weatherInfo .row {
  margin-right: 0;
  margin-left: 0;
}

#weatherInfo .card .card {
  height: 100%;
  box-shadow: none;
}

#weatherInfo .col-6 {
  padding-right: 5px;
  padding-left: 5px;
}

/* Add space between table sections */
#cumulativeTimesTable, #splitTimesTable {
  margin-bottom: 2rem;
}

/* Make table headers more visible */
#cumulativeTimesTable thead, #splitTimesTable thead {
  background-color: #e9ecef;
}

/* Zebra striping for rows */
#cumulativeTimesTable tbody tr:nth-of-type(odd),
#splitTimesTable tbody tr:nth-of-type(odd) {
  background-color: rgba(0,0,0,.05);
}

/* Hover effect for rows */
#cumulativeTimesTable tbody tr:hover,
#splitTimesTable tbody tr:hover {
  background-color: rgba(0,123,255,.1);
}

/* Navbar styling */
.navbar {
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  z-index: 1050; /* Above race-split-blotter-container */
  position: relative;
}

/* Ensure navbar dropdowns appear above race split blotter */
.navbar .dropdown-menu {
  z-index: 1060; /* Higher than navbar and race split blotter */
}

/* LapSplits Theme - Inline styles for proper loading */

:root {
  /* Primary color from logo - red */
  --lapsplits-red: #D73527;
  --lapsplits-red-hover: #B82E21;
  --lapsplits-red-light: #E85A4C;
  
  /* Secondary colors */
  --lapsplits-dark: #2C3E50;
  --lapsplits-grey: #F8F9FA;
  --lapsplits-light-grey: #E9ECEF;
  --lapsplits-medium-grey: #6C757D;
  
  /* Accent colors */
  --lapsplits-white: #FFFFFF;
  --lapsplits-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --lapsplits-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Override Bootstrap Primary Colors */
.btn-primary {
  background-color: var(--lapsplits-red) !important;
  border-color: var(--lapsplits-red) !important;
  color: white !important;
  font-weight: 500;
  border-radius: 8px;
  padding: 0.5rem 1.5rem;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--lapsplits-red-hover) !important;
  border-color: var(--lapsplits-red-hover) !important;
  transform: translateY(-2px);
  box-shadow: var(--lapsplits-shadow-hover);
}

.btn-outline-primary {
  color: var(--lapsplits-red) !important;
  border-color: var(--lapsplits-red) !important;
  font-weight: 500;
  border-radius: 8px;
  padding: 0.5rem 1.5rem;
  transition: all 0.3s ease;
}

.btn-outline-primary:hover {
  background-color: var(--lapsplits-red) !important;
  border-color: var(--lapsplits-red) !important;
  color: white !important;
  transform: translateY(-2px);
  box-shadow: var(--lapsplits-shadow-hover);
}

.main-header {
  border-bottom: 1px solid var(--bs-border-color, rgba(0, 0, 0, 0.125));
}

.header-container {
  display: grid;
  grid-template-columns: 280px 1fr 220px; /* Logo | Navbar | User */
  gap: 30px;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto 0 auto;
  padding: 0 20px;
}

/* Logo Section - Independent, No Height Constraints */
.logo-section {
  display: flex;
  align-items: center;
}

.main-logo {
  height: 125px; /* Much larger! No navbar constraints */
}

/* Navbar Section - Red oval with inner white track */
.navbar-section {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--lapsplits-white);
  border-radius: 9999px;
  padding: 12px 25px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.navbar-section::before {
  content: "";
  position: absolute;
  top: 6px; bottom: 6px; left: 6px; right: 6px; /* inset border */
  border: 3px solid var(--lapsplits-red); /* inner red lane */
  border-radius: inherit;
  pointer-events: none;
}

.navbar-section .navbar-collapse {
  justify-content: center;
  width: 100%;
}

/* Ensure navbar links layout on large screens while preserving collapse on mobile */
@media (min-width: 992px) {
  .navbar-section .navbar-collapse {
    display: flex !important;
  }
}

/* Two-row navbar container */
.navbar-rows-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

/* Individual navbar rows */
.navbar-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
}

/* Mobile responsive behavior - stack all links in single column on small screens */
@media (max-width: 991px) {
  .navbar-rows-container {
    flex-direction: column;
    gap: 10px;
  }
  
  .navbar-row {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
}

.navbar-section .nav-link {
  color: black !important;
  text-decoration: none !important;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 4px 10px;
  border-radius: 18px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.navbar-section .nav-link:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: black !important;
  transform: translateY(-2px);
}

.navbar-section .nav-link.active {
  background-color: rgba(215, 53, 39, 0.12); /* light red tint */
  color: black !important;
  font-weight: 600;
}

/* User Section - Independent Right Section */
.user-section {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.auth-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.auth-links .nav-link {
    color: black;
  text-decoration: none !important;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.auth-links .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.2);
  /*color: white !important;*/
  transform: translateY(-2px);
}

/* Mobile Navbar Toggler */
.navbar-toggler {
  border: 2px solid black;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.05);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Fix dropdown styling */
.dropdown-menu {
  border: none;
  box-shadow: var(--lapsplits-shadow);
  border-radius: 8px;
  margin-top: 0.5rem;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  transition: background-color 0.3s ease;
}

.dropdown-item:hover {
  background-color: var(--lapsplits-grey);
  color: var(--lapsplits-dark);
}

/* User Profile Dropdown */
.user-profile-dropdown {
  min-width: 250px;
}

/* Ensure user profile toggle text/icons are black */
#userProfileDropdown {
  color: black !important;
}
#userProfileDropdown .bi {
  color: inherit !important;
}

.user-profile-header {
  padding: 1rem;
  border-bottom: 1px solid var(--lapsplits-light-grey);
  background-color: var(--lapsplits-grey);
}

.user-name {
  font-weight: 600;
  color: var(--lapsplits-dark);
  margin: 0;
}

.user-email {
  color: var(--lapsplits-medium-grey);
  font-size: 0.9rem;
  margin: 0;
}

.user-tier {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: var(--lapsplits-red);
  color: white;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* Hero Section */
.hero-section {
  /*background: linear-gradient(135deg, var(--lapsplits-grey) 0%, var(--lapsplits-light-grey) 100%);*/
  padding: 4rem 0;
  text-align: center;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--lapsplits-dark);
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--lapsplits-medium-grey);
  margin-bottom: 2rem;
  font-weight: 400;
}

.hero-logo {
  height: 120px;
  width: auto;
  margin-bottom: 2rem;
}

/* Features Section */
.features-section {
  padding: 4rem 0;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  height: 100%;
  border: none;
  border-radius: 12px;
  box-shadow: var(--lapsplits-shadow);
  transition: all 0.3s ease;
}

.feature-card:hover {
  box-shadow: var(--lapsplits-shadow-hover);
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
}

.feature-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--lapsplits-dark);
  margin-bottom: 1rem;
}

.feature-description {
  color: var(--lapsplits-medium-grey);
  line-height: 1.6;
}

/* Pricing Section */
.pricing-section {
  background-color: var(--lapsplits-grey);
  padding: 4rem 0;
}

.pricing-card {
  text-align: center;
  padding: 2rem;
  position: relative;
  border: none;
  border-radius: 12px;
  box-shadow: var(--lapsplits-shadow);
  transition: all 0.3s ease;
  min-height: 520px; /* Ensure consistent card height */
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  box-shadow: var(--lapsplits-shadow-hover);
  transform: translateY(-5px);
}

.pricing-card.featured {
  transform: scale(1.05);
  border: 3px solid var(--lapsplits-red);
}

.pricing-tier {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--lapsplits-dark);
  margin-bottom: 1rem;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--lapsplits-red);
  margin-bottom: 1.5rem;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin-bottom: 2rem;
  flex-grow: 1; /* Take remaining space so button sits at bottom */
}

.pricing-features li {
  padding: 0.5rem 0;
  color: var(--lapsplits-medium-grey);
}

.pricing-features li::before {
  content: "✓";
  color: var(--lapsplits-red);
  font-weight: 600;
  margin-right: 0.5rem;
}

.pricing-features li strong {
  color: var(--lapsplits-red);
  font-weight: 700;
}

/* Keep primary action aligned to bottom across cards */
.pricing-card .btn {
  margin-top: auto;
}

/* Statistics Section */
.stats-section {
  padding: 3rem 0;
  background-color: var(--lapsplits-dark);
  color: var(--lapsplits-white);
}

.stat-item {
  text-align: center;
  padding: 1rem;
}

.stat-number {
  font-size: 3rem;
  font-weight: 600;
  color: var(--lapsplits-red);
  display: block;
}

.stat-label {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 0.5rem;
}

/* Admin Dashboard */
.admin-dashboard {
  padding: 2rem 0;
}

.admin-header {
  background: linear-gradient(135deg, var(--lapsplits-red) 0%, var(--lapsplits-red-hover) 100%);
  color: white;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.admin-title {
  font-size: 2.5rem;
  font-weight: 600;
  margin: 0;
}

.admin-card {
  margin-bottom: 2rem;
  border: none;
  border-radius: 12px;
  box-shadow: var(--lapsplits-shadow);
}

.users-table {
  border-radius: 8px;
  overflow: hidden;
}

.users-table th {
  background-color: var(--lapsplits-red);
  color: white;
  font-weight: 600;
  border: none;
  padding: 1rem;
}

.users-table td {
  padding: 1rem;
  vertical-align: middle;
  border-color: var(--lapsplits-light-grey);
}

.tier-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: capitalize;
}

.tier-badge.free { background-color: #6c757d; color: white; }
.tier-badge.basic { background-color: #17a2b8; color: white; }
.tier-badge.pro { background-color: #28a745; color: white; }
.tier-badge.jakob { background-color: #fd7e14; color: white; }
.tier-badge.admin { background-color: var(--lapsplits-red); color: white; }

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

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

/* Responsive Design for True Split Layout */
@media (max-width: 1200px) {
  .header-container {
    grid-template-columns: 240px 1fr 180px; /* Slightly smaller columns */
    gap: 20px;
  }
  
  .main-logo {
    height: 80px; /* Slightly smaller on medium screens */
  }
  
  .navbar-section .nav-link {
    font-size: 0.9rem;
    padding: 6px 10px;
  }
}

@media (max-width: 991px) {
  .header-container {
    grid-template-columns: 1fr; /* Stack vertically */
    gap: 20px;
    text-align: center;
    padding: 0 15px;
  }
  
  .logo-section {
    justify-content: center;
    margin-bottom: 10px;
  }
  
  .main-logo {
    height: 70px;
  }
  
  .navbar-section {
    padding: 8px 20px;
    border-radius: 20px;
    margin-bottom: 10px;
  }
  
  .navbar-section .navbar-collapse {
    flex-direction: column;
    gap: 10px;
  }
  
  .navbar-section .nav-link {
    padding: 10px 15px;
    font-size: 0.9rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 15px;
    margin: 2px 0;
    color: black !important;
  }
  
  .user-section {
    justify-content: center;
  }
  
  .auth-links {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .hero-logo {
    height: 80px;
  }
  
  .pricing-card.featured {
    transform: none;
    margin-top: 1rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .main-logo {
    height: 50px;
  }
  
  .logo-section {
    padding: 10px 15px;
  }
  
  .nav-links {
    gap: 10px;
  }
  
  .nav-link {
    font-size: 0.9rem;
    padding: 10px;
  }
}
