/* ============================================
   FAMILY DASHBOARD - Warm Modern Scandinavian
   A cozy, inviting design for daily family life
   ============================================ */

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

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

:root {
  /* Warm base palette */
  --color-cream: #FAF7F2;
  --color-cream-dark: #F0EBE3;
  --color-white: #FFFFFF;
  --color-ink: #1C1917;
  --color-ink-soft: #44403C;
  --color-ink-muted: #78716C;
  --color-stone: #D6D3D1;
  --color-stone-light: #E7E5E4;

  /* Family member colors - warm and distinctive */
  --color-james: #2563EB;
  --color-james-soft: #DBEAFE;
  --color-james-glow: rgba(37, 99, 235, 0.15);

  --color-katy: #C2410C;
  --color-katy-soft: #FFEDD5;
  --color-katy-glow: rgba(194, 65, 12, 0.15);

  --color-lottie: #DB2777;
  --color-lottie-soft: #FCE7F3;
  --color-lottie-glow: rgba(219, 39, 119, 0.15);

  --color-all: #059669;
  --color-all-soft: #D1FAE5;
  --color-all-glow: rgba(5, 150, 105, 0.15);

  /* Accent */
  --color-gold: #D97706;
  --color-gold-soft: #FEF3C7;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;

  /* Shadows - soft and warm */
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.06), 0 1px 3px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 12px 32px rgba(28, 25, 23, 0.08), 0 4px 8px rgba(28, 25, 23, 0.04);
  --shadow-glow: 0 0 0 4px;

  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--color-cream);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain texture overlay */
#app::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 1000;
}

#app {
  display: grid;
  grid-template-rows: 280px 140px 160px 380px 1fr 180px;
  height: 100%;
  width: 100%;
  padding: 24px;
  gap: 20px;
}

/* ============================================
   PHOTO HEADER
   ============================================ */
.photo-header {
  position: relative;
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.photo-header img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out-expo);
}

.photo-header:active img {
  transform: scale(1.02);
}

.photo-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(
    to top,
    rgba(250, 247, 242, 0.95) 0%,
    rgba(250, 247, 242, 0.6) 40%,
    transparent 100%
  );
  pointer-events: none;
}

/* ============================================
   TIME & DATE
   ============================================ */
.time-date {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 32px;
  padding: 16px 0;
}

.time {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.date {
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 500;
  color: var(--color-ink-soft);
  letter-spacing: 0.01em;
}

/* ============================================
   WEATHER
   ============================================ */
.weather {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.weather-day {
  background: var(--color-white);
  border-radius: 24px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s ease;
}

.weather-day:first-child {
  background: linear-gradient(135deg, var(--color-gold-soft) 0%, var(--color-white) 100%);
  border: 2px solid var(--color-gold);
}

.weather-day:active {
  transform: scale(0.97);
}

.weather-day .label {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.weather-day:first-child .label {
  color: var(--color-gold);
}

.weather-day .icon {
  font-size: 52px;
  margin: 8px 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.weather-day .temp {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 500;
  color: var(--color-ink);
  line-height: 1.1;
}

.weather-day .range {
  font-size: 14px;
  color: var(--color-ink-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ============================================
   CALENDAR
   ============================================ */
.calendar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calendar-tabs {
  display: flex;
  gap: 10px;
  padding: 6px;
  background: var(--color-cream-dark);
  border-radius: 20px;
}

.calendar-tab {
  flex: 1;
  padding: 14px 16px;
  background: transparent;
  border: none;
  border-radius: 14px;
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s var(--ease-out-expo);
  position: relative;
}

.calendar-tab:active {
  transform: scale(0.96);
}

.calendar-tab.active {
  background: var(--color-white);
  color: var(--color-james);
  box-shadow: var(--shadow-md), var(--shadow-glow) var(--color-james-glow);
}

.calendar-tab[data-person="katy"].active {
  color: var(--color-katy);
  box-shadow: var(--shadow-md), var(--shadow-glow) var(--color-katy-glow);
}

.calendar-tab[data-person="lottie"].active {
  color: var(--color-lottie);
  box-shadow: var(--shadow-md), var(--shadow-glow) var(--color-lottie-glow);
}

.calendar-tab[data-person="all"].active {
  color: var(--color-all);
  box-shadow: var(--shadow-md), var(--shadow-glow) var(--color-all-glow);
}

.calendar-events {
  flex: 1;
  background: var(--color-white);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-md);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar */
.calendar-events::-webkit-scrollbar,
.list-items::-webkit-scrollbar {
  width: 6px;
}

.calendar-events::-webkit-scrollbar-track,
.list-items::-webkit-scrollbar-track {
  background: transparent;
}

.calendar-events::-webkit-scrollbar-thumb,
.list-items::-webkit-scrollbar-thumb {
  background: var(--color-stone);
  border-radius: 3px;
}

.event {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  margin: 0 -8px;
  border-radius: 16px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.event:active {
  background: var(--color-cream);
}

.event + .event {
  border-top: 1px solid var(--color-stone-light);
}

.event-time {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink-muted);
  width: 60px;
  flex-shrink: 0;
  padding-top: 2px;
}

.event-title {
  font-size: 19px;
  font-weight: 500;
  color: var(--color-ink);
  line-height: 1.4;
}

.empty, .loading {
  color: var(--color-ink-muted);
  font-size: 16px;
  text-align: center;
  padding: 32px 16px;
  font-style: italic;
}

/* ============================================
   SHOPPING & TODO LISTS
   ============================================ */
.lists-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.list-panel {
  background: var(--color-white);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-stone-light);
}

.list-header span {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--color-ink);
}

.list-items {
  flex: 1;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  margin: 0 -12px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-ink);
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  min-height: 52px;
}

.list-item:active {
  background: var(--color-cream);
  transform: scale(0.98);
}

.list-item + .list-item {
  border-top: 1px solid var(--color-stone-light);
}

.list-item.checked {
  color: var(--color-ink-muted);
}

.list-item.checked span:last-child {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.checkbox {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--color-stone);
  border-radius: 8px;
  flex-shrink: 0;
  transition: all 0.2s var(--ease-spring);
  position: relative;
}

.list-item:active .checkbox {
  transform: scale(0.9);
}

.list-item.checked .checkbox {
  background: var(--color-all);
  border-color: var(--color-all);
}

.list-item.checked .checkbox::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 12px;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Add buttons */
.add-button {
  width: 100%;
  padding: 16px;
  margin-top: 12px;
  background: var(--color-cream);
  border: none;
  border-radius: 14px;
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  min-height: 52px;
}

.add-button:active {
  background: var(--color-cream-dark);
  transform: scale(0.97);
}

.calendar-section .add-button {
  margin-top: 12px;
  background: var(--color-white);
  border: 2px dashed var(--color-stone);
  border-radius: 16px;
}

/* ============================================
   CATALAN WORD OF THE DAY
   ============================================ */
.catalan-word {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 50%, #FCD34D 100%);
  border-radius: 28px;
  padding: 28px 32px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

/* Decorative element */
.catalan-word::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
}

.catalan-word::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: -20px;
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.catalan-word .label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.catalan-word .word {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.catalan-word .translation {
  font-size: 24px;
  font-weight: 500;
  color: var(--color-ink-soft);
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.catalan-word .example {
  font-size: 17px;
  font-style: italic;
  color: var(--color-ink-soft);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s var(--ease-out-expo);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--color-white);
  border-radius: 32px;
  padding: 36px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 24px 64px rgba(28, 25, 23, 0.2);
  animation: slideUp 0.4s var(--ease-spring);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  color: var(--color-ink);
  margin-bottom: 24px;
  text-align: center;
}

.modal input {
  width: 100%;
  padding: 18px 20px;
  font-family: var(--font-body);
  font-size: 18px;
  background: var(--color-cream);
  border: 2px solid transparent;
  border-radius: 16px;
  color: var(--color-ink);
  margin-bottom: 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.modal input:focus {
  border-color: var(--color-james);
  box-shadow: 0 0 0 4px var(--color-james-glow);
}

.modal input::placeholder {
  color: var(--color-ink-muted);
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-buttons button {
  flex: 1;
  padding: 18px 24px;
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  min-height: 58px;
}

.modal-buttons button:active {
  transform: scale(0.97);
}

.modal-buttons .cancel {
  background: var(--color-cream);
  color: var(--color-ink-soft);
}

.modal-buttons .cancel:active {
  background: var(--color-cream-dark);
}

.modal-buttons .confirm {
  background: var(--color-james);
  color: white;
  box-shadow: 0 4px 12px var(--color-james-glow);
}

.modal-buttons .confirm:active {
  background: #1D4ED8;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.loading::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-stone);
  border-top-color: var(--color-ink-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============================================
   ANIMATIONS & TRANSITIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.event,
.list-item {
  animation: fadeInUp 0.4s var(--ease-out-expo) backwards;
}

.event:nth-child(1), .list-item:nth-child(1) { animation-delay: 0ms; }
.event:nth-child(2), .list-item:nth-child(2) { animation-delay: 50ms; }
.event:nth-child(3), .list-item:nth-child(3) { animation-delay: 100ms; }
.event:nth-child(4), .list-item:nth-child(4) { animation-delay: 150ms; }
.event:nth-child(5), .list-item:nth-child(5) { animation-delay: 200ms; }
.event:nth-child(6), .list-item:nth-child(6) { animation-delay: 250ms; }
.event:nth-child(7), .list-item:nth-child(7) { animation-delay: 300ms; }
.event:nth-child(8), .list-item:nth-child(8) { animation-delay: 350ms; }
