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

/* ── RESET ──────────────────────────────────────────────── */
.aap-widget, .aap-widget *, .aap-widget *::before, .aap-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
.aap-widget [hidden] { display: none !important; }

/* ── SCROLLBARS ─────────────────────────────────────────── */
.aap-widget *::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.aap-widget *::-webkit-scrollbar-track {
  background: transparent;
}
.aap-widget *::-webkit-scrollbar-thumb {
  background: var(--c-border2);
  border-radius: 6px;
}
.aap-widget *::-webkit-scrollbar-thumb:hover {
  background: var(--c-muted);
}

/* ── ROOT TOKENS ─────────────────────────────────────────── */
.aap-widget {
  --c-bg:       #0c0f14;
  --c-surface:  #141820;
  --c-card:     #1b2030;
  --c-border:   rgba(255,255,255,0.07);
  --c-border2:  rgba(255,255,255,0.12);
  --c-text:     #e8eaf0;
  --c-muted:    #6b7385;
  --c-accent:   #0085FF;
  --c-accent2:  #00d4ff;
  --c-orange:   #ff6b35;
  --c-green:    #00e5a0;
  --f-display:  'Inter', sans-serif;
  --f-body:     'Inter', sans-serif;
  --r-card:     16px;
  --r-sm:       10px;

  max-width: 660px;
  margin: 0 auto;
  background: var(--c-bg);
  border: 1px solid var(--c-border2);
  border-radius: 24px;
  padding: 32px;
  font-family: var(--f-body);
  color: var(--c-text);
  position: relative;
  overflow: hidden;
}

/* Ambient glow blob behind */
.aap-widget::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,133,255,0.08) 0%, transparent 70%);
  top: -100px; right: -100px;
  pointer-events: none;
  border-radius: 50%;
}

/* ── LIGHT MODE OVERRIDES ────────────────────────────────── */
.aap-widget.aap-light-mode {
  --c-bg:       #ffffff;
  --c-surface:  #f8f9fa;
  --c-card:     #ffffff;
  --c-border:   rgba(0,0,0,0.08);
  --c-border2:  rgba(0,0,0,0.12);
  --c-text:     #1a1d20;
  --c-muted:    #6b7280;
}
.aap-widget.aap-light-mode .aap-heading,
.aap-widget.aap-light-mode .aap-vibe-name,
.aap-widget.aap-light-mode .aap-trip-title,
.aap-widget.aap-light-mode .aap-stay-name,
.aap-widget.aap-light-mode .aap-day-theme {
  color: #111827;
}
.aap-widget.aap-light-mode .aap-itin-hero {
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
  border: 1px solid var(--c-border2);
}
.aap-widget.aap-light-mode .aap-map-overlay {
  background: linear-gradient(to top, rgba(255,255,255,0.95) 0%, transparent 100%);
}
.aap-widget.aap-light-mode .aap-map-wrap iframe {
  filter: saturate(1) brightness(1);
}
.aap-widget.aap-light-mode .aap-msg-assistant {
  background: #f3f4f6;
  border-color: #e5e7eb;
}

/* ── THEME TOGGLE ────────────────────────────────────────── */
.aap-theme-toggle {
  position: absolute;
  top: 24px;
  right: 24px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 10;
}
.aap-theme-toggle:hover {
  background: var(--c-surface);
  transform: scale(1.05);
}

/* ── INTRO SCREEN ────────────────────────────────────────── */
.aap-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent);
  font-weight: 600;
  margin-bottom: 10px;
  font-family: var(--f-body);
}

.aap-heading {
  font-family: var(--f-display);
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.aap-sub {
  font-size: 15px;
  color: var(--c-muted);
  line-height: 1.6;
  margin-bottom: 28px;
  font-weight: 300;
}

/* ── VIBE GRID ───────────────────────────────────────────── */
.aap-vibe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.aap-vibe-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--r-card);
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  transition: border-color .2s, background .2s, transform .2s;
  font-family: var(--f-body);
  position: relative;
  overflow: hidden;
}
.aap-vibe-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,133,255,0.06), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.aap-vibe-btn:hover { border-color: var(--c-border2); transform: translateY(-2px); }
.aap-vibe-btn:hover::after { opacity: 1; }
.aap-vibe-btn.is-selected {
  border-color: var(--c-accent);
  background: rgba(0,133,255,0.08);
}
.aap-vibe-emoji { font-size: 22px; margin-bottom: 6px; }
.aap-vibe-name { font-family: var(--f-display); font-weight: 700; font-size: 14px; color: #fff; }
.aap-vibe-tag { font-size: 12px; color: var(--c-muted); }

/* ── UPLOAD ──────────────────────────────────────────────── */
.aap-upload { margin-bottom: 6px; }
.aap-upload-label {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  border: 1px dashed var(--c-border2);
  border-radius: var(--r-card);
  padding: 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  color: var(--c-muted);
  transition: border-color .2s, color .2s;
}
.aap-upload-label:hover { border-color: var(--c-accent); color: var(--c-accent); }
.aap-preview { position: relative; display: inline-block; margin-top: 12px; }
.aap-preview img { max-height: 90px; border-radius: 10px; display: block; border: 1px solid var(--c-border2); }
.aap-preview button {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--c-orange); color: #fff;
  cursor: pointer; font-size: 10px; line-height: 1;
}

/* ── THREAD ──────────────────────────────────────────────── */
.aap-thread { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }

.aap-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  animation: aap-fade-up .3s ease both;
}
.aap-msg-user {
  align-self: flex-end;
  background: var(--c-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.aap-msg-assistant {
  align-self: flex-start;
  background: var(--c-card);
  color: var(--c-text);
  border: 1px solid var(--c-border);
  border-bottom-left-radius: 4px;
  font-style: italic;
  font-weight: 300;
}
.aap-msg-error {
  align-self: flex-start;
  background: rgba(255,107,53,0.12);
  border: 1px solid rgba(255,107,53,0.3);
  color: #ff9a7a;
}

/* ── COMPOSER ────────────────────────────────────────────── */
.aap-composer {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  align-items: flex-end;
}
.aap-composer textarea {
  flex: 1;
  resize: none;
  background: var(--c-card);
  border: 1px solid var(--c-border2);
  border-radius: 14px;
  padding: 12px 16px;
  font-family: var(--f-body);
  font-size: 14px;
  max-height: 120px;
  color: var(--c-text);
  transition: border-color .2s;
  outline: none;
}
.aap-composer textarea::placeholder { color: var(--c-muted); }
.aap-composer textarea:focus { border-color: var(--c-accent); }
.aap-composer button {
  background: var(--c-accent);
  color: #fff;
  border: none;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  cursor: pointer;
  font-size: 18px;
  flex-shrink: 0;
  transition: transform .15s, background .15s;
}
.aap-composer button:hover:not(:disabled) { transform: scale(1.06); background: var(--c-accent2); }
.aap-composer button:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── RESET BTN ───────────────────────────────────────────── */
.aap-reset {
  margin-top: 14px;
  background: none;
  border: 1px solid var(--c-border2);
  border-radius: 8px;
  color: var(--c-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 14px;
  transition: border-color .2s, color .2s;
  font-family: var(--f-body);
}
.aap-reset:hover { border-color: var(--c-accent); color: var(--c-accent); }

/* ── LOADER ──────────────────────────────────────────────── */
.aap-loader {
  position: absolute;
  inset: 0;
  background: rgba(12,15,20,0.85);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 24px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.01em;
}
.aap-spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid var(--c-border2);
  border-top-color: var(--c-accent);
  animation: aap-spin .9s linear infinite;
}

/* ── ITINERARY WRAPPER ───────────────────────────────────── */
.aap-itinerary {
  margin-top: 24px;
  animation: aap-fade-up .4s ease both;
}

/* ── ITINERARY HEADER ────────────────────────────────────── */
.aap-itin-hero {
  position: relative;
  background: linear-gradient(135deg, #0d1b2a 0%, #0a1628 100%);
  border: 1px solid var(--c-border2);
  border-radius: 20px;
  padding: 28px 28px 24px;
  margin-bottom: 16px;
  overflow: hidden;
}
.aap-itin-hero::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0,133,255,0.12) 0%, transparent 70%);
  top: -80px; right: -80px;
  border-radius: 50%;
  pointer-events: none;
}
.aap-itin-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.aap-trip-title {
  font-family: var(--f-display);
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 6px;
}
.aap-vibe-match {
  font-size: 14px;
  color: var(--c-muted);
  font-weight: 300;
  margin-bottom: 16px;
}
.aap-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.aap-tag {
  font-size: 11px;
  background: rgba(0,133,255,0.1);
  border: 1px solid rgba(0,133,255,0.2);
  color: var(--c-accent2);
  padding: 4px 12px;
  border-radius: 99px;
  font-weight: 500;
  font-family: var(--f-body);
}
.aap-itin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.aap-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-accent);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s, background .15s;
  font-family: var(--f-body);
}
.aap-download-btn:hover { transform: scale(1.03); background: var(--c-accent2); }

/* ── MAP ─────────────────────────────────────────────────── */
.aap-section-label {
  font-family: var(--f-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 24px 0 12px;
}
.aap-map-wrap {
  background: var(--c-card);
  border: 1px solid var(--c-border2);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}
.aap-map-wrap iframe {
  width: 100%;
  height: 240px;
  display: block;
  border: none;
  filter: saturate(0.7) brightness(0.85);
}
.aap-map-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(20,24,32,0.9) 0%, transparent 100%);
  height: 70px;
  pointer-events: none;
}
.aap-route-pills {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  font-size: 13px;
}
.aap-route-pill {
  background: rgba(0,133,255,0.1);
  border: 1px solid rgba(0,133,255,0.2);
  color: var(--c-text);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 500;
}
.aap-route-arrow { color: var(--c-muted); font-size: 16px; }
.aap-route-meta {
  margin-left: auto;
  display: flex; gap: 6px;
}
.aap-route-meta span {
  font-size: 11px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  border-radius: 6px;
  padding: 4px 9px;
}

/* ── STAYS ───────────────────────────────────────────────── */
.aap-stays-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.aap-stay {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 14px;
}
.aap-stay-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  margin-bottom: 4px;
}
.aap-stay-style { font-size: 12px; color: var(--c-muted); line-height: 1.4; margin-bottom: 8px; }
.aap-stay-nights {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0,229,160,0.1);
  color: var(--c-green);
  border: 1px solid rgba(0,229,160,0.2);
  border-radius: 6px;
  padding: 3px 9px;
}

/* ── DAY CARDS ───────────────────────────────────────────── */
.aap-days { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }

.aap-day {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color .2s;
}
.aap-day:hover { border-color: var(--c-border2); }

.aap-day-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 0;
}
.aap-day-marker {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-accent), var(--c-accent2));
  color: #fff;
  font-family: var(--f-display);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aap-day-header-text { flex: 1; }
.aap-day-theme {
  font-family: var(--f-display);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.aap-day-route {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 3px;
}

/* Day gallery */
.aap-day-gallery {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.aap-day-gallery::-webkit-scrollbar { display: none; }
.aap-gallery-img {
  height: 100px;
  width: 160px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: cover;
  display: block;
}
.aap-gallery-food {
  width: 100px;
}

/* Day lines */
.aap-day-lines { padding: 0 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.aap-day-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--c-text);
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid var(--c-border);
}
.aap-day-line-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

/* Swap button */
.aap-swap-btn {
  margin: 0 20px 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--c-border2);
  color: var(--c-muted);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .2s, color .2s;
  font-family: var(--f-body);
}
.aap-swap-btn:hover { border-color: var(--c-orange); color: var(--c-orange); }

/* ── KEYFRAMES ───────────────────────────────────────────── */
@keyframes aap-spin { to { transform: rotate(360deg); } }
@keyframes aap-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SNAPSHOT (IMAGE DOWNLOAD) ────────────────────────────── */
.aap-snapshot {
  width: 760px !important;
  max-width: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 40px !important;
  border-radius: 0 !important;
  overflow: visible !important;
  margin: 0 !important;
}
.aap-snapshot::before { display: none !important; }
.aap-snapshot .aap-composer,
.aap-snapshot .aap-reset,
.aap-snapshot .aap-intro,
.aap-snapshot .aap-theme-toggle,
.aap-snapshot .aap-download-btn,
.aap-snapshot .aap-swap-btn {
  display: none !important;
}

/* ── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .aap-widget { padding: 20px; border-radius: 16px; }
  .aap-heading { font-size: 26px; }
  .aap-vibe-grid { grid-template-columns: 1fr; }
  .aap-trip-title { font-size: 22px; }
  .aap-stays-grid { grid-template-columns: 1fr; }
  .aap-msg { max-width: 95%; }
}

/* ── EMAIL CAPTURE MODAL ─────────────────────────────── */
.aap-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aap-modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 40px;
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  text-align: center;
}
.aap-modal h3 {
  margin: 0 0 10px 0;
  font-size: 1.5rem;
  color: var(--c-text);
  font-family: var(--f-display);
  font-weight: 700;
}
.aap-modal p {
  color: var(--c-subtext);
  font-size: 0.95rem;
  margin: 0 0 24px 0;
  line-height: 1.5;
  font-family: var(--f-body);
}
.aap-modal form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.aap-modal-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-body);
  font-size: 1rem;
  box-sizing: border-box;
}
.aap-modal-input:focus {
  outline: none;
  border-color: var(--c-accent);
}
.aap-modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.aap-modal-btn {
  flex: 1;
  padding: 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--f-body);
  transition: all 0.2s ease;
}
.aap-btn-secondary {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.aap-btn-secondary:hover {
  background: var(--c-border2);
}
.aap-btn-primary {
  background: var(--c-accent);
  color: #fff;
}
.aap-btn-primary:hover {
  background: var(--c-accent2);
}

/* Light mode overrides for modal overlay */
.aap-modal-overlay.aap-light-mode {
  background: rgba(255, 255, 255, 0.7);
}