/* ==================== AUTOCOMPLETE ==================== */
.ac-wrapper {
  position: relative;
}

.ac-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.2s;
  background: var(--card);
  color: var(--text);
}

.ac-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.1);
}

.ac-input::placeholder {
  color: #9ca3af;
}

.ac-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1100;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  animation: acDropIn 0.15s ease-out;
}

.ac-dropdown.show {
  display: block;
}

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

.ac-item {
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f3f4f6;
}

.ac-item:last-child {
  border-bottom: none;
}

.ac-item:hover,
.ac-item.active {
  background: #f8fafc;
}

.ac-item.active {
  background: #f0f4ff;
}

.ac-item-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: #f0f4ff;
  padding: 3px 8px;
  border-radius: 4px;
  min-width: 36px;
  text-align: center;
}

.ac-item-text {
  flex: 1;
  min-width: 0;
}

.ac-item-city {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-airport {
  font-size: 12px;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-airline-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.ac-item-airline-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--text-light);
}

.ac-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
}

.ac-highlight {
  background: rgba(201,162,39,0.2);
  border-radius: 2px;
  font-weight: 600;
}

/* ==================== MODAL IMPROVED ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 16px;
  backdrop-filter: blur(6px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 10;
  border-radius: 16px 16px 0 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-light);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

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

.modal-body {
  padding: 24px 28px;
}

.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-radius: 0 0 16px 16px;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-grid .form-group {
  margin-bottom: 0;
}

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

.form-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.form-section-title:first-child {
  border-top: none;
  margin-top: 0;
}

/* Read-only total fare */
.total-fare-display {
  background: linear-gradient(135deg, #f8fafc, #f0f4ff);
  border: 1.5px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  letter-spacing: 0.5px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    border-radius: 0;
  }

  .modal-footer {
    border-radius: 0;
  }

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

  .ac-dropdown {
    max-height: 200px;
  }
}

@media (max-width: 480px) {
  .modal-body {
    padding: 16px;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px;
  }
}
