body {
    font-family: 'Titillium Web', sans-serif;
    background-color: #F4F4F4;
    color: #1A1A1A;
    margin: 0;
    padding: 0.5rem;
    line-height: 1.6;
  }

  /* Mobile-first approach - larger margins on bigger screens */
  @media (min-width: 768px) {
    body {
      margin: 40px;
      padding: 0;
    }
  }

  h1, h2, .main-title {
    font-family: 'Orbitron', sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 1px !important;
  }
  
  /* =========================
     COMPONENT: FORMS
     ========================= */
  form {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    max-width: 500px;
    margin: 0 auto;
  }
  
  @media (max-width: 767px) {
    form {
      padding: 10px;
      margin: 0;
      max-width: 100%;
    }
  }
  
input[type="file"],
  select,
  button {
    font-family: 'Titillium Web', sans-serif;
    padding: 8px;
    margin: 10px 0;
    width: 100%;
    font-size: 16px;
  }
  
  /* =========================
     COMPONENT: BUTTONS
     ========================= */
  button {
    background-color: #0070F3;
    color: white;
    padding: 10px 20px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
    min-height: 44px; /* Touch-friendly target */
  }
  
  button:hover {
    background-color: #005bb5;
  }
  
  /* Button sizing for mobile */
  @media (max-width: 767px) {
    .btn, .form-control, .form-select {
      min-height: 44px;
    }
    
    .btn-sm {
      font-size: 0.8rem;
      padding: 0.4rem 0.8rem;
      min-height: 36px;
    }
  }
  
  /* =========================
     COMPONENT: TABLES
     ========================= */
  .responsive-table {
    width: 100%;
    overflow-x: auto;
  }
  
  .responsive-table table {
    min-width: 600px; /* Ensures readability */
  }
  
  /* Mobile table improvements */
  @media (max-width: 767px) {
    .responsive-table {
      font-size: 0.85rem;
      -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .table td, .table th {
      padding: 0.5rem 0.25rem;
      font-size: 0.875rem;
    }
  }
  
  /* =========================
     COMPONENT: NAVIGATION
     ========================= */
  @media (max-width: 991px) {
    .navbar-brand h1 {
      font-size: 1.3rem !important;
    }
    
    .navbar-brand p {
      font-size: 0.8rem !important;
    }
    
    .navbar-brand img {
      height: 45px !important;
    }
    
    .navbar-nav {
      margin-top: 1rem;
    }
    
    .nav-item {
      margin-bottom: 0.5rem;
    }
  }
  
  pre {
    background-color: #eee;
    padding: 15px;
    border-left: 5px solid #0070F3;
    overflow-x: auto;
  }
  
  /* =========================
     COMPONENT: FLAGS & BADGES
     ========================= */
  .flag-green {
    color: white;
    background-color: #00b300;
    padding: 5px 10px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 4px;
  }
  
  .flag-red {
    color: white;
    background-color: #cc0000;
    padding: 5px 10px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 10px;
    border-radius: 4px;
  }
  
  .badge {
    font-weight: 600 !important;
    font-size: 0.75em !important;
  }

  .badge-success {
    background-color: #28a745 !important;
    color: #ffffff !important;
  }

  .badge-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
  }

  .badge-info {
    background-color: #17a2b8 !important;
    color: #ffffff !important;
  }

  .badge-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
  }

  .badge-danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
  }

  .badge-primary {
    background-color: #007bff !important;
    color: #ffffff !important;
  }

  .badge-light {
    background-color: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
  }
  
  /* =========================
     COMPONENT: REFERENCE LAP CONTROLS
     ========================= */
  .ref-lap-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
  }
  
  @media (max-width: 767px) {
    .ref-lap-controls {
      flex-direction: column;
      align-items: stretch;
    }
    
    .ref-lap-controls .btn-group {
      width: 100%;
    }
    
    .ref-lap-controls .btn {
      flex: 1;
      min-height: 40px;
      font-size: 0.85rem;
    }
  }
  
  img:not(.gm-control-active img) {
    border: 1px solid #ccc;
    margin-top: 20px;
    max-width: 100%;
    height: auto;
  }
  
  /* =========================
     UTILITY CLASSES
     ========================= */
  .text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  @media (max-width: 575px) {
    .text-truncate-mobile {
      max-width: 120px;
    }
  }
  
  /* Card improvements */
  @media (max-width: 767px) {
    .card {
      margin-bottom: 1rem;
    }
    
    .card-body {
      padding: 1rem;
    }
  }
  
  /* Dropdown improvements */
  @media (max-width: 767px) {
    .dropdown-menu {
      max-width: 95vw !important;
      width: auto !important;
    }
    
    #notification-content .dropdown-item {
      padding: 12px 16px !important;
    }
  }
  
  /* Touch device optimizations */
  @media (hover: none) and (pointer: coarse) {
    a, button, input[type="checkbox"], .dropdown-toggle {
      min-height: 44px;
      min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .card:hover,
    .feed-card:hover,
    .hover-shadow:hover {
      transform: none;
      box-shadow: inherit;
    }
  }
  
  body, p, td, th, input, select, button, label, .dataTables_wrapper, .dataTables_filter, .dataTables_info, .dataTables_paginate, .dataTables_length, .dataTables_processing {
    font-family: 'Titillium Web', Arial, sans-serif !important;
    font-weight: 400;
}

/* Override Bootstrap's text-muted for better contrast on white backgrounds */
.text-muted {
    color: #6c757d !important; /* Bootstrap's default but ensuring it's applied */
}

/* Ensure small text has good contrast */
small {
    color: inherit;
}

/* Better contrast for small muted text specifically */
small.text-muted {
    color: #495057 !important; /* Darker gray for better readability */
}

.chat-message.assistant.thinking .chat-content span em {
  opacity: 0.7;
  animation: blink 1.2s infinite;
}

/* Clickable links in tables and social insights */
.user-link {
  color: #28a745;
  text-decoration: none;
  font-weight: bold;
  border-bottom: 1px dotted #28a745;
  transition: all 0.2s ease;
}

.user-link:hover {
  color: #218838;
  text-decoration: none;
  border-bottom: 1px solid #218838;
  background-color: rgba(40, 167, 69, 0.08);
}

.track-link {
  color: #fd7e14;
  text-decoration: none;
  font-weight: bold;
  border-bottom: 1px dotted #fd7e14;
  transition: all 0.2s ease;
}

.track-link:hover {
  color: #e8590c;
  text-decoration: none;
  border-bottom: 1px solid #e8590c;
  background-color: rgba(253, 126, 20, 0.08);
}

.lap-time-link {
  color: #007bff;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted #007bff;
  transition: all 0.2s ease;
}

.lap-time-link:hover {
  color: #0056b3;
  text-decoration: none;
  border-bottom: 1px solid #0056b3;
  background-color: rgba(0, 123, 255, 0.08);
}

.session-link {
  color: #6f42c1;
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted #6f42c1;
  transition: all 0.2s ease;
}

.session-link:hover {
  color: #5a32a3;
  text-decoration: none;
  border-bottom: 1px solid #5a32a3;
  background-color: rgba(111, 66, 193, 0.08);
}

.pace-ratio {
  font-weight: 600;
}

.pace-ratio-fast {
  color: #28a745;
}

.pace-ratio-slow {
  color: #dc3545;
}

.pace-ratio-neutral {
  color: #6c757d;
}

@keyframes blink {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.3; }
}
