/* =============================================
   C&M — Couples Website Styles
   ============================================= */

/* ── Design Tokens ───────────────────────── */
:root {
  --primary: #D4726A;
  --primary-dark: #B85450;
  --primary-light: #F2D0CC;
  --accent: #E8A87C;
  --bg: #FFF8F6;
  --surface: #FFFFFF;
  --text: #2D2226;
  --text-muted: #6B5B5E;
  --border: #E8D5D0;
  --success: #6BAF7B;
  --danger: #D45050;
  --color-c: #D4726A;
  --color-m: #7BA0C4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(45,34,38,0.08), 0 1px 2px rgba(45,34,38,0.06);
  --shadow-md: 0 4px 12px rgba(45,34,38,0.1);
  --shadow-lg: 0 8px 24px rgba(45,34,38,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;
}

/* ── Reset & Base ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Typography ──────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

/* ── Top Nav ─────────────────────────────── */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.nav-tabs { display: flex; gap: 4px; height: 100%; }
.nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  height: 100%;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-user { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}
.logout-form { display: flex; }
.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.btn-logout:hover { color: var(--danger); background: rgba(212,80,80,0.08); }

/* ── Bottom Nav (mobile) ─────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  height: 64px;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  flex: 1;
  transition: color var(--transition);
}
.bottom-tab .nav-icon { width: 22px; height: 22px; }
.bottom-tab.active { color: var(--primary); }

/* ── Main Content ────────────────────────── */
.main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 100px;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Page Header ─────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left { display: flex; align-items: center; gap: 8px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back-link {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.back-link:hover { color: var(--primary); }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ── Forms ────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; }
.form-row .form-group { margin-bottom: 0; }
.flex-2 { flex: 2; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"],
select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212,114,106,0.15);
}
textarea { resize: vertical; }
.color-input { width: 40px; height: 36px; padding: 2px; border-radius: var(--radius-sm); cursor: pointer; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 4px 0;
}

/* ── Flash Messages ──────────────────────── */
.flash {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  margin: 12px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: flashIn 0.3s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.flash-error { background: #fde8e8; color: #b91c1c; }
.flash-success { background: #e8f5e9; color: #2e7d32; }

/* ── Save Indicator ──────────────────────── */
.save-indicator {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: var(--success);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 200;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: var(--shadow-md);
}
.save-indicator.saving { background: var(--accent); }
.save-indicator.error { background: var(--danger); }
.save-indicator.hidden { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* ── Modal ────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(45,34,38,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.modal-close:hover { background: rgba(45,34,38,0.06); }
.modal form .form-group { margin-bottom: 12px; }
.modal-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; gap: 8px; }
.modal-actions-right { display: flex; gap: 8px; margin-left: auto; }

/* ── Export Dropdown ──────────────────────── */
.export-menu { position: relative; }
.export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
  min-width: 100px;
  overflow: hidden;
  margin-top: 4px;
}
.export-dropdown.hidden { display: none; }
.export-dropdown a {
  display: block;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text);
  transition: background var(--transition);
}
.export-dropdown a:hover { background: var(--primary-light); }

/* ── Badge ────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}
.pin-badge { background: var(--accent); color: #fff; font-size: 0.65rem; padding: 1px 8px; border-radius: 10px; }

/* ── Empty State ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state.small { padding: 24px 20px; }

/* ── Auth Pages ──────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: -1px;
}
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
.auth-form { text-align: left; }
.auth-form .form-group { margin-bottom: 14px; }
.auth-form .btn { margin-top: 4px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.magic-sent-icon { margin: 20px 0 16px; color: var(--primary); }
.magic-sent-icon svg { stroke: var(--primary); }

/* ── Error Pages ─────────────────────────── */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 4rem; color: var(--primary); }
.error-page p { color: var(--text-muted); margin: 8px 0 24px; }

/* ══════════════════════════════════════════
   FEED
   ══════════════════════════════════════════ */
.feed-container { max-width: 640px; }
.feed-date-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(232,213,208,0.4);
  animation: fadeIn 0.3s ease;
}
.feed-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.feed-content { flex: 1; }
.feed-content p { font-size: 0.875rem; line-height: 1.5; }
.feed-content strong { font-weight: 600; }
.feed-link { color: var(--primary); font-weight: 500; }
.feed-link:hover { text-decoration: underline; }
.feed-entity { font-weight: 500; color: var(--text); }
.feed-time { font-size: 0.7rem; color: var(--text-muted); }
.feed-loader { text-align: center; padding: 20px; }

/* ══════════════════════════════════════════
   CALENDAR
   ══════════════════════════════════════════ */
#calendar-container {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
/* FullCalendar overrides */
.fc { font-family: var(--font) !important; }
.fc .fc-toolbar-title { font-size: 1.15rem !important; font-weight: 600; }
.fc .fc-button-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  font-size: 0.8rem !important;
  padding: 4px 12px !important;
  border-radius: var(--radius-sm) !important;
}
.fc .fc-button-primary:hover { background: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--primary-dark) !important; }
.fc .fc-daygrid-day-number { color: var(--text); font-size: 0.8rem; }
.fc .fc-col-header-cell-cushion { color: var(--text-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
.fc .fc-daygrid-event { border-radius: 4px !important; font-size: 0.78rem !important; padding: 1px 4px !important; }
.fc .fc-day-today { background: var(--primary-light) !important; }
.fc .fc-event { cursor: pointer; }
.fc .fc-timegrid-slot { font-size: 0.75rem; }
.fc th, .fc td { border-color: var(--border) !important; }

/* ══════════════════════════════════════════
   LISTS
   ══════════════════════════════════════════ */
.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--primary);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  color: var(--text);
}
.list-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--text); }
.list-card-icon { font-size: 1.5rem; flex-shrink: 0; }
.list-card-body { flex: 1; min-width: 0; }
.list-card-body h3 { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card-meta { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }
.list-card-count { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.count-checked { color: var(--success); }

/* Single list */
.list-show-icon { font-size: 1.5rem; }
.list-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 0.8rem; }
.list-progress { color: var(--text-muted); }
.list-items-container { margin-bottom: 16px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(232,213,208,0.3);
  transition: opacity var(--transition);
}
.list-item.checked { opacity: 0.5; }
.list-item.checked .item-content { text-decoration: line-through; }
.drag-handle { cursor: grab; color: var(--border); font-size: 1rem; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.list-checkbox { display: flex; align-items: center; flex-shrink: 0; }
.list-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.item-content {
  flex: 1;
  outline: none;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 0.9rem;
  min-width: 0;
}
.item-content:focus { background: var(--primary-light); }
.item-delete {
  background: none;
  border: none;
  color: var(--border);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition);
  flex-shrink: 0;
}
.item-delete:hover { color: var(--danger); }
.add-item-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.add-item-form input { flex: 1; }

/* Icon picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-option {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
  background: var(--bg);
  transition: border-color var(--transition);
}
.icon-option:hover { border-color: var(--border); }
.icon-option.selected { border-color: var(--primary); background: var(--primary-light); }

/* ══════════════════════════════════════════
   TRIPS
   ══════════════════════════════════════════ */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.trip-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
  color: var(--text);
}
.trip-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--text); }
.trip-card-emoji { font-size: 2rem; margin-bottom: 8px; }
.trip-card-body h3 { font-size: 1rem; margin-bottom: 4px; }
.trip-destination { font-size: 0.8rem; color: var(--text-muted); }
.trip-dates { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.trip-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.trip-status {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-planning { background: #FFF3E0; color: #E65100; }
.status-booked { background: #E3F2FD; color: #1565C0; }
.status-in_progress { background: #E8F5E9; color: #2E7D32; }
.status-completed { background: #F3E5F5; color: #6A1B9A; }
.trip-cost { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

/* Single trip */
.trip-show-emoji { font-size: 1.5rem; }
.trip-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; font-size: 0.85rem; color: var(--text-muted); }
.trip-meta-item { display: flex; align-items: center; gap: 4px; }
.trip-total-cost { font-weight: 600; color: var(--primary-dark); }
.trip-description { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 20px; padding: 12px; background: var(--bg); border-radius: var(--radius-sm); }
.status-select {
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
}

/* Trip items / itinerary */
.trip-date-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 16px 0 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.trip-item {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.trip-item:hover { background: rgba(232,213,208,0.15); }
.trip-item-type-icon { font-size: 1.2rem; flex-shrink: 0; padding-top: 2px; }
.trip-item-body { flex: 1; min-width: 0; }
.trip-item-header { display: flex; align-items: baseline; gap: 8px; }
.trip-item-header strong { font-size: 0.9rem; }
.trip-item-header time { font-size: 0.75rem; color: var(--text-muted); }
.trip-item-details { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.trip-item-meta { display: flex; gap: 8px; margin-top: 4px; }
.trip-item-cost { font-size: 0.75rem; font-weight: 600; color: var(--accent); }
.booked-badge { font-size: 0.65rem; background: var(--success); color: #fff; padding: 1px 6px; border-radius: 8px; font-weight: 600; }
.trip-item-actions { display: flex; gap: 4px; align-items: flex-start; flex-shrink: 0; }
.item-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.item-edit-btn:hover { color: var(--primary); }

/* Add trip item section */
.add-trip-item-section {
  margin-top: 24px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.add-trip-item-section h3 { margin-bottom: 12px; font-size: 0.9rem; }
.add-trip-item-section .form-group { margin-bottom: 10px; }

/* ── Hidden Utility ──────────────────────── */
.hidden { display: none !important; }

/* ── Editable Title ──────────────────────── */
.editable-title {
  outline: none;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background var(--transition);
}
.editable-title:focus { background: var(--primary-light); }

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 767px) {
  .top-nav { display: none; }
  .bottom-nav { display: flex; }
  .main-content { padding: 16px 14px 84px; }
  h1 { font-size: 1.25rem; }
  .page-header { margin-bottom: 14px; }
  .lists-grid, .trips-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; gap: 8px; }
  .modal { padding: 20px 16px; max-width: 100%; border-radius: 16px 16px 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .page-actions { width: 100%; justify-content: flex-end; }
  .trip-meta { gap: 10px; font-size: 0.8rem; }
  .add-trip-item-section { padding: 12px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .main-content { max-width: 720px; }
}

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

/* ── Minimal Page (auth, errors) ─────────── */
.minimal-page {
  background: var(--bg);
}
