/* ═══════════════ Urlaubsplaner · Light / Apple-like ═══════════════ */

:root {
  --bg: #f2f2f7;                 /* iOS grouped background */
  --card: #ffffff;
  --card-border: rgba(0, 0, 0, 0.045);
  --hairline: rgba(0, 0, 0, 0.08);
  --text: #1c1c1e;
  --text-dim: #8e8e93;
  --accent: #007aff;             /* iOS Blau */
  --accent-2: #e07800;           /* warmes Orange (lesbar auf Weiß) */
  --green: #34c759;
  --danger: #ff3b30;
  --radius: 18px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 14px rgba(0, 0, 0, 0.05);
  --tabbar-h: 62px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea {
  font: inherit;
  color: var(--text);
  background: #f1f1f4;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
input:focus, textarea:focus { border-color: var(--accent); background: #fff; }
input::placeholder, textarea::placeholder { color: #a3a3ab; }

/* ═══════════════ LOGIN ═══════════════ */

.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #cde9ff 0%, #eef4fb 45%, #fdf3e3 100%);
  z-index: 50;
  overflow: hidden;
}

.login-waves {
  position: absolute; left: 0; right: 0; bottom: -8px; height: 30vh;
  background:
    radial-gradient(120% 70% at 50% 100%, rgba(0, 122, 255, 0.14), transparent 70%),
    radial-gradient(90% 50% at 30% 100%, rgba(255, 149, 0, 0.14), transparent 70%);
  pointer-events: none;
}

.login-card {
  width: 100%; max-width: 360px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 26px;
  padding: 36px 28px;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 18px 50px rgba(31, 62, 108, 0.16);
  z-index: 1;
}
.login-emoji { font-size: 56px; margin-bottom: 8px; }
.login-card h1 { font-size: 32px; letter-spacing: -0.6px; font-weight: 800; }
.login-sub { color: var(--text-dim); margin: 6px 0 26px; }
.login-card input { text-align: center; font-size: 17px; margin-bottom: 14px; }
.login-error { color: var(--danger); margin-top: 12px; font-size: 14px; }

/* ═══════════════ BUTTONS ═══════════════ */

.btn {
  border-radius: 13px;
  padding: 13px 18px;
  font-weight: 600;
  font-size: 16px;
  transition: transform 0.1s ease, opacity 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); filter: brightness(0.95); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: #e9e9ec; color: var(--text); }
.btn-danger { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.btn-block { width: 100%; display: block; }
.btn-sm { padding: 8px 13px; font-size: 14px; border-radius: 10px; }

.icon-btn {
  font-size: 19px;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(120, 120, 128, 0.1);
  transition: transform 0.1s ease;
  flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn-sm { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }

/* ═══════════════ APP LAYOUT ═══════════════ */

.app { min-height: 100vh; }

.app-header {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 14px) 18px 12px;
  background: rgba(242, 242, 247, 0.82);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 0.5px solid var(--hairline);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 640px; margin: 0 auto; }
.header-titles { flex: 1; min-width: 0; }
.app-header h1 { font-size: 24px; letter-spacing: -0.5px; font-weight: 800; }
.header-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.countdown {
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.1);
  padding: 6px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.sync-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #d1d1d6;
}
.sync-dot.sync-synced { background: var(--green); }
.sync-dot.sync-syncing { background: var(--accent); animation: sync-pulse 1s ease infinite; }
.sync-dot.sync-offline { background: #c7c7cc; }
.sync-dot.sync-error, .sync-dot.sync-auth { background: #ff9500; }
@keyframes sync-pulse { 50% { opacity: 0.35; } }

.sync-status-box {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-dim);
  background: #f1f1f4;
  border-radius: 12px;
  padding: 10px 13px;
  margin-bottom: 14px;
}

.main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}

/* ═══════════════ TABBAR ═══════════════ */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: rgba(249, 249, 251, 0.85);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 0.5px solid var(--hairline);
}
.tab {
  flex: 1;
  height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  font-size: 11px; font-weight: 600;
  color: #98989f;
}
.tab-icon { font-size: 22px; }
.tab.active { color: var(--accent); }

/* ═══════════════ CARDS ═══════════════ */

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.card-emoji { font-size: 27px; flex-shrink: 0; }
.card-titles { flex: 1; min-width: 0; }
.card-date { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.6px; }
.card-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.card-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.card-chevron { color: #c7c7cc; font-size: 15px; font-weight: 600; transition: transform 0.2s ease; flex-shrink: 0; }
.card.open .card-chevron { transform: rotate(90deg); }

.card-body { display: none; padding: 2px 14px 14px; }
.card.open .card-body { display: block; }

/* Fortschrittsbalken */
.progress-wrap { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.progress-bar { flex: 1; height: 5px; border-radius: 99px; background: rgba(120, 120, 128, 0.14); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.3s ease; }
.progress-label { font-size: 11px; font-weight: 700; color: var(--text-dim); min-width: 38px; text-align: right; }
.progress-fill.full { background: var(--green); }

/* ═══════════════ CHECK-ITEMS ═══════════════ */

.check-item {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 10px 4px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
}
.check-item:last-of-type { border-bottom: none; }

.checkbox {
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 1.8px solid #c7c7cc;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: transparent;
  transition: all 0.15s ease;
}
.check-item.done .checkbox {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.check-content { flex: 1; min-width: 0; padding-top: 2px; }
.check-time { font-size: 12px; font-weight: 700; color: var(--accent-2); margin-right: 7px; }
.check-text { font-size: 15px; line-height: 1.4; word-wrap: break-word; }
.check-item.done .check-text { text-decoration: line-through; color: #b0b0b6; }
.check-item.done .check-time { opacity: 0.5; }
.check-main { flex: 1; min-width: 0; display: flex; gap: 11px; align-items: flex-start; cursor: pointer; }

.item-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ═══════════════ EDIT-MODUS ═══════════════ */

.card-toolbar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 2px 4px;
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
  margin-top: 8px;
}

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; padding: 10px 12px; font-size: 15px; }
.add-row .time-input { flex: 0 0 74px; text-align: center; }

/* ═══════════════ NOTIZEN ═══════════════ */

.note-content {
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #3a3a3c;
  padding: 4px 4px 2px;
  word-wrap: break-word;
}
.note-edit textarea { min-height: 200px; font-size: 14.5px; line-height: 1.5; }

/* ═══════════════ SEKTIONEN ═══════════════ */

.section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-dim);
  margin: 22px 6px 10px;
}
.section-title:first-child { margin-top: 4px; }

.big-add-btn {
  width: 100%;
  padding: 15px;
  border-radius: var(--radius);
  border: 1.5px dashed #c7c7cc;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 14px;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.5);
}
.big-add-btn:active { transform: scale(0.98); border-color: var(--accent); color: var(--accent); }

/* Übersichts-Statistik oben im Packen-Tab */
.stats-card {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #eaf3ff, #eefaf1);
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.stats-num { font-size: 30px; font-weight: 800; color: var(--accent); }
.stats-label { font-size: 13px; color: var(--text-dim); }

/* ═══════════════ MODAL ═══════════════ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 560px;
  background: #fff;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(22px + var(--safe-bottom));
  max-height: 85vh;
  overflow-y: auto;
  animation: slide-up 0.22s ease;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.14);
}
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { font-size: 20px; margin-bottom: 16px; font-weight: 800; letter-spacing: -0.3px; }
.modal .field { margin-bottom: 13px; }
.modal .field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ═══════════════ TOAST ═══════════════ */

.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  left: 50%; transform: translateX(-50%);
  z-index: 70;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
  display: flex; align-items: center; gap: 12px;
  max-width: calc(100vw - 32px);
  animation: slide-up 0.22s ease;
}
.toast .btn { padding: 7px 13px; font-size: 13px; }

/* ═══════════════ SETTINGS ═══════════════ */

.settings-list { display: flex; flex-direction: column; gap: 10px; }

.empty-hint {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 24px 12px;
}

/* ═══════════════ URLAUBS-LISTE (Startseite) ═══════════════ */

.trip-card .card-head { padding: 18px 16px; }
.trip-card .card-emoji { font-size: 34px; }
.trip-badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  background: rgba(0, 122, 255, 0.1);
  padding: 4px 9px;
  border-radius: 99px;
  margin-top: 6px;
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

#btn-back { font-size: 26px; font-weight: 300; padding-bottom: 3px; }

/* ═══════════════ FOTOBUCH ═══════════════ */

.photobook-header { text-align: center; padding: 14px 8px 22px; }
.photobook-script {
  font-family: "Snell Roundhand", "Savoye LET", "Apple Chancery", "Segoe Script", "Brush Script MT", cursive;
  font-size: 44px;
  line-height: 1.15;
  background: linear-gradient(110deg, #f59e0b, #f97316, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 6px;
}
.photobook-sub {
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 8px;
}

.album-day { margin-bottom: 34px; }
.album-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 6px 12px;
  border-bottom: 0.5px solid var(--hairline);
  padding-bottom: 8px;
}
.album-script {
  font-family: "Snell Roundhand", "Savoye LET", "Apple Chancery", "Segoe Script", "Brush Script MT", cursive;
  font-size: 27px;
  color: #ea580c;
  white-space: nowrap;
}
.album-title { font-size: 14px; font-weight: 600; color: var(--text-dim); }

.photo-grid {
  columns: 2;
  column-gap: 12px;
  padding: 0 2px;
}
.polaroid {
  display: inline-block;
  width: 100%;
  background: #fff;
  border-radius: 4px;
  padding: 7px 7px 10px;
  margin: 0 0 14px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 10px 24px rgba(0, 0, 0, 0.1);
  transform: rotate(-1.3deg);
  cursor: pointer;
  break-inside: avoid;
  transition: transform 0.15s ease;
}
.polaroid:nth-child(even) { transform: rotate(1.4deg); }
.polaroid:active { transform: scale(0.97) rotate(0deg); }
.polaroid img {
  width: 100%;
  display: block;
  border-radius: 2px;
}
.polaroid figcaption {
  font-family: "Snell Roundhand", "Savoye LET", "Apple Chancery", "Segoe Script", "Brush Script MT", cursive;
  font-size: 16px;
  color: #444;
  text-align: center;
  padding-top: 6px;
  min-height: 4px;
  word-wrap: break-word;
}
.polaroid figcaption:empty { padding-top: 2px; }

.photo-add-btn {
  display: block;
  text-align: center;
  padding: 12px;
  margin: 2px 2px 0;
  border: 1.5px dashed #c7c7cc;
  border-radius: 14px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  background: rgba(255, 255, 255, 0.5);
}
.photo-add-btn:active { border-color: var(--accent); color: var(--accent); transform: scale(0.98); }

.viewer-img {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border-radius: 12px;
  background: #f1f1f4;
  margin-bottom: 14px;
}

/* ═══════════════ KOSTEN ═══════════════ */

.cost-stats { align-items: flex-start; }
.cost-total { font-size: 32px; font-weight: 800; color: var(--accent); letter-spacing: -0.5px; }
.cost-paid-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.payer-badge {
  font-size: 13px; font-weight: 700;
  padding: 6px 11px;
  border-radius: 99px;
}
/* Bis zu 6 Personen-Farben, danach wiederholen sie sich */
.payer-c0 { background: rgba(255, 149, 0, 0.14); color: #b45309; }
.payer-c1 { background: rgba(20, 184, 166, 0.13); color: #0f766e; }
.payer-c2 { background: rgba(175, 82, 222, 0.12); color: #7e22ce; }
.payer-c3 { background: rgba(255, 45, 85, 0.1); color: #be185d; }
.payer-c4 { background: rgba(52, 199, 89, 0.14); color: #15803d; }
.payer-c5 { background: rgba(0, 122, 255, 0.11); color: #1d64c8; }

.settle-line {
  margin-top: 12px;
  font-size: 14.5px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 10px 13px;
}
.settle-line b { color: #c2410c; }

.cost-add-card { padding: 13px; overflow: visible; }
.cost-add-inner { display: flex; flex-direction: column; gap: 9px; }
.cost-add-row2 { display: flex; gap: 8px; align-items: stretch; }
.cost-add-row2 input { flex: 1; text-align: right; }
.cost-add-row2 .btn { flex: 0 0 auto; }

.payer-toggle { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.payer-chip {
  flex: 1 1 auto;
  min-width: 72px;
  border-radius: 11px;
  font-size: 14px; font-weight: 700;
  padding: 10px 8px;
  opacity: 0.5;
  border: 1.5px solid transparent;
  transition: all 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.payer-chip.sel { opacity: 1; border-color: currentColor; }

.person-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.person-row input { flex: 1; }

.check-inline {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 9px;
  cursor: pointer;
}
.check-inline input { width: auto; accent-color: var(--accent); }

.expense-row { margin-bottom: 9px; }
.expense-inner {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 14px;
  cursor: pointer;
}
.payer-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  flex-shrink: 0;
}
.expense-text { flex: 1; min-width: 0; font-size: 15px; word-wrap: break-word; }
.expense-amount { font-size: 15.5px; font-weight: 700; white-space: nowrap; }

@media (min-width: 700px) {
  .app-header h1 { font-size: 27px; }
  .photo-grid { columns: 3; }
}
