/* Page Container */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #4a89dc;
  outline: none;
  box-shadow: 0 0 0 2px rgba(74, 137, 220, 0.2);
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #4a89dc;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  transition: background-color 0.3s;
}

.btn:hover {
  background: #3a6fc8;
}

.btn-primary {
  background: #4a89dc;
}

.btn-primary:hover {
  background: #3a6fc8;
}

.btn-secondary {
  background: #aab2bd;
  margin-left: 10px;
}

.btn-secondary:hover {
  background: #999;
}

/* Section Styles */
.settings-section {
  margin-bottom: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 6px;
}

.settings-section h3 {
  margin-top: 0;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* Toggle Switch */
.toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4a89dc;
}

input:focus + .slider {
  box-shadow: 0 0 1px #4a89dc;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.switch input:disabled + .slider {
  background-color: #e0e0e0;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Carpool Cards */
.carpool-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  transition: all 0.3s;
}

.carpool-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.carpool-card.active {
  border-left: 4px solid #4a89dc;
}

.carpool-info h4 {
  margin: 0 0 5px 0;
  color: #333;
}

.carpool-info p {
  margin: 5px 0;
  color: #666;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.carpool-info p i {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.carpool-info p strong {
  flex-shrink: 0;
}

.carpool-status {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 12px;
  background: #eee;
  color: #666;
}

.carpool-status.active {
  background: #e1f5e6;
  color: #2e7d32;
}

/* Profile Page Styles */
.profile-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.profile-section {
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.profile-section h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
  font-size: 1.5em;
  border-bottom: 2px solid #4a89dc;
  padding-bottom: 10px;
}

.profile-section h3 {
  margin-top: 25px;
  margin-bottom: 15px;
  color: #333;
  font-size: 1.2em;
}

.section-description {
  color: #666;
  margin-bottom: 20px;
  font-size: 14px;
}

/* Profile Picture Section */
.profile-picture-section {
  text-align: center;
  margin-bottom: 30px;
}

.profile-picture-container {
  position: relative;
  display: inline-block;
}

.profile-picture {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #4a89dc;
}

.profile-picture-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #ddd;
  font-size: 40px;
  color: #999;
}

.profile-picture-upload {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 35px;
  height: 35px;
  background: #4a89dc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  font-size: 14px;
  transition: background-color 0.3s;
}

.profile-picture-upload:hover {
  background: #3a6fc8;
}

/* Personal Info Form */
.personal-info-form {
  margin-bottom: 30px;
}

.disabled-input {
  background-color: #f5f5f5 !important;
  cursor: not-allowed;
}

.form-help {
  color: #666;
  font-size: 12px;
  margin-top: 5px;
  display: block;
}

/* Password Section */
.password-section {
  border-top: 1px solid #eee;
  padding-top: 25px;
}

.password-form {
  margin-top: 20px;
}

/* Button Groups */
.button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.button-group .btn {
  flex: none;
}

/* Family Members Section */
.family-members-list {
  margin-bottom: 25px;
}

.no-family-members {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  background: #f9f9f9;
  border-radius: 6px;
  border: 2px dashed #ddd;
}

.family-member-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 6px;
  transition: all 0.3s;
  flex-wrap: nowrap; /* Keep buttons on the right, even in narrow windows */
}

.family-member-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-color: #4a89dc;
}

.family-member-info {
  flex: 0 1 auto; /* Only take the space needed, allow shrinking if necessary */
  min-width: 0; /* Allow content to shrink below its natural size */
}

.family-member-info h4 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 16px;
}

.family-member-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

.family-member-actions .btn-small {
  min-width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.family-member-details {
  display: flex;
  gap: 10px;
}

.relationship-badge,
.role-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.relationship-badge {
  background: #e3f2fd;
  color: #1976d2;
}

.role-badge {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* Add Family Form */
.add-family-btn {
  display: flex;
  align-items: center;
  gap: 8px;
}

.add-family-form {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 6px;
  border: 1px solid #eee;
  margin-top: 15px;
}

.add-family-form h3 {
  margin-top: 0;
  margin-bottom: 20px;
  color: #333;
}

/* Button Variants */
.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-small {
  padding: 8px 12px;
  font-size: 12px;
  min-width: auto;
}

/* Override for family member action buttons */
.family-member-card .family-member-actions .btn-small {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal Overlay and Content */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 24px;
}

.modal-content .button-group {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-top: 20px;
}

.modal-content .button-group .btn {
  flex: 1;
  width: auto;
}

/* Edit Menu */
.edit-menu {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 20px;
}

.expanded-section {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 25px;
  margin-top: 15px;
}

.expanded-section h4 {
  margin: 0 0 20px 0;
  color: #2c3e50;
  font-size: 20px;
}

/* Compact Passenger Cards */
.passenger-card-compact {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 12px;
}

/* Passenger delete button - force sizing on all devices */
.passenger-delete-btn {
  height: 37px !important;
  width: 37px !important;
  min-width: 37px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  align-self: flex-end !important;
  flex-shrink: 0 !important;
}

.passenger-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 10px;
}

.passenger-row .form-group {
  margin-bottom: 0;
}

.passenger-row .btn {
  flex-shrink: 0;
}

.passenger-row:last-child {
  margin-bottom: 0;
}

.family-toggle-compact {
  margin-top: 8px;
}

.family-toggle-compact .toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.family-toggle-compact input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.family-toggle-compact .toggle-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #666;
}

.menu-section {
  display: flex;
  align-items: center;
  padding: 15px;
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 10px;
}

.menu-section:hover {
  border-color: #4a89dc;
  box-shadow: 0 2px 8px rgba(74, 137, 220, 0.1);
}

.menu-section.active {
  background: #e3f2fd;
  border-color: #4a89dc;
}

.menu-section.danger {
  border-color: #ffebee;
  color: #d32f2f;
}

.menu-section.danger:hover {
  border-color: #ef5350;
  background: #fff5f5;
}

/* Collapsible Sections */
.collapsible-section {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
  margin-top: 20px;
  transition: all 0.3s;
  cursor: pointer;
}

.collapsible-section:hover {
  border-color: #4a89dc;
  box-shadow: 0 2px 8px rgba(74, 137, 220, 0.1);
}

.collapsible-section h4 {
  margin: 0 0 8px 0;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 10px;
}

.collapsible-section .section-description {
  margin: 0;
  color: #666;
  font-size: 14px;
}

.danger-section {
  border-color: #ffebee;
  background: #fff5f5;
}

.danger-section:hover {
  border-color: #ef5350;
  box-shadow: 0 2px 8px rgba(239, 83, 80, 0.1);
}

.danger-section h4 {
  color: #d32f2f;
}

/* Loading and Error States */
.profile-loading,
.profile-error {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.profile-error {
  color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 768px) {
  .page-container {
    padding: 15px;
  }
  
  .settings-section {
    padding: 15px;
  }
  
  .carpool-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .btn-edit {
    margin-top: 10px;
    align-self: flex-end;
  }
  
  .profile-page {
    padding: 10px;
  }
  
  .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 on all screen sizes */
  
  .family-member-details {
    flex-wrap: wrap; /* Allow badges to wrap if needed on small screens */
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .button-group .btn {
    width: 100%;
  }
}

/* ─── Upgrade / Subscription Styles ────────────────────────────────────── */

.upgrade-header {
  text-align: center;
  margin-bottom: 24px;
}

.upgrade-header h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.upgrade-header p {
  color: #666;
  margin: 0;
}

.upgrade-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.upgrade-active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.early-adopter-badge {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.trial-badge {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.household-badge {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: #333;
}

/* Plan Selector */
.plan-selector {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 20px 0;
}

.plan-card {
  position: relative;
  flex: 1;
  max-width: 200px;
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.plan-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.plan-card.selected {
  border-color: #667eea;
  background: #f8f7ff;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.plan-card h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #333;
}

.plan-price {
  margin: 8px 0;
}

.price-amount {
  font-size: 28px;
  font-weight: 700;
  color: #333;
}

.price-period {
  font-size: 14px;
  color: #666;
}

.plan-subtext {
  font-size: 12px;
  color: #667eea;
  font-weight: 600;
  margin-top: 4px;
}

.save-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #667eea;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

/* Upgrade Button */
.btn-upgrade {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.btn-upgrade:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Feature Comparison */
.feature-comparison {
  margin-top: 24px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
}

.feature-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
}

.feature-row:last-child {
  border-bottom: none;
}

.feature-header-row {
  background: #f8f8f8;
  font-weight: 600;
  font-size: 13px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.feature-name {
  font-size: 14px;
  color: #333;
}

.feature-free,
.feature-premium {
  text-align: center;
  font-size: 14px;
}

.check {
  color: #4CAF50;
  font-weight: 700;
  font-size: 18px;
}

.cross {
  color: #ccc;
  font-size: 18px;
}

/* Subscription Section in Settings */
.subscription-section {
  margin-bottom: 20px;
}

.subscription-free,
.subscription-active {
  padding: 4px 0;
}

/* Household Section */
.household-section {
  margin-bottom: 20px;
}

.household-members-list {
  margin: 12px 0;
}

.household-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 8px;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-danger {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.btn-danger:hover {
  background: #c0392b;
}

@media (max-width: 480px) {
  .plan-selector {
    flex-direction: column;
    align-items: center;
  }

  .plan-card {
    max-width: 100%;
    width: 100%;
  }

  .feature-row {
    grid-template-columns: 1fr 60px 60px;
    padding: 10px 12px;
  }

  .feature-name {
    font-size: 13px;
  }
}
