/* ============================================
   REISEPLANER - Main Stylesheet
   Design: Coastal Explorer - Warm & Nautical
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --ocean: #1B4F72;
  --ocean-deep: #0f2f44;
  --ocean-light: #2E86AB;
  --sand: #F0E6D3;
  --sand-warm: #E8D5B7;
  --sand-dark: #C4A882;
  --sunset: #E8956D;
  --sunset-deep: #C97A52;
  --sunset-light: #F0B090;
  --foam: #F7F2EC;
  --white: #FFFFFF;
  --text: #2C2C2C;
  --text-muted: #7A7A7A;
  --text-light: #AAAAAA;
  --border: #E8DDD0;
  --border-light: #F0EAE0;
  --shadow: rgba(27, 79, 114, 0.08);
  --shadow-md: rgba(27, 79, 114, 0.15);

  --cat-unterkunft: #4A90D9;
  --cat-transport: #7B68EE;
  --cat-essen: #E8956D;
  --cat-aktivitaeten: #52C97A;
  --cat-einkaufen: #E8C56D;
  --cat-sonstiges: #AAA;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --transition: 0.2s ease;

  /* Bottom Nav Height */
  --nav-h: 70px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--foam);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3 { font-family: 'Playfair Display', serif; }
h1 { font-size: 1.8rem; font-weight: 700; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ========== LAYOUT ========== */
#app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  background: var(--foam);
}

.page {
  display: none;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 1rem);
  animation: pageIn 0.3s ease;
}

.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== TOP BAR ========== */
.top-bar {
  background: var(--ocean);
  color: white;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.top-bar h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: white;
  flex: 1;
}

.top-bar .subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
}

.back-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  flex-shrink: 0;
}

.back-btn:hover { background: rgba(255,255,255,0.25); }

.top-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background var(--transition);
  white-space: nowrap;
}

.top-btn:hover { background: rgba(255,255,255,0.25); }
.top-btn.accent { background: var(--sunset); }
.top-btn.accent:hover { background: var(--sunset-deep); }

/* ========== BOTTOM NAV ========== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: var(--nav-h);
  background: white;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 200;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.65rem;
  font-family: 'DM Sans', sans-serif;
  transition: color var(--transition);
  padding: 0.5rem 0;
  text-decoration: none;
}

.nav-item .nav-icon { font-size: 1.4rem; }
.nav-item.active { color: var(--ocean); }
.nav-item.active .nav-icon { transform: scale(1.1); }

/* ========== CONTENT PADDING ========== */
.content { padding: 1.25rem; }

/* ========== CARDS ========== */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px var(--shadow-md); }

.card-body { padding: 1.25rem; }

/* ========== TRIP CARD ========== */
.trip-card {
  margin-bottom: 1rem;
  cursor: pointer;
}

.trip-cover {
  height: 160px;
  background: linear-gradient(135deg, var(--ocean) 0%, var(--ocean-light) 100%);
  position: relative;
  overflow: hidden;
}

.trip-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trip-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.4;
}

.trip-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
}

.status-planned { background: rgba(255,255,255,0.9); color: var(--ocean); }
.status-active { background: rgba(82,201,122,0.9); color: white; }
.status-completed { background: rgba(27,79,114,0.9); color: white; }
.status-archived { background: rgba(0,0,0,0.5); color: white; }

.trip-info { padding: 1.1rem 1.25rem 1.25rem; }
.trip-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; margin-bottom: 0.25rem; }
.trip-meta { color: var(--text-muted); font-size: 0.85rem; display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }
.trip-meta span { display: flex; align-items: center; gap: 0.3rem; }
.trip-stats { display: flex; gap: 1rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border-light); }
.trip-stat { font-size: 0.8rem; color: var(--text-muted); }
.trip-stat strong { color: var(--text); font-size: 1rem; display: block; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-icon { font-size: 3.5rem; margin-bottom: 1rem; display: block; }
.empty-state h3 { font-family: 'Playfair Display', serif; color: var(--text); margin-bottom: 0.5rem; }

/* ========== FAB ========== */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 1.25rem);
  right: max(1.25rem, calc(50% - 300px + 1.25rem));
  width: 56px;
  height: 56px;
  background: var(--sunset);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(232,149,109,0.5);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

.fab:hover { transform: scale(1.1) rotate(45deg); box-shadow: 0 6px 24px rgba(232,149,109,0.6); }

/* ========== FORMS ========== */
.form-group { margin-bottom: 1.1rem; }

label.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
}

.form-control:focus { border-color: var(--ocean); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary { background: var(--ocean); color: white; }
.btn-primary:hover { background: var(--ocean-deep); }
.btn-accent { background: var(--sunset); color: white; }
.btn-accent:hover { background: var(--sunset-deep); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--ocean); color: var(--ocean); }
.btn-danger { background: transparent; border: 1.5px solid #FFD0CC; color: #CC3333; }
.btn-danger:hover { background: #FFF0EE; }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 0 0 2rem 0;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 1rem auto 0.5rem;
}

.modal-header {
  padding: 0.75rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 { font-size: 1.2rem; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); padding: 0.25rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 0 1.5rem; display: flex; gap: 0.75rem; }

/* ========== STATION CARD ========== */
.station-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--shadow);
  transition: all var(--transition);
  border-left: 4px solid var(--sand-dark);
}

.station-card:hover { transform: translateX(4px); box-shadow: 0 4px 16px var(--shadow-md); }

.station-dot {
  width: 40px;
  height: 40px;
  background: var(--sand);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.station-info { flex: 1; min-width: 0; }
.station-name { font-weight: 500; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.station-dates { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ========== FEATURE TABS ========== */
.feature-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0 1.25rem;
  margin: 1rem 0;
  scrollbar-width: none;
}

.feature-tabs::-webkit-scrollbar { display: none; }

.feature-tab {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid var(--border);
  background: white;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 0.5rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}

.feature-tab.active {
  background: var(--ocean);
  color: white;
  border-color: var(--ocean);
}

.feature-panel { display: none; }
.feature-panel.active { display: block; animation: pageIn 0.2s ease; }

/* ========== PHOTOS GRID ========== */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.photo-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--border-light);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.photo-thumb:hover img { transform: scale(1.05); }

.photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.photo-thumb:hover .photo-delete { display: flex; }

/* ========== LIGHTBOX ========== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 85vh; object-fit: contain; border-radius: 8px; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; color: white; font-size: 2rem; cursor: pointer; }

/* ========== CHECKLIST ========== */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-light);
}

.checklist-item:last-child { border-bottom: none; }

.check-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.check-box.checked { background: var(--ocean); border-color: var(--ocean); color: white; }
.checklist-label { flex: 1; font-size: 0.9rem; }
.checklist-label.done { text-decoration: line-through; color: var(--text-muted); }

/* ========== EXPENSES ========== */
.expense-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-light);
}

.expense-item:last-child { border-bottom: none; }

.expense-cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.expense-info { flex: 1; min-width: 0; }
.expense-desc { font-size: 0.9rem; font-weight: 500; }
.expense-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }
.expense-amount { font-weight: 600; color: var(--text); white-space: nowrap; }

.expense-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-stat {
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.summary-stat .value {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--ocean);
  display: block;
}

.summary-stat .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--foam);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.balance-name { font-weight: 500; font-size: 0.95rem; }
.balance-amount { font-weight: 600; font-size: 0.95rem; }
.balance-pos { color: #2E9E5A; }
.balance-neg { color: #CC3333; }

/* ========== DIARY ========== */
.diary-entry {
  background: white;
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--sunset);
}

.diary-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.diary-date { font-size: 0.8rem; color: var(--text-muted); }
.diary-mood { font-size: 1.2rem; }
.diary-title { font-weight: 600; margin-bottom: 0.4rem; }
.diary-content { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }

/* ========== LINKS ========== */
.link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.link-item:last-child { border-bottom: none; }
.link-icon { font-size: 1.2rem; flex-shrink: 0; }
.link-info { flex: 1; min-width: 0; }
.link-label { font-size: 0.9rem; font-weight: 500; }
.link-url { font-size: 0.75rem; color: var(--ocean); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.link-url:hover { text-decoration: underline; }

/* ========== DOCUMENTS ========== */
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--foam);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.doc-icon { font-size: 1.5rem; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-label { font-size: 0.75rem; color: var(--text-muted); }

/* ========== SUMMARY PAGE ========== */
.summary-hero {
  background: linear-gradient(135deg, var(--ocean-deep), var(--ocean-light));
  color: white;
  padding: 2rem 1.5rem;
  text-align: center;
}

.summary-hero h1 { font-size: 2rem; color: white; }
.summary-section { margin-bottom: 2rem; }
.summary-section h3 { font-family: 'Playfair Display', serif; color: var(--ocean); margin-bottom: 1rem; font-size: 1.2rem; }

.summary-photos-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
}

.summary-photos-strip::-webkit-scrollbar { display: none; }

.summary-photo {
  width: 120px;
  height: 90px;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
}

.summary-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ========== MAPS AREA ========== */
.maps-area {
  background: var(--sand);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.maps-field { margin-bottom: 0.75rem; }
.maps-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.3rem; font-weight: 500; }
.maps-value { font-size: 0.95rem; font-weight: 500; }

.maps-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--ocean);
  color: white;
  padding: 0.65rem 1.1rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition);
  margin-top: 0.5rem;
}

.maps-open-btn:hover { background: var(--ocean-deep); }

/* ========== CHIP / BADGE ========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.chip-ocean { background: rgba(27,79,114,0.1); color: var(--ocean); }
.chip-sunset { background: rgba(232,149,109,0.15); color: var(--sunset-deep); }

/* ========== UPLOAD ZONE ========== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-muted);
}

.upload-zone:hover { border-color: var(--ocean); color: var(--ocean); background: rgba(27,79,114,0.02); }
.upload-zone input { display: none; }
.upload-icon { font-size: 2rem; margin-bottom: 0.5rem; display: block; }

/* ========== SECTION DIVIDER ========== */
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--ocean);
  margin: 1.5rem 0 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ========== CATEGORY COLORS ========== */
.cat-unterkunft { background: var(--cat-unterkunft); }
.cat-transport { background: var(--cat-transport); }
.cat-essen { background: var(--cat-essen); }
.cat-aktivitaeten { background: var(--cat-aktivitaeten); }
.cat-einkaufen { background: var(--cat-einkaufen); }
.cat-sonstiges { background: var(--cat-sonstiges); }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: white;
  padding: 0.7rem 1.5rem;
  border-radius: 24px;
  font-size: 0.85rem;
  z-index: 9999;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  white-space: nowrap;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ========== LOADING ========== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  gap: 0.75rem;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--ocean);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ========== RESPONSIVE ========== */
@media (max-width: 360px) {
  .form-row { grid-template-columns: 1fr; }
  .expense-summary-grid { grid-template-columns: 1fr; }
}
