/* Applicant Form Styles - Integrated with page-base.css */

/* Form container - sections are now handled by page-sections.css */
.applicant-form {
  display: flex;
  flex-direction: column;
  gap: inherit; /* Use gap from main */
}

/* Application form content wrapper */
#applicationFormContent {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 4vw, 40px);
}

/* Form grid layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Labels */
.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.required {
  color: var(--error-DEFAULT);
  font-weight: 700;
}

.helper-text {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: -4px;
}

/* Section lead text override for form sections */
section .section-lead {
  margin-bottom: clamp(20px, 3vw, 28px);
  color: var(--gray-600);
  font-size: clamp(16px, 2.2vw, 18px);
}

/* Form input styles */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--text-primary) 40%, transparent);
  background: #f1f5f9;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.form-group input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 30%, transparent);
  background: color-mix(in srgb, var(--text-primary) 5%, white);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s ease;
}

.form-group input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--text-primary) 10%, white);
  border-color: var(--text-primary);
}

.form-group input:not([type="radio"]):not([type="checkbox"]):focus,
.form-group select:focus,
.form-group textarea:focus,
.form-group input[type="file"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
  border-color: var(--error-DEFAULT);
}

.section-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

/* Form Grid Layout */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Labels */
.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.required {
  color: var(--error-DEFAULT);
  font-weight: 700;
}

.helper-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: -4px;
}

.helper-text p {
  margin: 0 0 4px 0;
  font-style: normal;
  font-weight: 500;
}

.helper-text ul {
  margin: 4px 0 0 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: normal;
}

.helper-text ul li {
  margin-bottom: 4px;
  line-height: 1.5;
}

.helper-text ul li:last-child {
  margin-bottom: 0;
}

/* Input Fields */
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--text-primary) 40%, transparent);
  background: #f1f5f9;
  font-size: 14px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.form-group input[type="file"] {
  padding: 10px;
  cursor: pointer;
}

.form-group input[type="file"]::file-selector-button {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 30%, transparent);
  background: color-mix(in srgb, var(--text-primary) 5%, white);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s ease;
}

.form-group input[type="file"]::file-selector-button:hover {
  background: color-mix(in srgb, var(--text-primary) 10%, white);
  border-color: var(--text-primary);
}

.form-group input:not([type="radio"]):not([type="checkbox"]):focus,
.form-group select:focus,
.form-group textarea:focus,
.form-group input[type="file"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group select:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
  border-color: var(--error-DEFAULT);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231f2937' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Input with Prefix (for currency) */
.input-with-prefix {
  position: relative;
  display: flex;
}

.input-with-prefix .prefix {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
  pointer-events: none;
}

.form-group .input-with-prefix input,
.input-with-prefix input[type="number"] {
  padding-left: 52px;
  width: 100%;
}

/* Checkbox Styles */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px;
  border-radius: 10px;
  transition: background 0.2s ease;
  user-select: none;
}

.checkbox-label:hover {
  background: color-mix(in srgb, var(--text-primary) 3%, white);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label span {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Checkbox Group (multiple checkboxes) */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group .checkbox-label {
  margin: 0;
}

.consent-label {
  background: color-mix(in srgb, var(--text-primary) 5%, white);
  border: 2px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
  padding: 16px;
}

/* Dynamic Item Cards (Vehicles/Trailers) */
.dynamic-item {
  background: linear-gradient(135deg, color-mix(in srgb, var(--text-primary) 3%, white) 0%, color-mix(in srgb, var(--text-secondary) 3%, white) 100%);
  border: 2px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dynamic-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.dynamic-item-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.remove-button {
  background: #dc2626;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

.remove-button:hover {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* Add Button */
.add-button {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.add-button:hover {
  background: color-mix(in srgb, var(--primary) 85%, black);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.add-button .add-icon {
  font-size: 24px;
  font-weight: 700;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 0;
}

.secondary-button {
  padding: 14px 32px;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: white;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.secondary-button:hover {
  background: color-mix(in srgb, var(--primary) 5%, white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.submit-button {
  padding: 14px 40px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.submit-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.submit-button:hover::before {
  width: 300px;
  height: 300px;
  overflow: hidden; /* Prevent the pseudo-element from affecting layout */
}

.submit-button:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 30px color-mix(in srgb, var(--primary) 40%, transparent);
}

.submit-button:active {
  transform: translateY(-1px);
}

/* Summary Section */
.summary-section {
  background: linear-gradient(135deg, color-mix(in srgb, var(--text-primary) 5%, white) 0%, color-mix(in srgb, var(--text-secondary) 5%, white) 100%);
  border: 2px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
}

.summary-content {
  display: grid;
  gap: 16px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-radius: 8px;
  border-left: 4px solid var(--text-primary);
}

.summary-label {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
}

.summary-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
  text-align: right;
}

.summary-totals {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  display: flex;
  justify-content: space-around;
  margin-top: 16px;
  box-shadow: var(--shadow-md);
}

.summary-total-item {
  text-align: center;
}

.summary-total-label {
  font-size: 12px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.summary-total-value {
  font-size: 28px;
  font-weight: 800;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 12, 41, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: 24px;
  padding: 48px;
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(102, 126, 234, 0.3);
  animation: slideUp 0.4s ease-out;
  text-align: center;
}

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

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, var(--success-DEFAULT, #10b981) 0%, var(--success-hover, #059669) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: white;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.modal-content h2 {
  margin: 0 0 16px 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-content p {
  margin: 0 0 16px 0;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 15px;
}

.reference-number {
  background: color-mix(in srgb, var(--text-primary) 10%, white);
  padding: 16px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
  margin-top: 24px;
}

.reference-number strong {
  color: var(--text-primary);
  font-size: 18px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.modal-button {
  margin-top: 24px;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.modal-button:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Button primary (for modals) */
.btn.btn-primary {
  margin-top: 24px;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.btn.btn-primary:hover {
  background: color-mix(in srgb, var(--primary) 90%, black);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Responsive Design */
@media (max-width: 720px) {
  .applicant-wrap {
    margin: 16px;
    padding: 20px;
  }

  .form-section {
    padding: 24px 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .secondary-button,
  .submit-button {
    width: 100%;
  }

  .summary-totals {
    flex-direction: column;
    gap: 16px;
  }

  .modal-content {
    padding: 32px 24px;
  }
}

/* Loading State */
.form-section.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 15px;
  font-weight: 500;
}

/* Vehicles & Trailers List */
.vehicles-trailers-list {
  margin-bottom: 24px;
}

.vehicle-trailer-item {
  background: white;
  border: 1px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.vehicle-trailer-item:hover {
  box-shadow: 0 2px 8px color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.vehicle-trailer-info {
  flex: 1;
}

.vehicle-trailer-info .type {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 4px;
}

.vehicle-trailer-info .details {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.vehicle-trailer-info .details span {
  margin-right: 12px;
}

.vehicle-trailer-actions {
  display: flex;
  gap: 8px;
}

.vehicle-trailer-remove {
  background: #dc2626;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vehicle-trailer-remove:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* Vehicle Modal */
.vehicle-modal {
  max-width: 600px;
  text-align: left;
}

.vehicle-modal h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-description {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.modal-actions .secondary-button,
.modal-actions .submit-button {
  padding: 12px 24px;
  font-size: 14px;
}

/* Confirmation Modal */
.confirmation-modal {
  max-width: 500px;
  text-align: left;
}

.confirmation-modal h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.confirmation-details {
  background: color-mix(in srgb, var(--text-primary) 3%, white);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.confirmation-item {
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.6;
}

.confirmation-item:last-child {
  margin-bottom: 0;
}

.confirmation-item strong {
  color: var(--text-primary);
  font-weight: 600;
  margin-right: 8px;
}

.confirmation-item.highlight {
  background: white;
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.confirmation-message {
  margin-bottom: 24px;
}

.confirmation-warning {
  background: color-mix(in srgb, var(--error-DEFAULT) 10%, white);
  border-left: 4px solid var(--error-DEFAULT);
  padding: 16px;
  border-radius: 6px;
  margin: 0 0 12px 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.confirmation-warning strong {
  color: var(--error-DEFAULT);
}

.confirmation-note {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Tags Input System */
.tags-input-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  padding: 8px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  background: var(--gray-50);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.tag-remove {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.tag-remove:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tags-input-wrapper {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tags-input-wrapper input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
}

.tags-preset-select {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.tags-preset-select:focus,
.tags-input-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(31, 41, 55, 0.1);
}

/* Section inline actions for edit mode */
.section-inline-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  justify-content: flex-end;
}

.rules-content {
  padding: 16px;
  background: var(--gray-50);
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  min-height: 60px;
}

.rules-content button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.rules-content button:hover {
  opacity: 0.8;
}

/* Rules Gate Section */
.rules-gate {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.rules-gate-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 32px;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 24px;
  line-height: 1.8;
  font-size: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Mobile: Rules gate full width and better readability */
@media (max-width: 640px) {
  .rules-gate {
    max-width: 100%;
  }

  .rules-gate-content {
    padding: 20px 16px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    max-height: 55vh;
  }

  .rules-gate-content h1,
  .rules-gate-content h2,
  .rules-gate-content h3 {
    font-size: 1.15em;
    margin-top: 1.25em;
  }

  .rules-gate-content ul,
  .rules-gate-content ol {
    padding-left: 1.25em;
  }

  .rules-gate-footer .submit-button {
    min-width: unset;
    width: 100%;
    padding: 14px 24px;
  }
}

.rules-gate-content h1,
.rules-gate-content h2,
.rules-gate-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

.rules-gate-content h1:first-child,
.rules-gate-content h2:first-child,
.rules-gate-content h3:first-child {
  margin-top: 0;
}

.rules-gate-content h1 { font-size: 1.5em; }
.rules-gate-content h2 { font-size: 1.25em; }
.rules-gate-content h3 { font-size: 1.1em; }

.rules-gate-content p {
  margin-bottom: 1em;
}

.rules-gate-content ul,
.rules-gate-content ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.rules-gate-content li {
  margin-bottom: 0.5em;
}

.rules-gate-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.rules-gate-footer {
  text-align: center;
}

.rules-gate-footer .submit-button {
  min-width: 300px;
  padding: 16px 32px;
  font-size: 16px;
  transition: all 0.2s ease;
}

.rules-gate-footer .submit-button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.7;
}

.rules-gate-footer .submit-button:disabled:hover {
  background: #cbd5e1;
}

.rules-gate-footer .rules-scroll-hint {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
}

.rules-gate-footer .rules-scroll-hint.hidden {
  opacity: 0;
}

/* Rules Link in consent */
.rules-link {
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
}

.rules-link:hover {
  opacity: 0.8;
}

/* Rules Modal */
.rules-modal {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
}

.rules-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.rules-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.rules-modal-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.rules-modal-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.rules-modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  line-height: 1.8;
  font-size: 15px;
  text-align: left;
}

.rules-modal-content h1,
.rules-modal-content h2,
.rules-modal-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

.rules-modal-content h1:first-child,
.rules-modal-content h2:first-child,
.rules-modal-content h3:first-child {
  margin-top: 0;
}

.rules-modal-content h1 { font-size: 1.5em; }
.rules-modal-content h2 { font-size: 1.25em; }
.rules-modal-content h3 { font-size: 1.1em; }

.rules-modal-content p {
  margin-bottom: 1em;
}

.rules-modal-content ul,
.rules-modal-content ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.rules-modal-content li {
  margin-bottom: 0.5em;
}

.rules-modal-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

@keyframes slideInFromRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.rules-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.rules-drawer-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.rules-drawer-close {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.rules-drawer-close:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.rules-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  padding-bottom: 32px;
  line-height: 1.7;
  font-size: 15px;
}

.rules-drawer-footer {
  flex-shrink: 0;
  padding: 20px 24px;
  border-top: 1px solid #e2e8f0;
  background: white;
  text-align: center;
}

.rules-drawer-footer .submit-button {
  width: 100%;
  padding: 16px 32px;
  font-size: 16px;
  transition: all 0.2s ease;
}

.rules-drawer-footer .submit-button:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.7;
}

.rules-drawer-footer .submit-button:disabled:hover {
  background: #cbd5e1;
}

.rules-scroll-hint {
  margin: 12px 0 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  transition: opacity 0.2s ease;
}

.rules-scroll-hint.hidden {
  opacity: 0;
}

/* Markdown styling inside rules drawer */
.rules-drawer-content h1,
.rules-drawer-content h2,
.rules-drawer-content h3 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

.rules-drawer-content h1:first-child,
.rules-drawer-content h2:first-child,
.rules-drawer-content h3:first-child {
  margin-top: 0;
}

.rules-drawer-content h1 { font-size: 1.5em; }
.rules-drawer-content h2 { font-size: 1.25em; }
.rules-drawer-content h3 { font-size: 1.1em; }

.rules-drawer-content p {
  margin-bottom: 1em;
}

.rules-drawer-content ul,
.rules-drawer-content ol {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

.rules-drawer-content li {
  margin-bottom: 0.5em;
}

.rules-drawer-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

/* Mobile responsive */
@media (max-width: 640px) {
  .rules-drawer {
    max-width: 100%;
  }
}

/* Extra small screen adjustments */
@media (max-width: 480px) {
  .modal-content {
    padding: 24px 16px;
    width: 95%;
    border-radius: 16px;
  }

  .modal-content h2 {
    font-size: 22px;
  }

  .modal-content p {
    font-size: 14px;
  }

  .success-icon {
    width: 64px;
    height: 64px;
    font-size: 36px;
  }

  .reference-number {
    padding: 12px;
  }

  .reference-number strong {
    font-size: 16px;
    word-break: break-all;
  }

  .vehicle-modal {
    max-width: 100%;
    width: 95%;
  }

  .confirmation-modal {
    max-width: 100%;
    width: 95%;
  }

  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions .secondary-button,
  .modal-actions .submit-button {
    width: 100%;
  }

  .rules-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .rules-modal-header {
    padding: 16px;
  }

  .rules-modal-content {
    padding: 16px;
  }

  /* Rules gate handled in 640px breakpoint above */

  /* Ensure touch targets are large enough */
  .checkbox-label {
    min-height: 44px;
  }

  .remove-button,
  .add-button,
  .submit-button,
  .secondary-button,
  .modal-button {
    min-height: 44px;
  }

  .vehicle-trailer-remove {
    min-height: 44px;
    padding: 10px 16px;
  }
}

/* Vehicle Summary Section */
.vehicle-summary-section {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.vehicle-summary-content {
  margin-bottom: 24px;
}

.vehicle-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.vehicle-summary-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vehicle-summary-count {
  font-size: 18px;
  color: var(--text-primary);
}

.vehicle-summary-breakdown {
  font-size: 14px;
  color: var(--text-secondary);
}

.vehicle-summary-edit-btn,
.vehicle-summary-add-btn {
  padding: 10px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vehicle-summary-edit-btn:hover,
.vehicle-summary-add-btn:hover {
  background: color-mix(in srgb, var(--primary) 85%, black);
  transform: translateY(-1px);
}

.vehicle-summary-add-btn {
  margin-top: 20px;
}

/* Vehicle cards grid */
.vehicle-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.vehicle-summary-card {
  background: white;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 12%, transparent);
  overflow: hidden;
  transition: all 0.2s ease;
}

.vehicle-summary-card:hover {
  box-shadow: 0 4px 12px color-mix(in srgb, var(--text-primary) 10%, transparent);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

.vehicle-summary-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--primary) 8%, white);
  border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
}

.vehicle-summary-card-number {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.vehicle-summary-card-category {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex: 1;
}

.vehicle-summary-card-remove {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vehicle-summary-card-remove:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.vehicle-summary-card-body {
  padding: 16px;
}

.vehicle-summary-card-type {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.vehicle-summary-card-detail {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}

.vehicle-summary-card-detail:last-child {
  margin-bottom: 0;
}

.vehicle-summary-card-detail .detail-label {
  font-weight: 600;
  color: var(--text-primary);
}

.vehicle-summary-card-footer {
  padding: 12px 16px;
  background: color-mix(in srgb, var(--text-primary) 4%, white);
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 8%, transparent);
  display: flex;
  justify-content: flex-end;
}

.vehicle-summary-card-length {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.vehicle-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 80%, black) 100%);
  border-radius: 12px;
  color: white;
}

.vehicle-summary-total .total-label {
  font-size: 16px;
  font-weight: 600;
}

.vehicle-summary-total .total-value {
  font-size: 28px;
  font-weight: 800;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

/* Empty state (no vehicles) */
.vehicle-summary-empty {
  text-align: center;
  padding: 40px 24px;
  background: white;
  border-radius: 12px;
  border: 2px dashed color-mix(in srgb, var(--text-primary) 20%, transparent);
}

.vehicle-summary-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.vehicle-summary-message {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.vehicle-summary-sublabel {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

/* Vehicle confirmation checkbox */
.vehicle-summary-confirmation {
  margin-top: 24px;
}

.vehicle-confirm-label {
  background: white;
  padding: 20px 24px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
  transition: all 0.2s ease;
}

.vehicle-confirm-label:hover {
  border-color: var(--primary);
}

.vehicle-confirm-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-right: 12px;
  accent-color: var(--primary);
}

.vehicle-confirm-label span {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
}

.vehicle-confirm-label strong {
  color: var(--primary);
}

/* Zero vehicles confirmation - different styling */
.vehicle-confirm-zero {
  background: color-mix(in srgb, #f59e0b 8%, white);
  border-color: #f59e0b;
}

.vehicle-confirm-zero:hover {
  border-color: #d97706;
}

.vehicle-confirm-zero strong {
  color: #b45309;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .vehicle-summary-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .vehicle-summary-edit-btn {
    width: 100%;
  }

  .vehicle-summary-cards {
    grid-template-columns: 1fr;
  }

  .vehicle-summary-total {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .vehicle-summary-total .total-value {
    font-size: 24px;
  }
}

/* Calculated Total Display */
.calculated-total {
  display: flex;
  align-items: center;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #1f2937);
  min-height: 42px;
}

.calculated-total.zero {
  color: var(--gray-400);
}

/* Vehicle Length Limits Display */
.vehicle-limits-info {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 8%, white) 0%, color-mix(in srgb, var(--primary) 4%, white) 100%);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vehicle-limit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.vehicle-limit-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.vehicle-limit-text {
  font-size: 14px;
  color: var(--text-primary);
}

.vehicle-limit-text strong {
  color: var(--primary);
}

.vehicle-progress-bar {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.vehicle-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.vehicle-progress-fill.warning {
  background: #f59e0b;
}

.vehicle-progress-fill.full {
  background: #ef4444;
}

