@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary:   #2563eb;
  --primary-d: #1d4ed8;
  --green:     #16a34a;
  --amber:     #d97706;
  --red:       #dc2626;
  --navy:      #0f172a;
  --surface:   #f8fafc;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Navbar ---- */
.navbar {
  background: var(--navy);
  padding: 0 1.5rem;
  border-bottom: 3px solid var(--primary);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}
.nav-icon { font-size: 1.3rem; }
.nav-links { display: flex; gap: 1rem; }
.nav-link {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-logout { border-left: 1px solid rgba(255,255,255,0.15); margin-left: 0.5rem; padding-left: 1.2rem; }

/* ---- Login page ---- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  padding: 1.5rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}
.login-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.login-header h1 { font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: 0.3rem; }
.login-header p { color: var(--muted); font-size: 0.875rem; }
.login-error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.login-field {
  margin-bottom: 1.25rem;
}
.login-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.login-field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.btn-login {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
  margin-top: 0.5rem;
}
.btn-login:hover { background: var(--primary-d); }

/* ---- Main / Footer ---- */
.main-content { flex: 1; }
footer {
  background: var(--navy);
  color: rgba(255,255,255,0.4);
  text-align: center;
  font-size: 0.78rem;
  padding: 1rem;
  margin-top: auto;
}

/* ---- Hero / Search ---- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  padding: 3rem 1.5rem;
  color: #fff;
}
.hero-inner { max-width: 900px; margin: 0 auto; }
.hero-text { margin-bottom: 2rem; }
.hero-text h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 0.4rem;
}
.hero-text p { color: rgba(255,255,255,0.65); font-size: 1rem; }

.alert-banner {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.9);
}
.alert-banner code { background: rgba(255,255,255,0.15); padding: 0.1em 0.4em; border-radius: 4px; }
.alert-error { background: rgba(220,38,38,0.2); border-color: rgba(220,38,38,0.4); }

.search-form {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 1.75rem;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.8); }
.form-group input, .form-group select {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input::placeholder { color: rgba(255,255,255,0.35); }
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.form-group select option { background: var(--navy); color: #fff; }
.form-hint { font-size: 0.72rem; color: rgba(255,255,255,0.4); }
.optional { font-weight: 400; opacity: 0.6; }

.btn-search {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-search:hover { background: var(--primary-d); transform: translateY(-1px); }

/* ---- Preferences summary ---- */
.prefs-summary {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.prefs-summary h3 { font-size: 0.9rem; color: var(--muted); font-weight: 600; margin-bottom: 0.75rem; }
.pref-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Chips ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.chip-green  { background: #dcfce7; color: #15803d; }
.chip-red    { background: #fee2e2; color: #b91c1c; }
.chip-amber  { background: #fef3c7; color: #92400e; }
.chip-sm     { font-size: 0.72rem; padding: 0.2rem 0.55rem; }

/* ---- Results header ---- */
.results-header {
  background: var(--navy);
  padding: 1.25rem 1.5rem;
  border-bottom: 3px solid var(--primary);
}
.results-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.results-title h2 { color: #fff; font-size: 1.4rem; font-weight: 700; }
.results-meta { color: rgba(255,255,255,0.55); font-size: 0.85rem; }
.btn-back {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  transition: background 0.15s;
}
.btn-back:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ---- Results body ---- */
.results-body { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---- Source status bar ---- */
.sources-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.source-ok   { background: #dcfce7; color: #15803d; }
.source-none { background: #f1f5f9; color: #94a3b8; }
.source-count {
  background: rgba(0,0,0,0.1);
  border-radius: 999px;
  padding: 0 5px;
  font-size: 0.7rem;
}

.notes-bar {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: #92400e;
}

.results-section { margin-bottom: 2.5rem; }
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.results-list { display: flex; flex-direction: column; gap: 0.85rem; }

/* ---- Result card ---- */
.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 1fr 1.2fr auto;
  gap: 1.5rem;
  align-items: center;
  border-left: 4px solid var(--border);
  transition: box-shadow 0.15s;
}
.result-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.card-great { border-left-color: var(--green); }
.card-ok    { border-left-color: var(--amber); }
.card-poor  { border-left-color: var(--red); }

.transport-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}
.transport-flight { background: #dbeafe; color: #1d4ed8; }
.transport-train  { background: #dcfce7; color: #15803d; }
.transport-ferry  { background: #e0f2fe; color: #0369a1; }
.transport-bus    { background: #fef3c7; color: #92400e; }

.card-route {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.3rem;
}
.card-arrow { color: var(--muted); font-weight: 400; }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.78rem; color: var(--muted); align-items: center; }
.badge-direct { background: #dcfce7; color: #15803d; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }
.badge-stops  { background: #fef3c7; color: #92400e; padding: 0.1rem 0.5rem; border-radius: 4px; font-size: 0.72rem; font-weight: 600; }

.card-times { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.time-dep, .time-arr { font-size: 1.1rem; font-weight: 700; }
.time-dur { font-size: 0.78rem; color: var(--muted); background: var(--surface); padding: 0.2rem 0.6rem; border-radius: 6px; }

.pref-score { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.score-bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; background: linear-gradient(90deg, #3b82f6, #10b981); border-radius: 3px; }
.score-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pref-highlights, .pref-issues { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.card-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.card-price { font-size: 1.5rem; font-weight: 800; color: var(--navy); }
.card-source { font-size: 0.72rem; color: var(--muted); }
.btn-book {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s;
}
.btn-book:hover { background: var(--primary-d); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}
.empty-icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }

/* ---- Deep links ---- */
.deeplinks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.85rem; }
.deeplink-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.deeplink-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.dl-icon { font-size: 1.3rem; }
.dl-arrow { margin-left: auto; color: var(--muted); font-size: 0.8rem; }

/* ---- Preferences page ---- */
.page-header { max-width: 800px; margin: 2rem auto 0; padding: 0 1.5rem; }
.page-header h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem; }
.page-header p { color: var(--muted); }
.prefs-page { max-width: 800px; margin: 1.5rem auto; padding: 0 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.pref-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}
.pref-excluded { border-left: 4px solid var(--red); }
.pref-icon { font-size: 2rem; line-height: 1; }
.pref-body h4 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; }
.pref-body p { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.75rem; line-height: 1.5; }

@media (max-width: 700px) {
  .result-card { grid-template-columns: 1fr; }
  .card-right { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
