:root {
  --bg: #f0f4f9;
  --surface: rgba(255,255,255,0.72);
  --surface-solid: #ffffff;
  --border: rgba(180,200,230,0.45);
  --border-strong: rgba(140,170,210,0.6);
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --blue-dim: rgba(37,99,235,0.08);
  --ink: #111827;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --danger: #dc2626;
  --danger-dim: rgba(220,38,38,0.07);
  --success: #059669;
  --gold: #d97706;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(30,60,120,0.09);
  --shadow-lg: 0 12px 48px rgba(30,60,120,0.14);
  --shadow-xl: 0 24px 80px rgba(30,60,120,0.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(147,197,253,0.22) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 85% 85%, rgba(196,181,253,0.14) 0%, transparent 55%);
  background-attachment: fixed;
}

/* ── LOADING ── */
#loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s;
}

.loader-inner { text-align: center; }

.loader-ring {
  width: 48px; height: 48px; margin: 0 auto 20px;
  border: 3px solid rgba(37,99,235,0.15);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.loader-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 300;
  color: var(--ink); letter-spacing: 0.08em;
}

/* ── LOGIN ── */
#login-screen {
  min-height: 100vh; display: none;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 50%, #fce7f3 100%);
}

.login-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 24px;
  padding: 56px 48px;
  width: 420px; max-width: 92vw;
  box-shadow: var(--shadow-xl);
}

.login-eyebrow {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 16px;
}

.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.2rem; font-weight: 300;
  line-height: 1.05; color: var(--ink);
  margin-bottom: 8px;
}

.login-title em { font-style: italic; color: var(--blue); }

.login-sub {
  font-size: 0.85rem; color: var(--muted);
  margin-bottom: 36px;
}

.field-group { margin-bottom: 18px; }

.field-label {
  display: block; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 7px;
}

.field-input {
  width: 100%; padding: 13px 16px;
  background: rgba(240,244,249,0.8);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem; color: var(--ink);
  transition: all 0.2s;
  -webkit-appearance: none;
}

.field-input::placeholder { color: var(--muted-light); }

.field-input:focus {
  outline: none;
  border-color: var(--blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

.field-textarea {
  resize: vertical; min-height: 90px;
  line-height: 1.6;
}

.field-select {
  padding: 13px 16px;
  background: rgba(240,244,249,0.8);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem; color: var(--ink);
  cursor: pointer; transition: all 0.2s;
}

.field-select:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

.btn-login {
  width: 100%; margin-top: 8px;
  padding: 15px 24px;
  background: var(--blue);
  color: white; border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: flex; align-items: center;
  justify-content: center; gap: 8px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  letter-spacing: 0.03em;
}

.btn-login:hover {
  background: var(--blue-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(37,99,235,0.4);
}

.login-error {
  color: var(--danger); font-size: 0.8rem;
  margin-top: 12px; text-align: center; display: none;
}

/* ── HEADER ── */
#main-header {
  position: sticky; top: 0; z-index: 200;
  height: 62px; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(240,244,249,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 16px; }

.brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-weight: 400;
  color: var(--ink); letter-spacing: 0.02em;
}

.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem; font-weight: 500;
  color: var(--ink); cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}

.back-btn:hover { background: white; border-color: var(--border-strong); }

.header-right { display: flex; align-items: center; gap: 12px; }

.sync-badge {
  font-size: 0.7rem; font-weight: 500;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(5,150,105,0.1);
  border: 1px solid rgba(5,150,105,0.2);
  color: var(--success); letter-spacing: 0.05em;
  transition: all 0.3s;
}

.sync-badge.syncing {
  background: var(--blue-dim);
  border-color: rgba(37,99,235,0.2);
  color: var(--blue);
}

.sync-badge.err {
  background: var(--danger-dim);
  border-color: rgba(220,38,38,0.2);
  color: var(--danger);
}

.btn-ghost-sm {
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem; font-weight: 500;
  color: var(--muted); cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost-sm:hover { background: white; color: var(--ink); }

/* ── DASHBOARD ── */
#dashboard { padding: 48px 32px; max-width: 1240px; margin: 0 auto; }

.dash-hero {
  display: flex; align-items: flex-end;
  justify-content: space-between; margin-bottom: 40px;
}

.dash-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.8rem; font-weight: 300; color: var(--ink);
  line-height: 1.1;
}

.dash-sub { font-size: 0.88rem; color: var(--muted); margin-top: 6px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  background: var(--blue); color: white; border: none;
  border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
}

.btn-primary:hover {
  background: var(--blue-light);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(37,99,235,0.38);
}

.journeys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ── JOURNEY CARD ── */
.journey-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: all 0.25s;
  box-shadow: var(--shadow);
  position: relative;
}

.journey-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: rgba(255,255,255,0.88);
}

.card-accent { height: 5px; }
.acc-0 { background: linear-gradient(90deg,#2563eb,#60a5fa); }
.acc-1 { background: linear-gradient(90deg,#7c3aed,#a78bfa); }
.acc-2 { background: linear-gradient(90deg,#059669,#34d399); }
.acc-3 { background: linear-gradient(90deg,#d97706,#fbbf24); }
.acc-4 { background: linear-gradient(90deg,#db2777,#f472b6); }

.card-body { padding: 24px 26px 20px; }

.card-emoji { font-size: 2.4rem; margin-bottom: 14px; display: block; line-height: 1; }

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem; font-weight: 400;
  color: var(--ink); margin-bottom: 5px; line-height: 1.2;
}

.card-dates {
  font-size: 0.72rem; font-weight: 600;
  color: var(--muted); letter-spacing: 0.1em;
  text-transform: uppercase; margin-bottom: 12px;
}

.card-desc {
  font-size: 0.85rem; color: var(--muted);
  line-height: 1.65; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  padding: 13px 26px;
  background: rgba(240,244,249,0.5);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
}

.card-stats {
  font-size: 0.73rem; font-weight: 500;
  color: var(--muted-light); letter-spacing: 0.04em;
}

.card-del {
  background: none; border: none;
  color: var(--muted-light); font-size: 0.73rem;
  cursor: pointer; padding: 4px 8px;
  border-radius: 6px; font-family: 'Outfit', sans-serif;
  font-weight: 500; transition: all 0.2s;
}

.card-del:hover { color: var(--danger); background: var(--danger-dim); }

.empty-state {
  grid-column: 1/-1; text-align: center;
  padding: 100px 40px;
}

.empty-icon { font-size: 4rem; margin-bottom: 20px; opacity: 0.5; }

.empty-state h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 300;
  color: var(--ink); margin-bottom: 8px;
}

.empty-state p { font-size: 0.85rem; color: var(--muted); }

/* ── DETAIL HERO ── */
.detail-hero {
  background: linear-gradient(160deg, rgba(219,234,254,0.7) 0%, rgba(224,231,255,0.6) 100%);
  border-bottom: 1px solid var(--border);
  padding: 48px 32px 40px;
}

.detail-hero-inner { max-width: 820px; margin: 0 auto; }

.detail-emoji { font-size: 3rem; margin-bottom: 16px; line-height: 1; }

.detail-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.6rem; font-weight: 300;
  color: var(--ink); margin-bottom: 8px; line-height: 1.1;
}

.detail-meta { font-size: 0.85rem; color: var(--muted); }

/* ── TABS ── */
.tabs-bar {
  background: rgba(240,244,249,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex; gap: 4px;
  position: sticky; top: 62px; z-index: 100;
}

.tab-pill {
  background: none; border: none;
  border-bottom: 2px solid transparent;
  padding: 16px 20px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; color: var(--muted);
  transition: all 0.2s; margin-bottom: -1px;
}

.tab-pill:hover { color: var(--blue); }
.tab-pill.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── DETAIL BODY ── */
.detail-body { max-width: 820px; margin: 0 auto; padding: 40px 32px 80px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.pane-header { margin-bottom: 24px; }

.pane-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 300; color: var(--ink);
}

/* ── ADD ROW ── */
.add-row {
  display: flex; gap: 10px; margin-bottom: 28px;
}

.btn-add-item {
  padding: 13px 20px;
  background: var(--blue); color: white;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(37,99,235,0.28);
}

.btn-add-item:hover { background: var(--blue-light); transform: translateY(-1px); }

/* ── TODO ── */
.todo-list { list-style: none; }

.todo-item {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 18px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(30,60,120,0.06);
  transition: all 0.2s;
}

.todo-item:hover { border-color: var(--border-strong); }
.todo-item.done { opacity: 0.5; }

.todo-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--blue);
  cursor: pointer; flex-shrink: 0;
  border-radius: 4px;
}

.todo-text { flex: 1; font-size: 0.9rem; }
.todo-item.done .todo-text { text-decoration: line-through; color: var(--muted); }

.item-del {
  background: none; border: none;
  color: var(--muted-light); cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
  font-size: 0.78rem; font-family: 'Outfit', sans-serif;
  transition: all 0.2s; font-weight: 500;
}

.item-del:hover { color: var(--danger); background: var(--danger-dim); }

.empty-msg { font-size: 0.85rem; color: var(--muted-light); padding: 12px 0; }

/* ── TIMELINE ITINERARY ── */
.timeline { position: relative; }

.timeline::before {
  content: '';
  position: absolute;
  left: 20px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--blue) 0%, rgba(37,99,235,0.15) 100%);
  border-radius: 2px;
}

.timeline-day {
  position: relative;
  margin-bottom: 36px;
  padding-left: 56px;
}

.timeline-day-dot {
  position: absolute;
  left: 12px; top: 6px;
  width: 18px; height: 18px;
  background: var(--blue);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
  z-index: 1;
}

.timeline-day-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.timeline-day-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.15rem; font-weight: 600;
  color: var(--ink);
}

.day-actions { display: flex; gap: 8px; align-items: center; }

.btn-day-entry {
  background: var(--blue-dim);
  border: 1px solid rgba(37,99,235,0.2);
  color: var(--blue); padding: 5px 12px;
  border-radius: 6px; font-size: 0.72rem;
  font-weight: 600; cursor: pointer;
  transition: all 0.2s; letter-spacing: 0.05em;
  text-transform: uppercase; font-family: 'Outfit', sans-serif;
}

.btn-day-entry:hover { background: rgba(37,99,235,0.14); }

.btn-day-del {
  background: none; border: 1px solid var(--border);
  color: var(--muted-light); padding: 5px 10px;
  border-radius: 6px; font-size: 0.72rem;
  cursor: pointer; transition: all 0.2s;
  font-family: 'Outfit', sans-serif;
}

.btn-day-del:hover { color: var(--danger); background: var(--danger-dim); border-color: rgba(220,38,38,0.2); }

.timeline-entries { display: flex; flex-direction: column; gap: 8px; }

.timeline-entry {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  box-shadow: 0 1px 6px rgba(30,60,120,0.05);
  transition: all 0.2s;
  position: relative;
}

.timeline-entry:hover { border-color: var(--border-strong); }

.entry-time-badge {
  font-size: 0.72rem; font-weight: 600;
  color: var(--blue); background: var(--blue-dim);
  border: 1px solid rgba(37,99,235,0.15);
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0; margin-top: 1px;
  font-family: 'Outfit', sans-serif; letter-spacing: 0.04em;
}

.entry-time-badge.no-time {
  background: rgba(107,114,128,0.08);
  border-color: var(--border);
  color: var(--muted);
}

.entry-content {
  flex: 1; font-size: 0.9rem; color: var(--ink);
  outline: none; line-height: 1.5;
  min-height: 20px;
}

.entry-content:focus { color: var(--blue); }

.timeline-empty {
  font-size: 0.82rem; color: var(--muted-light);
  font-style: italic; padding: 10px 0 4px;
}

/* ── TIPS ── */
.tips-group { margin-bottom: 28px; }

.tips-group-label {
  font-size: 0.7rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.12em; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}

.tip-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: 0 1px 6px rgba(30,60,120,0.05);
  transition: all 0.2s;
}

.tip-item:hover { border-color: var(--border-strong); }

.tip-badge {
  font-size: 0.65rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px;
  flex-shrink: 0; margin-top: 1px;
}

.badge-general { background: var(--blue-dim); color: var(--blue); border: 1px solid rgba(37,99,235,0.15); }
.badge-food { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-transport { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-accommodation { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-culture { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }

.tip-text {
  flex: 1; font-size: 0.88rem; color: var(--ink);
  outline: none; line-height: 1.6; min-height: 20px;
}

.tip-text:focus { color: var(--blue); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(17,24,39,0.4);
  backdrop-filter: blur(10px);
  z-index: 500; align-items: center; justify-content: center;
  padding: 20px;
}

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

.modal-card {
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 20px; padding: 36px 40px;
  width: 100%; max-width: 500px;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 28px;
}

.modal-header h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 400; color: var(--ink);
}

.modal-close {
  background: rgba(240,244,249,0.8); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px; cursor: pointer;
  color: var(--muted); transition: all 0.2s;
  display: flex; align-items: center;
}

.modal-close:hover { background: white; color: var(--ink); }

.modal-card .field-label { margin-top: 4px; }
.modal-card .field-input { margin-bottom: 16px; }

.modal-row { display: flex; gap: 12px; margin-bottom: 0; }
.modal-row > div { flex: 1; }
.modal-row .field-input { margin-bottom: 16px; }

.modal-actions {
  display: flex; gap: 10px;
  justify-content: flex-end; margin-top: 8px;
}

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  background: var(--ink); color: white;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(80px) scale(0.96);
  opacity: 0; transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}
