
    /* Profile Button Styles */
    #profile-button {
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background-color: #f8f9fa;
      color: #555;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-weight: 600;
      font-size: 18px;
      box-shadow: 1px 3px 5px rgba(51, 51, 51, 0.47);
      transition: all 0.2s ease;
      border: 2px solid #555;
      position: relative;
      z-index: 1001; /* Above the dropdown */
      margin-left: 15px; /* Add some spacing from other elements */
    }
    
    #profile-button:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    #user-initials {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      border-radius: 50%; /* Match parent border radius */
      position: relative; /* For absolute positioning of img */
      overflow: hidden; /* Clip image to circle */
    }
    
    /* Profile Dropdown Styles */
    #profile-dropdown {
      display: none;
      position: fixed;
      right: 20px;
      top: 74px; /* Position below the profile button */
      background: white;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      padding: 8px 0;
      min-width: 220px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
      z-index: 1000;
      animation: fadeIn 0.2s ease;
    }
    
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }
    
    .profile-menu-item {
      padding: 12px 16px;
      cursor: pointer;
      color: #333;
      font-size: 14px;
      transition: background-color 0.2s;
    }
    
    .profile-menu-item:hover {
      background-color: #f5f5f5;
    }
    
    .profile-menu-divider {
      height: 1px;
      background-color: #eee;
      margin: 4px 0;
    }
    
    /* Carpool Selector Styles - Horizontal Scrollable */
    .carpool-selector {
      display: flex;
      gap: 10px;
      margin: 15px 0;
      padding: 10px 20px; /* Add padding so buttons get cut off at edges */
      overflow-x: auto;
      overflow-y: hidden;
      scroll-behavior: smooth;
      -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
      scrollbar-width: thin; /* Firefox */
      scrollbar-color: #6c757d #f8f9fa; /* Firefox */
      position: relative;
      /* Remove scroll snap - it may not work on all Android browsers */
    }
    
    /* Show scrollbar on mobile to make scrolling more obvious */
    @media (max-width: 768px) {
      .carpool-selector::-webkit-scrollbar {
        height: 8px;
      }
      
      .carpool-selector::-webkit-scrollbar-thumb {
        background: #6c757d;
        border-radius: 4px;
      }
    }

    /* Webkit scrollbar styling */
    .carpool-selector::-webkit-scrollbar {
      height: 6px;
    }

    .carpool-selector::-webkit-scrollbar-track {
      background: #f8f9fa;
      border-radius: 3px;
    }

    .carpool-selector::-webkit-scrollbar-thumb {
      background: #6c757d;
      border-radius: 3px;
    }

    .carpool-selector::-webkit-scrollbar-thumb:hover {
      background: #495057;
    }

    .carpool-btn {
      padding: 8px 20px;
      border: 2px solid #6c757d;
      background-color: #f8f9fa;
      color: #495057;
      border-radius: 20px;
      cursor: pointer;
      font-weight: 500;
      transition: all 0.2s ease;
      min-width: 120px;
      flex-shrink: 0; /* Prevent buttons from shrinking */
      white-space: nowrap; /* Keep text on one line */
    }

    .carpool-btn:hover {
      background-color: #e9ecef;
      transform: translateY(-1px);
    }

    .carpool-btn.active {
      background-color: #6c757d;
      color: white;
      border-color: #6c757d;
    }

    /* Debug styles */
    #profile-button.user-signed-in {
      outline: 2px solid #00ff00; /* Green outline when signed in */
    }
    
    .profile-menu-item {
      transition: background-color 0.2s ease;
    }
    
    .profile-menu-item:hover {
      background-color: #f5f5f5;
    }
    
    /* Auth Overlay Styles */
    #auth-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgb(255, 255, 255);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      padding-top: 2rem;
      align-items: center;
      box-sizing: border-box;
      overflow-y: auto;
    }
    
    .auth-logo {
      width: 180px;
      height: 180px;
      border-radius: 50%;
      overflow: hidden;
      margin: 0 auto 1.5rem;
      border: 2px solid #f0f0f0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .auth-logo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
    
    #signin-form,
    #signup-form {
      width: 100%;
      max-width: 400px;
    }
    
    #signin-form h2,
    #signup-form h2 {
      text-align: center;
      margin-bottom: 1.5rem;
    }
    
    #signin-form input,
    #signup-form input,
    #signin-form button,
    #signup-form button {
      width: 100%;
      margin: 0.5rem 0;
      padding: 0.5rem;
      box-sizing: border-box;
    }
    
    #signin-form a,
    #signup-form a {
      display: block;
      text-align: center;
      margin-top: 1rem;
      color: #4285f4;
      text-decoration: none;
    }
    
    #signin-form a:hover,
    #signup-form a:hover {
      text-decoration: underline;
    }
    
    #signup-form {
      display: none;
    }
    
    /* Lock functionality styles */
    .time-slot {
      position: relative; /* For absolute positioning of lock indicator */
      transition: opacity 0.2s ease, background-color 0.2s ease;
    }
    
    .time-slot.locked {
      opacity: 0.7;
      background-color: rgba(0, 0, 0, 0.05) !important;
      cursor: not-allowed;
      pointer-events: none;
    }
    
    /* Lock indicator */
    .lock-indicator {
      position: absolute;
      top: 2px;
      right: 2px;
      font-size: 12px;
      z-index: 10;
      pointer-events: none;
    }
    
    /* Prevent interaction with locked time slots */
    .time-slot.locked * {
      pointer-events: none !important;
    }

    .lock-status {
      font-size: 12px;
      color: #666;
      margin-top: 5px;
      font-style: italic;
    }

    :root {
      --bg-color: #ffffff;
      --card-bg: #ffffff;
      --text-color: #333;
      --accent-color: #e8f4f8;
      --active-color: #4a89dc;
      --pm-slot-bg: #f8f9fa;
    }
    * { box-sizing: border-box; }
    body {
      font-family: sans-serif;
      background: #ffffff;
      color: var(--text-color);
      margin: 0;
      padding: 0;  /* Zero padding for max space */
      height: 100vh;  /* Full viewport height */
      overflow: hidden;  /* Prevent any scrolling */
      box-sizing: border-box;
      /* Handle iOS safe areas */
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
    
    .container {
      max-width: 100vw;  /* Full width on mobile */
      height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));  /* Account for safe areas */
      display: flex;
      flex-direction: column;
      margin: 8px;
      padding: 4px;  /* Minimal padding */
      margin-bottom: 0;  /* Remove bottom margin that pushes content down */
      margin-top: 0px;
    }
    

    header h1 { text-align: center; font-size: 1.6em; margin: 6px 0; min-height: 8vh; align-content: center;}  /* Balanced size */
    .school-selector { display: flex; justify-content: space-around; margin-bottom: 6px; min-height: 8%;}
    .school-btn { width: 48%; padding: 6px; font-size: 0.95em; border-radius: 8px; border: 2px solid var(--accent-color); background-color: var(--card-bg); cursor: pointer; }
    .school-btn.active { background-color: var(--active-color); border-color: var(--active-color); }
    .school-btn img {
      max-height: 97%;  /* Fills the button's height fully */
      max-width: 100%;    /* Keeps aspect ratio, prevents stretching */
      vertical-align: middle; /* Centers vertically with text */
    }
    #schedule-container {
      flex-grow: 1;  /* Grow to fill space */
      display: flex;  /* Enable flex for child cards */
      flex-direction: column;  /* Stack vertically */
      overflow-y: auto;  /* Internal scroll if needed */
      margin-bottom: 6px;
      margin-top: 10px;
      padding: 8px;
    }
    .day-card {
      display: flex;
      flex-grow: 1;  /* Each card stretches to fill available space evenly */
      margin-bottom: 4px;
      background-color: var(--card-bg);
      border-radius: 12px;
      border: 1px solid var(--text-color);
      overflow: hidden;
      box-shadow: 0 2px 4px rgba(0,0,0,0.14);
      transform: scale(0.95);
      transition: transform 0.3s ease-in-out;
    }
    .day-card.current-day {
      border: 2px solid #7CB342;
      box-shadow: 0 4px 12px rgba(124,179,66,0.2);
      transform: scale(1);
      margin-top: 5px;
      margin-bottom: 9px;
    }

* { box-sizing: border-box; }
body {
  font-family: sans-serif;
  background: #ffffff;
  color: var(--text-color);
  margin: 0;
  padding: 0;  /* Zero padding for max space */
  height: 100vh;  /* Full viewport height */
  overflow: hidden;  /* Prevent any scrolling */
  box-sizing: border-box;
  /* Handle iOS safe areas */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.container {
  max-width: 100vw;  /* Full width on mobile */
  height: 100vh;  /* Fill available height */
  display: flex;
  flex-direction: column;
  margin: 10px;
  padding: 4px;  /* Minimal padding */
  margin-bottom: 50px;
  margin-top: 0px;
}
header h1 { 
  text-align: center; 
  margin: 6px 0; 
  min-height: 8vh; 
  align-content: center;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: nowrap; /* Prevent wrapping */
  gap: 0.3em; /* Small space between words */
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.12);
}  /* Elegant typography with subtle shadow */

.canyon {
  color: #8B4513; /* Canyon brown */
  font-weight: 400;
  font-size: 8vw;
  font-family: 'Smooch', system-ui, sans-serif;
  white-space: nowrap; /* Prevent line breaks */
}

.carpool {
  color: #4682B4; /* Steel blue */
  font-weight: 400;
  font-family: 'Cal Sans', Arial, Helvetica, sans-serif;
  font-size: 4vw;
  position: relative;
  top: 0.3em; /* Lower position by 30% */
  white-space: nowrap; /* Prevent line breaks */
}

.school-selector { display: flex; justify-content: space-around; margin-bottom: 6px; min-height: 8%;}
.school-btn { width: 48%; padding: 6px; font-size: 0.95em; border-radius: 8px; border: 2px solid var(--accent-color); background-color: var(--card-bg); cursor: pointer; }
.school-btn.active { background-color: var(--active-color); border-color: var(--active-color); }
.school-btn img {
  max-height: 97%;  /* Fills the button's height fully */
  max-width: 100%;    /* Keeps aspect ratio, prevents stretching */
  vertical-align: middle; /* Centers vertically with text */
}
#schedule-container {
  flex-grow: 1;  /* Grow to fill space */
  display: flex;  /* Enable flex for child cards */
  flex-direction: column;  /* Stack vertically */
  overflow-y: auto;  /* Internal scroll if needed */
  margin-bottom: 6px;
  margin-top: 10px;
  padding: 8px;
}
.day-card {
  display: flex;
  flex-grow: 1;  /* Each card stretches to fill available space evenly */
  margin-bottom: 4px;
  background-color: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--text-color);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.14);
  transform: scale(0.95);
  transition: transform 0.3s ease-in-out;
}
.day-card.current-day {
  border: 2px solid #7CB342;
  box-shadow: 0 4px 12px rgba(124,179,66,0.2);
  transform: scale(1);
  margin-top: 5px;
  margin-bottom: 9px;
}

.current-day .day-label {
  background-color: #e8f5e1;
}
.day-label { background-color: var(--accent-color); padding: 4px; text-align: center; width: 25%; display: flex; flex-direction: column; justify-content: center; }
.day-label .day-name { font-size: 2.2em; font-weight: medium; }
.day-label .day-date { font-size: 1.1em; }
.slots-container { flex-grow: 1; width: 75%; display: flex; flex-direction: column; }  /* Allow slots to stretch too */
.time-slot { padding: 6px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 1.3em; flex-grow: 1; }  /* Stretch slots */
.time-slot:first-child { border-bottom: 1px solid var(--accent-color); }
.time-slot.pm { background-color: var(--pm-slot-bg); }
.time-slot .time { color: #555; margin-right: 10px; margin-left: 10px; text-align: center;}
.time-slot .time .am-pm { font-size: 0.6em; } /* Make AM/PM 60% of current size */
.time-slot .driver { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-left: 2%;}
.time-slot .icon { color: #E6A23C; font-size: 0.9em; margin-left: 3px; }
.time-slot .icon-placeholder { width: 1em; display: inline-block; visibility: hidden; } /* Reserves space for icon alignment */
.notes-pane { margin-top: 6px; margin-bottom: 6px; padding: 8px; background-color: #ffffff; border-radius: 12px; border: 1px solid #e0e0e0; min-height: 10%; white-space: pre-wrap; font-size: 1.0em; }
.nav-controls { display: flex; justify-content: flex-start; align-items: stretch; margin-top: 6px; min-height: 60px;}
.nav-btn { flex: 1; padding: 8px 3px; font-size: 1.5em; border-radius: 8px; border: 2px solid #4a89dc; background-color: #4a89dc; color: white; cursor: pointer; font-weight: 500; transition: all 0.2s ease; margin-right: 8px; }
.nav-btn:hover { background-color: #357abd; border-color: #357abd; transform: translateY(-1px); }
.nav-btn:active { transform: translateY(0); }
.nav-controls > .nav-btn:last-child { margin-right: 0; }

/* Edit controls container for Edit Trips + Add button */
.edit-controls { 
  display: flex; 
  gap: 8px; 
  flex: 1;
  align-items: stretch;
  margin-right: 0;
}

.edit-btn-small { 
  flex: 1; 
  width: auto; 
  min-width: 80px;
  font-size: 1.2em;
  padding: 8px 8px;
  margin-right: 0;
}

.add-btn { 
  width: 38px; 
  flex-shrink: 0;
  font-size: 3em !important;
  padding: 4px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #4a89dc;
  border-color: #4a89dc;
  margin-right: 8px;
}

.add-btn:hover {
  background-color: #357abd;
  border-color: #357abd;
}
#loader { text-align: center; padding: 20px; font-size: 1.5em; }

/* Apple-specific base adjustments */
.is-apple .nav-controls {
  flex-shrink: 0;  /* Never shrink nav controls - most important */
  min-height: 50px;  /* Guarantee nav button visibility */
}

.is-apple .day-card {
  margin-bottom: 2px;  /* Tighter spacing between cards */
}

/* Driver selection popup modal */
.driver-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.driver-popup {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 20px;
  max-width: 300px;
  width: 80%;
  text-align: center;
}

.driver-popup h3 {
  margin: 0 0 15px 0;
  color: var(--am-color);
  font-size: 1.2em;
}

.driver-option {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 5px 0;
  border: 2px solid #ddd;
  border-radius: 8px;
  background-color: white;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.driver-option:hover {
  background-color: var(--am-color);
  color: white;
  border-color: var(--am-color);
}

.driver-option.special {
  background-color: #f8f9fa;
  font-style: italic;
}

/* Simple Time Picker Modal */
.time-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.time-picker-popup {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 20px;
  max-width: 300px;
  width: 80%;
  text-align: center;
}

.time-picker-popup h3 {
  margin: 0 0 15px 0;
  color: var(--am-color);
  font-size: 1.2em;
}

.time-selector {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.time-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.time-column label {
  font-size: 14px;
  font-weight: 500;
  color: #666;
}

.time-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.time-arrow {
  width: 40px;
  height: 30px;
  border: 2px solid #6c757d !important;
  background-color: #6c757d !important;
  color: white !important;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s ease;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

.time-arrow:hover {
  background-color: white !important;
  color: #6c757d !important;
  border-color: #6c757d !important;
}

.time-display {
  width: 60px;
  height: 40px;
  border: 2px solid #ddd;
  border-radius: 4px;
  background-color: #f8f9fa;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  line-height: 36px;
  margin: 4px 0;
}

.time-picker-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.time-picker-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.time-picker-btn.cancel {
  background-color: #6c757d;
  color: white;
}

.time-picker-btn.cancel:hover {
  background-color: #5a6268;
}

.time-picker-btn.save {
  background-color: #007bff !important;
  color: white !important;
  border: 2px solid #007bff !important;
  display: block !important;
  visibility: visible !important;
}

.time-picker-btn.save:hover {
  background-color: white !important;
  color: #007bff !important;
  border-color: #007bff !important;
}

/* Apple devices - broader targeting to catch iPhone 16 and PWA mode */
@media screen and (max-width: 430px) {
  .is-apple .container {
    height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 4px);
    margin: 4px;
    padding: 2px;
  }
  .is-apple header h1 { 
    margin: 2px 0; 
    min-height: 6vh; 
  }
  .is-apple .school-selector { 
    min-height: 7%; 
    margin-bottom: 2px; 
  }
  .is-apple #schedule-container { 
    max-height: 50vh; 
    flex-grow: 0.6; 
    overflow-y: auto;
    margin-top: 2px;
    margin-bottom: 2px;
  }
  .is-apple .notes-pane { 
    min-height: 35px; 
    padding: 5px; 
    margin-top: 2px;
    margin-bottom: 2px; 
    font-size: 0.95em;
  }
  .is-apple .nav-controls { 
    min-height: 50px; 
    margin-top: 2px; 
    flex-shrink: 0;
  }
  .is-apple .nav-btn { 
    padding: 7px 3px; 
    font-size: 1.3em; 
  }
}

/* App logo responsive styles */
.app-logo img {
  height: 44px;
  width: auto;
}

/* Media query for small screens (e.g., Pixel/iPhone portrait, <414px) */
@media screen and (max-width: 414px) {
  header h1 { margin: 4px 0; }
  
  .app-logo img {
    height: 35px;
  }
  
  .school-selector {max-height: 10%;}
  .school-btn { padding: 4px; font-size: 0.85em; }
  .school-btn img {max-height: 97%; max-width: 100%; vertical-align: middle;}
  .day-card { margin-bottom: 3px; }
  .day-label { padding: 3px; width: 30%; }  /* Balanced for small screens */
  .day-label .day-name { font-size: 2.2em; }
  .day-label .day-date { font-size: 1.1em; }
  .time-slot { padding: 4px; font-size: 1.3em; }
  .notes-pane { padding: 6px; min-height: 60px; font-size: 1.0em; }
  .nav-btn { padding: 6px 2px; font-size: 1.5em; }
  .container { padding: 2px; }  /* Even tighter */
}

.editable {
  border-bottom: 1px dashed #ccc;  /* Subtle underline for editable fields */
  cursor: text;
  min-width: 50px;  /* Prevent collapse */
  display: inline-block;  /* Keep inline for natural flow */
}

.editable:focus {
  outline: none;
  border-bottom: 1px solid var(--accent-color);  /* Highlight on focus */
  background-color: #fff;  /* Light bg for editing */
}

#notes-pane.editable {
  border: 1px dashed var(--accent-color);
  padding: 6px;
  min-height: 80px;  /* More space for editing */
  white-space: pre-wrap;  /* Preserve newlines */
  overflow-y: auto;  /* Scroll if long */
}

/* New styles for edit notes button */
.edit-notes-btn {
  cursor: pointer;
  font-size: 0.8em;
  color: #555;
  margin-left: 5px;
  padding: 2px 4px;
  border-radius: 4px;
  background-color: transparent;
  transition: background-color 0.2s;
}
.popup-toggle-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
}

.popup-toggle-btn {
  padding: 8px 16px;
  cursor: pointer;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1em;
  flex: 0 1 auto;
  min-width: fit-content;
  white-space: nowrap;
}

/* Responsive adjustments for narrow screens */
@media screen and (max-width: 430px) {
  .popup-toggle-btn {
    padding: 8px 12px;
    font-size: 0.95em;
  }
  
  .time-picker-popup {
    width: 95%;
    max-width: 95%;
    padding: 15px;
  }
  
  .edit-popup-fixed-size {
    width: 95vw;
    max-width: 95%;
    height: 70vh;
  }
}

/* Extra narrow screens (like 360px Samsung phones) */
@media screen and (max-width: 380px) {
  .popup-toggle-btn {
    padding: 6px 10px;
    font-size: 0.9em;
  }
  
  .popup-toggle-container {
    gap: 6px;
    padding: 0 5px;
  }
}

.popup-toggle-btn.active {
  background-color: var(--active-color);
  color: white;
  border-color: var(--active-color);
}

.driver-option, .rider-option {
  display: block;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.driver-option input, .rider-option input {
  margin-right: 10px;
  width: 18px;
  height: 18px;
}

.edit-notes-btn:hover {
  background-color: #e0e0e0;
}
.edit-notes-btn.active {
  background-color: var(--active-color);
  color: #fff;
}

/* Fixed size edit popup to prevent resizing */
.edit-popup-fixed-size {
  height: 60vh;  /* Fixed height using viewport units */
  width: 90vw;   /* Responsive width */
  max-width: 90%; /* Fallback for older browsers */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent modal from scrolling */
}

/* Content area with scroll for overflow */
.edit-popup-content {
  flex: 1;       /* Take up remaining space */
  overflow-y: auto;
  margin-bottom: 15px;
  padding: 5px;
  min-height: 0; /* Allow flex shrinking */
}

/* 2-column layout for driver options */
#driver-list-container.driver-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow-y: auto;
  align-content: start;
}

.driver-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #f9f9f9;
  font-size: 0.9em;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: center;
}

.driver-option:hover {
  background-color: var(--active-color);
  color: white;
}

/* Selected state for driver - orange background with checkmark */
.driver-option.selected {
  background-color: #ff6b47;
  border-color: #ff6b47;
  color: white;
}

.driver-option.selected:hover {
  background-color: #ff5722;
  border-color: #ff5722;
}

/* Add SVG checkmark for selected driver */
.driver-option.selected::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.driver-option input {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}

/* Exception button styling - matches driver buttons exactly */
#rider-list-container.exception-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: min-content;
  gap: 8px;
  height: 100%;
  overflow-y: auto;
}

#rider-list-container .exception-option {
  display: flex;
  align-items: center;
  padding: 8px;
  margin: 0;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #f9f9f9;
  font-size: 0.9em;
  cursor: pointer;
  transition: background-color 0.2s;
  max-height: 50px;
  min-height: 40px;
}

#rider-list-container .exception-option:hover {
  background-color: var(--active-color);
  color: white;
}

/* Selected state - lighter red/orange to indicate "not riding" */
#rider-list-container .exception-option.selected {
  background-color: #ff6b47;
  border-color: #ff6b47;
  color: white;
}

#rider-list-container .exception-option.selected:hover {
  background-color: #ff5722;
  border-color: #ff5722;
}

/* Hide the actual checkbox */
#rider-list-container .exception-option input[type="checkbox"] {
  display: none;
}

/* Add SVG checkmark for selected state */
#rider-list-container .exception-option.selected::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Profile Page Styles */
.profile-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: #f5f5f5;
  min-height: 100vh;
}

.profile-section {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
}

.profile-section h2 {
  margin-top: 0;
  margin-bottom: 25px;
  color: #2c3e50;
  font-size: 1.8em;
  font-weight: 600;
  border-bottom: 3px solid #4a89dc;
  padding-bottom: 12px;
}

.profile-section h3 {
  margin-top: 30px;
  margin-bottom: 20px;
  color: #34495e;
  font-size: 1.3em;
  font-weight: 500;
}

.section-description {
  color: #7f8c8d;
  margin-bottom: 25px;
  font-size: 15px;
  line-height: 1.5;
}

/* Profile Picture Section */
.profile-picture-section {
  text-align: center;
  margin-bottom: 35px;
  padding: 20px 0;
}

.profile-picture-container {
  position: relative;
  display: inline-block;
}

.profile-picture {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #4a89dc;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.profile-picture-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #ddd;
  font-size: 40px;
  color: #999;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.profile-picture-upload {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: #4a89dc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.profile-picture-upload:hover {
  background: #3a6fc8;
  transform: scale(1.1);
}

/* Form Styles */
.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.3s ease;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #4a89dc;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 137, 220, 0.1);
}

.disabled-input {
  background-color: #f8f9fa !important;
  cursor: not-allowed;
  color: #6c757d;
}

.form-help {
  color: #7f8c8d;
  font-size: 12px;
  margin-top: 6px;
  display: block;
  font-style: italic;
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #4a89dc, #357abd);
  color: white;
  box-shadow: 0 2px 4px rgba(74, 137, 220, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #357abd, #2c5aa0);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(74, 137, 220, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
  box-shadow: 0 2px 4px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.btn-danger {
  background: #e74c3c;
  color: white;
  box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.btn-danger:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
}

/* Button Groups */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

/* Password Section */
.password-section {
  border-top: 2px solid #ecf0f1;
  padding-top: 30px;
  margin-top: 30px;
}

.password-form {
  margin-top: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

/* Family Members */
.family-members-list {
  margin-bottom: 30px;
}

.no-family-members {
  text-align: center;
  padding: 50px 20px;
  color: #7f8c8d;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #bdc3c7;
  font-style: italic;
}

.family-member-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  margin-bottom: 15px;
  background: #fff;
  border: 2px solid #ecf0f1;
  border-radius: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.family-member-card:hover {
  border-color: #4a89dc;
  box-shadow: 0 4px 12px rgba(74, 137, 220, 0.15);
  transform: translateY(-2px);
}

.family-member-info h4 {
  margin: 0 0 10px 0;
  color: #2c3e50;
  font-size: 18px;
  font-weight: 600;
}

.family-member-details {
  display: flex;
  gap: 12px;
}

.relationship-badge,
.role-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 20px;
  font-weight: 500;
  text-transform: capitalize;
}

.relationship-badge {
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  color: #1565c0;
  border: 1px solid #90caf9;
}

.role-badge {
  background: linear-gradient(135deg, #f3e5f5, #e1bee7);
  color: #6a1b9a;
  border: 1px solid #ce93d8;
}

/* Add Family Form */
.add-family-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.add-family-form {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  border: 2px solid #e9ecef;
  margin-top: 20px;
}

.add-family-form h3 {
  margin-top: 0;
  margin-bottom: 25px;
  color: #2c3e50;
  font-size: 1.3em;
}

/* Loading and Error States */
.profile-loading,
.profile-error {
  text-align: center;
  padding: 80px 20px;
  font-size: 18px;
}

.profile-loading {
  color: #7f8c8d;
}

.profile-error {
  color: #e74c3c;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .profile-page {
    padding: 15px;
  }
  
  .profile-section {
    padding: 20px;
    margin-bottom: 20px;
  }
  
  .profile-picture,
  .profile-picture-placeholder {
    width: 100px;
    height: 100px;
  }
  
  .profile-picture-placeholder {
    font-size: 35px;
  }
  
  /* Keep family-member-card in row layout at all screen sizes */
  
  .button-group {
    flex-direction: column;
  }
  
  .button-group .btn {
    width: 100%;
  }
}

/* Carpool Control Panel Styles */
.carpool-control-panel {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.panel-header {
  text-align: center;
  margin-bottom: 30px;
}

.panel-header h3 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.8em;
}

.panel-header p {
  color: #666;
  margin: 0;
}

.panel-header .btn {
  margin-top: 15px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #dee2e6;
}

.empty-state h4 {
  color: #666;
  margin: 20px 0 10px 0;
}

.empty-state p {
  color: #888;
  margin-bottom: 30px;
}

/* Carpool List */
.carpool-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.carpool-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.carpool-info h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.3em;
}

.carpool-info p {
  margin: 5px 0;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.carpool-info i {
  width: 16px;
  text-align: center;
}

.carpool-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 500;
  margin-top: 10px;
  background: #f8f9fa;
  color: #666;
}

.carpool-status.active {
  background: #d4edda;
  color: #155724;
}

.carpool-actions {
  display: flex;
  margin-top: 15px;
}

.carpool-actions .btn {
  width: 100%;
  justify-content: center;
}

.btn-danger {
  background: #dc3545;
  color: white;
  border: 2px solid #dc3545;
}

.btn-danger:hover {
  background: #c82333;
  border-color: #bd2130;
}

.btn-add-carpool {
  width: 100%;
  padding: 20px;
  border: 2px dashed #6c757d;
  background: transparent;
  color: #6c757d;
  border-radius: 12px;
  font-size: 1.1em;
}

.btn-add-carpool:hover {
  background: #f8f9fa;
  border-color: #5a6268;
}

/* Form Sections */
.carpool-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
}

.form-section h4 {
  margin: 0 0 20px 0;
  color: #333;
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #6c757d;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1em;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.required {
  color: #e74c3c;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #6c757d;
}

/* Day Selector */
.day-selector {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
}

.weekends {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.day-btn {
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  text-align: center;
}

.day-btn.weekday {
  padding: 10px 8px;
  font-size: 0.95em;
}

.day-btn.weekend {
  padding: 12px 16px;
  font-size: 1em;
}

.day-btn:hover {
  border-color: #6c757d;
}

.day-btn.selected {
  background: #6c757d;
  color: white;
  border-color: #6c757d;
}

/* Time Inputs */
.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Date Inputs */
.date-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

.date-inputs input[type="date"] {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
}

.date-inputs input[type="date"]:focus {
  border-color: #4a89dc;
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 137, 220, 0.1);
}

.time-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.time-input-wrapper input {
  flex: 1;
}

.btn-time-picker {
  padding: 12px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  color: #6c757d;
  transition: all 0.2s;
}

.btn-time-picker:hover {
  border-color: #6c757d;
  background: #f8f9fa;
}

/* Driver/Passenger Lists */
.drivers-list,
.passengers-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.driver-input,
.passenger-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  position: relative;
}

.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-action input {
  flex: 1;
}

.btn-remove {
  padding: 8px;
  border: none;
  background: #e74c3c;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-remove:hover {
  background: #c0392b;
}

.help-text {
  color: #666;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

/* Form Actions */
.form-actions {
  text-align: center;
  padding: 30px 0;
}

.btn-large {
  padding: 15px 30px;
  font-size: 1.2em;
}

/* Invite Management */
.invites-section {
  max-width: 600px;
  margin: 0 auto;
}

.current-drivers-section,
.invite-code-section,
.invite-link-section,
.email-invites-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e0e0e0;
}

.drivers-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.driver-card {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #e0e0e0;
}

.driver-info {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.driver-info i.fa-user-circle {
  font-size: 2.5em;
  color: #4a89dc;
  margin-top: 5px;
}

.driver-info strong {
  display: block;
  font-size: 1.1em;
  margin-bottom: 5px;
  color: #333;
}

.contact-info {
  font-size: 0.9em;
  color: #666;
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-info i {
  width: 16px;
  color: #4a89dc;
}

.contact-link {
  text-decoration: none;
  color: #4a89dc;
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
  margin-left: -8px;
}

.contact-link:hover {
  background: #e8f4f8;
  color: #357abd;
  text-decoration: underline;
}

.contact-link i {
  color: inherit;
}

.invite-code-display,
.invite-link-display {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 15px 0;
}

.invite-code-display code {
  background: #f8f9fa;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1.3em;
  font-weight: bold;
  letter-spacing: 2px;
  border: 2px solid #e0e0e0;
}

.invite-link-display input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
}

/* Passengers Section */
.passengers-section {
  max-width: 600px;
  margin: 0 auto;
}

.passenger-item.family-member {
  border-left: 4px solid #28a745;
  background: #f8fff9;
}

.passenger-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 15px;
}

.passenger-header .form-group {
  flex: 1;
  margin-bottom: 0;
}

.family-toggle {
  flex-shrink: 0;
  margin-top: 25px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9em;
}

.toggle-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.toggle-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: #666;
  transition: color 0.2s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-text {
  color: #28a745;
}

.passenger-details {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 15px;
  margin-bottom: 15px;
}

.family-notice {
  background: #e8f5e8;
  border: 1px solid #c3e6c3;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 15px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9em;
  color: #155724;
}

.family-notice i {
  color: #28a745;
  margin-top: 2px;
  flex-shrink: 0;
}

.family-notice span {
  line-height: 1.4;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 1.1em;
}

/* Responsive Design */
@media (max-width: 768px) {
  .carpool-card {
    flex-direction: column;
    gap: 15px;
  }
  
  /* Keep 2x2 grid on mobile - no override needed */
  
  .time-inputs {
    grid-template-columns: 1fr;
  }
  
  .date-inputs {
    grid-template-columns: 1fr;
  }
  
  .weekdays {
    gap: 8px;
  }
  
  .weekends {
    gap: 8px;
  }
  
  .day-btn.weekday {
    padding: 10px 4px;
    font-size: 0.9em;
  }
  
  .day-btn.weekend {
    padding: 12px 8px;
  }
  
  .invite-code-display,
  .invite-link-display {
    flex-direction: column;
    align-items: stretch;
  }
  
  .passenger-header {
    flex-direction: column;
    gap: 15px;
  }
  
  .family-toggle {
    margin-top: 0;
  }
  
  .passenger-details {
    grid-template-columns: 1fr;
  }
}
 