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

/* Palette + tokens from ibiza_design_assets_v1/design/design-guidelines.txt */
:root {
  --sand: #F5EBDD;         /* Sand Beige */
  --sand-deep: #F6C5AE;    /* Sunset Peach */
  --sky: #A9D9E8;          /* Ocean Blue */
  --sea: #BFE7E3;          /* Seafoam Mint */
  --coral: #F7A38F;        /* Warm Coral */
  --coral-deep: #E8836C;
  --turquoise: #7CCFCB;    /* Soft Turquoise */
  --lavender: #C8B7E8;
  --gold: #EBCB8B;         /* Soft Gold */
  --off-white: #FFFDF9;
  --warm-white: #FAF7F2;
  --soft-grey: #D9D4CD;
  --ink: #2F2A26;          /* Dark Text */
  --ink-soft: #756B60;
  --white: #FFFFFF;
  --card-shadow: 0 8px 24px rgba(47, 42, 38, 0.08);
  --card-shadow-strong: 0 16px 40px rgba(47, 42, 38, 0.16);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --status-dabei: #6EC6C0;
  --status-vielleicht: #E3B564;
  --status-nein: #F2A695;
  --status-none: #D9D4CD;

  --avatar-color: var(--turquoise); /* fallback only; elements set their own via inline style */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--warm-white) 0%, var(--sand) 30%, var(--sea) 70%, var(--sky) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-weight: 700; }

.script-accent {
  font-family: 'Caveat', cursive;
  font-weight: 600;
}

a { color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--coral), var(--coral-deep));
  color: white;
  box-shadow: 0 8px 20px rgba(245, 115, 79, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 24px rgba(245, 115, 79, 0.45); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  box-shadow: var(--card-shadow);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.95); }
.btn-block { width: 100%; }
.btn-add { padding: 8px 16px; font-size: 0.85rem; }
.btn-restore {
  background: rgba(110, 198, 192, 0.16);
  color: #337b75;
  box-shadow: none;
}
.btn-restore:hover { background: rgba(110, 198, 192, 0.28); }
.btn-danger {
  background: rgba(232, 131, 108, 0.14);
  color: var(--coral-deep);
  box-shadow: none;
}
.btn-danger:hover { background: rgba(232, 131, 108, 0.24); }

/* ---------- Auth screens ---------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow-strong);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.auth-card-wide { max-width: 460px; }
.hero-banner {
  position: relative;
  width: calc(100% + 64px);
  margin: -40px -32px 20px;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.hero-banner img { width: 100%; height: 100%; object-fit: cover; }
.hero-claim {
  position: absolute;
  left: 18px;
  bottom: 14px;
  color: white;
  font-size: 1.6rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  font-family: 'Caveat', cursive;
  font-weight: 600;
}
.auth-emoji { font-size: 2.8rem; margin-bottom: 4px; }
.auth-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: rgba(124, 207, 203, 0.16);
  color: var(--turquoise);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-icon svg { width: 30px; height: 30px; }
.auth-title { margin: 0 0 4px; font-size: 1.6rem; }
.auth-subtitle { color: var(--ink-soft); margin: 0 0 28px; font-size: 0.95rem; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { font-weight: 600; font-size: 0.9rem; color: var(--ink-soft); }
.auth-form input {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #E4DDD3;
  font-size: 1rem;
  background: white;
}
.auth-form input:focus { outline: 2px solid var(--turquoise); }
.auth-error { color: var(--coral-deep); font-size: 0.88rem; margin: -6px 0 0; }
.auth-logout-link {
  display: inline-block;
  margin-top: 22px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
}

/* ---------- Participant picker ---------- */
.participant-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0;
}
.participant-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 10px;
  border-radius: var(--radius-md);
  border: 1px solid #ECE4D8;
  background: white;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.participant-choice:hover { transform: translateY(-2px); box-shadow: var(--card-shadow); }
.participant-choice:active { transform: scale(0.97); }

/* ---------- Avatars ---------- */
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--avatar-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.78rem; }
.avatar-xs { width: 22px; height: 22px; font-size: 0.58rem; }

/* ---------- Top bar & day nav ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 246, 235, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(46, 58, 69, 0.06);
}
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 4px;
  gap: 10px;
  padding: 14px 18px 8px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; min-width: 0; }
.brand-name { white-space: nowrap; }
.brand-emoji { font-size: 1.4rem; flex-shrink: 0; }
.me { display: flex; align-items: center; gap: 2px; }
.me-link {
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  min-height: 40px;
  display: flex;
  align-items: center;
}
.me-logout { font-size: 1.15rem; color: var(--ink-soft); padding: 8px 10px; }
.me-trash { font-size: 1.05rem; color: var(--ink-soft); padding: 8px 8px; opacity: 0.75; }
.me-trash:hover { opacity: 1; }

.day-nav {
  display: flex;
  gap: 8px;
  padding: 4px 14px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.day-nav::-webkit-scrollbar { display: none; }
.day-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  min-width: 62px;
  transition: background 0.15s ease, color 0.15s ease;
}
.day-pill-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.day-pill-date { font-size: 0.9rem; }
.day-pill.active {
  background: linear-gradient(135deg, var(--coral), var(--coral-deep));
  color: white;
  box-shadow: 0 6px 16px rgba(245, 115, 79, 0.3);
}

/* ---------- Planner layout ---------- */
.planner {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 60px;
}
.day-section { padding-top: 18px; scroll-margin-top: 128px; }
.day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.day-heading h2 { margin: 0; font-size: 1.2rem; }

.day-banner {
  width: 100%;
  aspect-ratio: 16 / 6;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
}
.day-banner img { width: 100%; height: 100%; object-fit: cover; }

.event-list { display: flex; flex-direction: column; gap: 14px; }
.empty-day {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-family: inherit;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-md);
  padding: 22px 18px;
  text-align: center;
  border: 1.5px dashed #D9CFC0;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.empty-day:hover { background: rgba(255, 255, 255, 0.8); border-color: var(--turquoise); }
.empty-day-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--turquoise);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

/* ---------- Event cards ---------- */
.event-card {
  background: rgba(255, 255, 255, 0.88);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: 18px 20px 20px;
}
.event-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.event-heading { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 6px; }
.event-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(47, 42, 38, 0.06);
}
.event-icon svg { width: 19px; height: 19px; }
.event-icon-beach { color: var(--turquoise); background: rgba(124, 207, 203, 0.16); }
.event-icon-drinks { color: var(--coral-deep); background: rgba(232, 131, 108, 0.14); }
.event-icon-dinner { color: #B8923F; background: rgba(235, 203, 139, 0.25); }
.event-icon-club { color: #8B6FC4; background: rgba(200, 183, 232, 0.28); }
.event-icon-boat { color: #4B93A8; background: rgba(169, 217, 232, 0.35); }
.event-icon-brunch { color: var(--coral-deep); background: rgba(246, 197, 174, 0.35); }
.event-icon-sunset { color: var(--coral-deep); background: rgba(247, 163, 143, 0.2); }
.event-icon-relax { color: var(--turquoise); background: rgba(191, 231, 227, 0.4); }
.event-time {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  color: var(--coral-deep);
  background: rgba(255, 148, 114, 0.14);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
}
.event-actions { display: flex; gap: 6px; }
.icon-btn {
  border: none;
  background: rgba(46, 58, 69, 0.06);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-btn-danger:hover { background: rgba(232, 131, 126, 0.25); color: var(--coral-deep); }
.inline-form { display: inline; }

.event-title { margin: 4px 0 4px; font-size: 1.15rem; overflow-wrap: anywhere; }
.event-location { color: var(--turquoise); font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; overflow-wrap: anywhere; }
.event-description { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.4; margin: 0 0 8px; overflow-wrap: anywhere; }
.event-link {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--coral-deep);
  text-decoration: none;
  margin-bottom: 8px;
}

/* ---------- Reservation status badge ---------- */
.reservation-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}
.reservation-badge-gebucht { background: rgba(110, 198, 192, 0.22); color: #337b75; }
.reservation-badge-offen { background: rgba(227, 181, 100, 0.26); color: #8a6a25; }
.reservation-badge-keine { background: rgba(217, 212, 205, 0.4); color: var(--ink-soft); }

/* ---------- Packliste / Dresscode ---------- */
.packing-block {
  margin: 4px 0 10px;
  padding: 10px 12px;
  background: rgba(124, 207, 203, 0.1);
  border-left: 3px solid var(--turquoise);
  border-radius: var(--radius-sm);
}
.packing-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #3f8f89;
  margin-bottom: 3px;
}
.packing-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* ---------- Reservation status picker (in the event form) ---------- */
.reservation-choice-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reservation-choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #E7E0D3;
  background: white;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 44px;
  transition: all 0.12s ease;
}
.reservation-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.reservation-choice-gebucht input:checked ~ span { color: #337b75; }
.reservation-choice-offen input:checked ~ span { color: #8a6a25; }
.reservation-choice-keine input:checked ~ span { color: var(--ink); }
.reservation-choice:has(input:checked) { border-color: var(--turquoise); background: rgba(124, 207, 203, 0.08); }
.reservation-choice-gebucht:has(input:checked) { border-color: #6EC6C0; background: rgba(110, 198, 192, 0.12); }
.reservation-choice-offen:has(input:checked) { border-color: #E3B564; background: rgba(227, 181, 100, 0.14); }
.reservation-choice-keine:has(input:checked) { border-color: var(--soft-grey); background: rgba(217, 212, 205, 0.25); }

/* ---------- Trash / Papierkorb ---------- */
.trash-card { padding-bottom: 16px; }
.trash-meta { font-size: 0.78rem; color: var(--ink-soft); opacity: 0.8; margin: 2px 0 12px; }
.trash-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.trash-actions .btn { flex: 1 1 140px; min-height: 44px; }
.trash-empty { max-width: 480px; margin: 40px auto; cursor: default; }
.trash-empty:hover { background: rgba(255, 255, 255, 0.5); border-color: #D9CFC0; }
.confirm-dialog h3 { margin-bottom: 10px; }
.confirm-text { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.5; margin: 0; }

/* ---------- RSVP ---------- */
.rsvp-block { margin-top: 12px; border-top: 1px solid #F0E9DD; padding-top: 12px; }
.rsvp-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rsvp-btn {
  flex: 1 1 0;
  min-width: 88px;
  min-height: 44px;
  border: 1.5px solid #E7E0D3;
  background: white;
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.12s ease;
}
.rsvp-btn:active { transform: scale(0.96); }
.rsvp-dabei.active { background: var(--status-dabei); border-color: var(--status-dabei); color: white; }
.rsvp-vielleicht.active { background: var(--status-vielleicht); border-color: var(--status-vielleicht); color: white; }
.rsvp-nein.active { background: var(--status-nein); border-color: var(--status-nein); color: white; }

.rsvp-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 8px;
}
.rsvp-count b { font-size: 0.95rem; }
.rsvp-count-dabei b { color: var(--status-dabei); }
.rsvp-count-vielleicht b { color: var(--status-vielleicht); }
.rsvp-count-nein b { color: var(--status-nein); }

.rsvp-people { display: flex; flex-wrap: wrap; gap: 8px; }
.person-chip {
  position: relative;
  display: flex;
  align-items: center;
}
.status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid white;
  background: var(--status-none);
}
.person-status-dabei .status-dot { background: var(--status-dabei); }
.person-status-vielleicht .status-dot { background: var(--status-vielleicht); }
.person-status-nein .status-dot { background: var(--status-nein); }
.person-status-none .avatar { opacity: 0.45; }

/* ---------- Dialog / form ---------- */
.event-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 92%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--card-shadow-strong);
}
.event-dialog::backdrop { background: rgba(46, 58, 69, 0.45); backdrop-filter: blur(2px); }
.event-dialog h3 { margin: 0 0 16px; }
#event-form { display: flex; flex-direction: column; gap: 4px; }
#event-form label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); margin-top: 8px; }
#event-form input, #event-form select, #event-form textarea {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #E4DDD3;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
#event-form input:focus, #event-form select:focus, #event-form textarea:focus {
  outline: 2px solid var(--turquoise);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ==================================================================
   Responsive breakpoints
   Base rules above = mobile portrait (e.g. iPhone SE/12/14, small Android, ~360-430px)
   ================================================================== */

/* Extra-small phones (older/narrow Android, iPhone SE portrait) */
@media (max-width: 380px) {
  .participant-grid { grid-template-columns: 1fr 1fr; }
  .rsvp-btn { min-width: 70px; padding: 9px 4px; font-size: 0.74rem; }
  .event-card { padding: 16px 14px 18px; }
  .planner { padding-left: 12px; padding-right: 12px; }
  .brand { font-size: 0.98rem; gap: 6px; }
  .brand-emoji { font-size: 1.2rem; }
}

/* Phone landscape & large phones (e.g. iPhone landscape ~667-926px wide, big Android portrait) */
@media (min-width: 480px) {
  .planner { padding-top: 16px; }
  .event-card { padding: 22px 26px 24px; }
  .rsvp-btn { font-size: 0.88rem; }
  .auth-card { padding: 48px 40px; }
}

/* Tablets (portrait iPad ~768px+) and wide phone landscape: event cards go 2-column */
@media (min-width: 700px) {
  .planner { max-width: 900px; }
  .event-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: start;
  }
  .empty-day { grid-column: 1 / -1; }
  .day-heading h2 { font-size: 1.35rem; }
}

/* Desktop / large tablets landscape */
@media (min-width: 1024px) {
  .planner { max-width: 1180px; }
  .event-list { grid-template-columns: repeat(3, 1fr); }
  .day-nav { padding-left: 24px; padding-right: 24px; }
  .topbar-row { padding-left: 24px; padding-right: 24px; }
}

/* Short/landscape viewports (phone turned sideways): claw back vertical space */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar-row { padding: 8px 18px 4px; }
  .day-nav { padding: 2px 14px 8px; }
  .day-pill { padding: 5px 14px; }
  .day-section { scroll-margin-top: 96px; }
  .event-dialog { max-height: 92vh; }
  .auth-body { align-items: flex-start; padding-top: 16px; }
  .hero-banner { aspect-ratio: 16 / 5; }
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 380px);
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: white;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow-strong);
  text-align: center;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--status-dabei); }
.toast-error { background: var(--coral-deep); }
