* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  color: #333;
}

header {
  background: #1a1a2e;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.logout-btn {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.2);
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.search-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #1a1a2e;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

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

.form-group label {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: #666;
}

.form-group input,
.form-group select {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #4285F4;
  box-shadow: 0 0 0 2px rgba(66,133,244,0.2);
}

.form-group .help-text {
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.25rem;
}

.search-btn {
  grid-column: 1 / -1;
  padding: 1rem 2rem;
  background: #4285F4;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
}

.search-btn:hover {
  background: #3367d6;
}

.search-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ddd;
  border-top-color: #4285F4;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.summary-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.summary-section h2 {
  margin-top: 0;
  color: #1a1a2e;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.summary-card {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 1rem;
  border-left: 4px solid #4285F4;
}

.summary-card.best {
  border-left-color: #34a853;
  background: #e8f5e9;
}

.summary-card.cheapest {
  border-left-color: #fbbc04;
  background: #fff8e1;
}

.summary-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  color: #666;
  text-transform: uppercase;
}

.summary-card .flight-info {
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-card .price {
  color: #34a853;
  font-size: 1.25rem;
}

.results-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.results-section h2 {
  margin-top: 0;
  color: #1a1a2e;
}

.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.filter-bar select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.flights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.flights-table th {
  background: #f8f9fa;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #666;
  border-bottom: 2px solid #ddd;
  white-space: nowrap;
}

.flights-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.flights-table tr:hover {
  background: #f8f9fa;
}

.flights-table tr.meets-deadline {
  background: #e8f5e9;
}

.flights-table tr.misses-deadline {
  background: #ffebee;
}

.flights-table tr.recommended {
  background: #e3f2fd;
  font-weight: 500;
}

.score-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
}

.score-badge.excellent {
  background: #34a853;
  color: white;
}

.score-badge.good {
  background: #4285F4;
  color: white;
}

.score-badge.acceptable {
  background: #fbbc04;
  color: #333;
}

.score-badge.warning {
  background: #ea4335;
  color: white;
}

.airline-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #f0f0f0;
  border-radius: 4px;
  font-weight: 500;
}

.airline-badge.united {
  background: #002244;
  color: white;
}

.time-info {
  display: flex;
  flex-direction: column;
}

.time-info .time {
  font-weight: 600;
}

.time-info .date {
  font-size: 0.75rem;
  color: #888;
}

.drive-time {
  display: flex;
  flex-direction: column;
}

.drive-time .airport {
  font-weight: 600;
}

.drive-time .duration {
  font-size: 0.75rem;
  color: #888;
}

.price-cell {
  font-weight: 600;
  color: #34a853;
}

.stops-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.stops-badge.nonstop {
  background: #e8f5e9;
  color: #2e7d32;
}

.stops-badge.onestop {
  background: #fff3e0;
  color: #e65100;
}

.stops-badge.multistop {
  background: #ffebee;
  color: #c62828;
}

.recommendation-text {
  font-size: 0.75rem;
  max-width: 150px;
}

.recommendation-text.excellent {
  color: #2e7d32;
}

.recommendation-text.good {
  color: #1565c0;
}

.recommendation-text.warning {
  color: #c62828;
}

.no-results {
  text-align: center;
  padding: 3rem;
  color: #888;
}

.errors-section {
  background: #fff3e0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.errors-section h4 {
  margin: 0 0 0.5rem 0;
  color: #e65100;
}

.errors-section ul {
  margin: 0;
  padding-left: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1rem;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.625rem;
}

.tab-btn.active {
  color: #4285F4;
  border-bottom-color: #4285F4;
  font-weight: 600;
}

.tab-btn:hover {
  color: #4285F4;
}

@media (max-width: 768px) {
  main {
    padding: 1rem;
  }

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

  .flights-table {
    display: block;
    overflow-x: auto;
  }
}
