/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-primary: #2ecc71;
  --green-dark:    #27ae60;
  --green-light:   #d5f5e3;
  --text-dark:     #1a1a2e;
  --text-mid:      #555;
  --text-light:    #888;
  --bg:            #f7faf8;
  --white:         #ffffff;
  --border:        #dde8e2;
  --error:         #e74c3c;
  --radius:        12px;
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
}

a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--green-primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
}
.btn-primary:hover { background: var(--green-dark); text-decoration: none; }

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 28px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--green-light); }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-mid);
}
.btn-logout:hover { background: var(--green-light); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.error-msg {
  background: #fdecea;
  color: var(--error);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  margin-bottom: 12px;
}

/* ── Auth Pages ───────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #d5f5e3 100%);
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.brand { text-align: center; margin-bottom: 32px; }
.brand h1 { font-size: 2rem; color: var(--green-dark); letter-spacing: -0.5px; }
.brand p  { color: var(--text-light); margin-top: 4px; font-size: 0.9rem; }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-mid);
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
}
.auth-form input:focus { border-color: var(--green-primary); }

.auth-form .btn-primary { margin-top: 8px; width: 100%; padding: 14px; }

.auth-switch { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--text-light); }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green-dark);
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0 8px;
  margin-bottom: 8px;
}

.sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }

.trip-item {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trip-item:hover { background: var(--green-light); }
.trip-item span  { font-weight: 600; font-size: 0.9rem; }
.trip-item small { color: var(--text-light); font-size: 0.75rem; }

.trip-item-placeholder { color: var(--text-light); font-size: 0.875rem; padding: 10px 12px; }

.btn-delete-trip {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding: 6px;
  background: none;
  border: 1px solid #e74c3c;
  color: #e74c3c;
  border-radius: 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-delete-trip:hover { background: #e74c3c; color: white; }
.trip-item:hover .btn-delete-trip { display: block; }

.dashboard-main { flex: 1; display: flex; flex-direction: column; }

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.dashboard-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 48px;
  background: linear-gradient(160deg, #ffffff 40%, #d5f5e3 100%);
}

.dashboard-hero h2 { font-size: 2.2rem; color: var(--text-dark); }
.dashboard-hero p  { color: var(--text-mid); font-size: 1.05rem; }
.dashboard-hero .btn-primary { padding: 16px 36px; font-size: 1.1rem; margin-top: 8px; }

/* ── Questionnaire ────────────────────────────────────────────────────────── */
.questionnaire-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #d5f5e3 100%);
  padding: 24px;
}

.questionnaire-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 520px;
}

.q-progress { margin-bottom: 32px; }
.q-progress span { font-size: 0.8rem; color: var(--text-light); display: block; margin-bottom: 8px; }

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green-primary);
  border-radius: 99px;
  transition: width 0.3s ease;
  width: 0%;
}

.q-step { display: none; flex-direction: column; gap: 20px; }
.q-step.active { display: flex; }

.q-step h2 { font-size: 1.4rem; color: var(--text-dark); }

.q-step input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
}
.q-step input:focus { border-color: var(--green-primary); }

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-btn {
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-dark);
  transition: all 0.15s;
}
.option-btn:hover   { border-color: var(--green-primary); color: var(--green-dark); }
.option-btn.selected {
  background: var(--green-primary);
  border-color: var(--green-primary);
  color: var(--white);
}
.q-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -8px 0 12px;
}
#travel-style-other {
  margin-top: 12px;
  width: 100%;
}

.q-nav {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

/* ── Trip Detail Page ─────────────────────────────────────────────────────── */
.trip-detail-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* top bar */
.trip-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trip-topbar-info h1 {
  font-size: 1.3rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.back-link {
  font-size: 0.85rem;
  color: var(--text-light);
  white-space: nowrap;
}
.back-link:hover { color: var(--green-dark); }

.badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  margin: 2px 2px 2px 0;
}

/* middle section — map left, plan right */
.trip-middle {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.trip-map-panel {
  flex: 0 0 60%;
  position: relative;
  border-right: 1px solid var(--border);
}
#map { width: 100%; height: 100%; }

/* right panel — itinerary detail */
.trip-plan-panel {
  flex: 0 0 40%;
  background: var(--white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.plan-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#stop-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.day-group { margin-bottom: 20px; }
.day-group h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 8px;
}

.stop-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.stop-card:hover { background: var(--green-light); border-color: var(--green-primary); }

.stop-number {
  width: 28px;
  height: 28px;
  background: var(--green-primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.stop-info strong { font-size: 0.875rem; display: block; margin-bottom: 2px; }
.stop-info p { font-size: 0.8rem; color: var(--text-mid); margin: 0 0 4px; }
.stop-info small { color: var(--green-dark); font-size: 0.75rem; font-weight: 600; }

.loading-text { color: var(--text-light); font-size: 0.9rem; padding: 12px; }

/* bottom chat box */
.trip-chatbox {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 12px 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 280px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}

.chat-intro { color: var(--text-light); font-size: 0.85rem; }

.chat-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  max-width: 70%;
}
.chat-msg.user {
  background: var(--green-primary);
  color: var(--white);
  align-self: flex-end;
}
.chat-msg.ai {
  background: var(--bg);
  color: var(--text-dark);
  align-self: flex-start;
  border: 1px solid var(--border);
}

.chat-msg { position: relative; }

.chat-delete {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  border: none;
  font-size: 0.6rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.chat-msg:hover .chat-delete { display: flex; }

.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
}
.chat-input-row input:focus { border-color: var(--green-primary); }
.chat-input-row .btn-primary { padding: 10px 20px; font-size: 0.9rem; }

/* numbered markers on the map */
.numbered-marker { background: none; border: none; }
.marker-inner {
  width: 32px;
  height: 32px;
  background: var(--green-primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* dashboard generate button and spinner */
.btn-generate {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: var(--green-primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-generate:hover { background: var(--green-dark); }

.btn-view {
  display: block;
  margin-top: 8px;
  padding: 8px;
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s;
}
.btn-view:hover { background: var(--green-primary); color: var(--white); text-decoration: none; }

.spinner {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  padding: 6px;
}
