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

:root {
  --pink: #e91e8c;
  --pink-soft: #ff6eb0;
  --bg: #0f0f14;
  --bg2: #16161e;
  --bg3: #1e1e2a;
  --border: #2a2a3a;
  --text: #f0eef8;
  --text2: #8b8a9e;
  --success: #2dd4a0;
  --danger: #ff4e6a;
  --warning: #f5a623;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overscroll-behavior: none;
}

/* ====== LOGIN ====== */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0%, rgba(233,30,140,0.15) 0%, transparent 60%);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-heart {
  font-size: 56px;
  margin-bottom: 16px;
  display: block;
  animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.login-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text2);
  margin-bottom: 32px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input, select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 12px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--pink);
}

textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--pink);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--pink-soft); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--pink); color: var(--text); }

.btn-danger {
  background: rgba(255,78,106,0.15);
  color: var(--danger);
  border: 1px solid rgba(255,78,106,0.3);
}

.btn-success {
  background: rgba(45,212,160,0.15);
  color: var(--success);
  border: 1px solid rgba(45,212,160,0.3);
}

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 8px; border-radius: 10px; }

.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
}

/* ====== APP LAYOUT ====== */
#app { display: none; min-height: 100vh; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.app-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--pink);
}

.user-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text2);
}

/* ====== NAV ====== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 10px;
  gap: 3px;
  border: none;
  background: none;
  transition: color 0.2s;
}

.nav-item .nav-icon { font-size: 22px; line-height: 1; }
.nav-item.active { color: var(--pink); }
.nav-item:hover { color: var(--text); }

/* ====== PAGES ====== */
.page { display: none; padding: 16px; padding-bottom: 80px; }
.page.active { display: block; }

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ====== CARDS ====== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ====== SHOPPING LIST ====== */
.add-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.add-form input { 
  flex: 1; 
  width: auto;
  min-width: 0;
}
.add-form .btn { width: auto; flex-shrink: 0; }

.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
  transition: opacity 0.3s;
}

.shopping-item.checked {
  opacity: 0.5;
}

.shopping-item.checked .item-text {
  text-decoration: line-through;
  color: var(--text2);
}

.checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.item-text { flex: 1; font-size: 15px; }
.item-meta { font-size: 11px; color: var(--text2); }

.delete-btn {
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  transition: color 0.2s;
  line-height: 1;
}
.delete-btn:hover { color: var(--danger); }

/* ====== CALENDAR ====== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 20px;
}

.cal-day-name {
  text-align: center;
  font-size: 11px;
  color: var(--text2);
  padding: 4px;
  font-weight: 500;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
}

.cal-day:hover { background: var(--bg3); }
.cal-day.today { background: var(--bg3); color: var(--pink); font-weight: 700; }
.cal-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--pink);
}
.cal-day.other-month { color: var(--text2); opacity: 0.4; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-nav h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
}

.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg3);
  border-radius: 12px;
  margin-bottom: 8px;
}

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

.event-info { flex: 1; }
.event-title { font-size: 14px; font-weight: 500; }
.event-date { font-size: 12px; color: var(--text2); }

/* ====== MODAL ====== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 24px 24px 16px 16px;
  padding: 28px 24px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn { flex: 1; }

/* ====== WISHLIST ====== */
.wish-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  transition: opacity 0.3s;
}

.wish-card.bought { opacity: 0.5; }

.wish-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wish-price {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
}

.wish-desc { font-size: 13px; color: var(--text2); margin: 4px 0; }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--bg3);
  padding: 4px;
  border-radius: 12px;
}

.tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ====== COUNTDOWNS ====== */
.countdown-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  text-align: center;
}

.countdown-emoji { font-size: 40px; margin-bottom: 8px; }
.countdown-title { font-family: 'Playfair Display', serif; font-size: 18px; }
.countdown-days { font-size: 40px; font-weight: 700; color: var(--pink); line-height: 1; margin: 8px 0; }
.countdown-label { font-size: 12px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.1em; }
.countdown-date { font-size: 13px; color: var(--text2); margin-top: 6px; }

/* ====== EXPENSES ====== */
.expense-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

.stat-name { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.stat-amount { font-size: 22px; font-weight: 700; color: var(--pink); }

.expense-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
}

.expense-category {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
}

.expense-amount {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
  white-space: nowrap;
}

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

.photo-item {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

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

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

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

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

.photo-viewer {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 300;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.photo-viewer.open { display: flex; }
.photo-viewer img { max-width: 90vw; max-height: 70vh; border-radius: 12px; }
.photo-viewer-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
}

/* ====== NOTES ====== */
.notes-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 200px;
  font-size: 15px;
  line-height: 1.6;
}

.notes-saved {
  font-size: 12px;
  color: var(--success);
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.5s;
}

/* ====== HOME ====== */
.home-greeting {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  margin-bottom: 4px;
}

.home-date {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 24px;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.home-widget {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.home-widget:hover { border-color: var(--pink); }
.home-widget-icon { font-size: 28px; margin-bottom: 8px; }
.home-widget-title { font-size: 13px; font-weight: 500; }
.home-widget-count { font-size: 22px; font-weight: 700; color: var(--pink); margin-top: 4px; }

.home-countdown {
  background: linear-gradient(135deg, rgba(233,30,140,0.15), rgba(255,110,176,0.1));
  border: 1px solid rgba(233,30,140,0.3);
  border-radius: 20px;
  padding: 20px;
  text-align: center;
}

/* ====== RECIPE DETAIL ====== */
.recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recipe-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
}
.recipe-card:hover { border-color: var(--pink); }
.recipe-card img { width: 100%; height: 120px; object-fit: cover; }
.recipe-card-body { padding: 12px; }
.recipe-card-title { font-size: 14px; font-weight: 500; }
.recipe-card-cat { font-size: 11px; color: var(--text2); margin-top: 2px; }

/* ====== UPLOAD AREA ====== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  color: var(--text2);
}
.upload-area:hover { border-color: var(--pink); color: var(--text); }
.upload-area input { display: none; }

/* ====== UTILS ====== */
.text-muted { color: var(--text2); }
.text-pink { color: var(--pink); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text2);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.section-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 10px;
  margin-top: 20px;
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.badge-pink { background: rgba(233,30,140,0.2); color: var(--pink); }
.badge-success { background: rgba(45,212,160,0.2); color: var(--success); }
