/* ──────────────────────────────────────────────────────────────
   KeluargaCare — "Rumah Hangat" Design System
   Aesthetic: Indonesian family warmth × modern healthcare precision
   Fonts: Fraunces (display) + Nunito (UI)
   Texture: Kawung batik circles at low opacity
────────────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --c-primary:        #C4622D;   /* terracotta */
  --c-primary-light:  #F7EDE4;
  --c-primary-mid:    #E8A882;
  --c-primary-dark:   #8B3E17;
  --c-secondary:      #1E5F4E;   /* deep teal */
  --c-secondary-light:#E3F2EE;
  --c-gold:           #C9850A;
  --c-gold-light:     #FDF0CC;
  --c-blue:           #2563EB;
  --c-blue-light:     #EFF6FF;
  --c-red:            #DC2626;

  /* Surface */
  --c-bg:             #FDF5EC;   /* warm cream */
  --c-surface:        #FFFAF5;   /* near-white with warmth */
  --c-border:         #EDE0D0;
  --c-border-strong:  #CEBB9A;

  /* Text */
  --c-text:           #1C1410;
  --c-text-2:         #6B5141;
  --c-text-3:         #A09178;

  /* Shadows — warm-toned, never cold gray */
  --shadow-sm:  0 1px 4px rgba(196,98,45,0.08);
  --shadow-md:  0 4px 16px rgba(196,98,45,0.10);
  --shadow-lg:  0 8px 32px rgba(196,98,45,0.12);

  /* Geometry */
  --r:  14px;
  --r-lg: 20px;
  --r-xl: 28px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Kawung batik texture ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Ccircle cx='40' cy='20' r='15' fill='none' stroke='%23C4622D' stroke-width='1'/%3E%3Ccircle cx='40' cy='60' r='15' fill='none' stroke='%23C4622D' stroke-width='1'/%3E%3Ccircle cx='20' cy='40' r='15' fill='none' stroke='%23C4622D' stroke-width='1'/%3E%3Ccircle cx='60' cy='40' r='15' fill='none' stroke='%23C4622D' stroke-width='1'/%3E%3C/svg%3E");
  opacity: 0.032;
  pointer-events: none;
  z-index: -1;
}

/* ── Container ── */
.app-container {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--c-bg);
  position: relative;
  overflow-x: hidden;
}

/* ── Cards ── */
.card {
  background: var(--c-surface);
  border-radius: var(--r);
  padding: 18px;
  border: 1.5px solid var(--c-border);
  box-shadow: var(--shadow-sm);
  position: relative;
}

/* ── Navigation bar ── */
.nav-bar {
  background: var(--c-surface);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1.5px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-back {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--c-primary-light);
  color: var(--c-primary);
  text-decoration: none;
  font-size: 18px;
  font-weight: 800;
  border: 1.5px solid #E8D0BE;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
.nav-back:active { transform: scale(0.93); }

.nav-title {
  font-weight: 800;
  font-size: 17px;
  color: var(--c-text);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.nav-subtitle { font-size: 12px; color: var(--c-text-2); font-weight: 600; }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--c-surface);
  border-top: 1.5px solid var(--c-border);
  display: flex;
  padding: 10px 6px 16px;
  z-index: 200;
  gap: 4px;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--c-text-3);
  font-size: 10px;
  font-weight: 700;
  padding: 7px 4px;
  border-radius: 12px;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.bottom-nav a.active {
  color: var(--c-primary);
  background: var(--c-primary-light);
}
.bottom-nav a svg { width: 22px; height: 22px; }

/* ── Loneliness ring ── */
.score-ring {
  position: relative;
  width: 100px;
  height: 100px;
}
.score-ring svg { transform: rotate(-90deg); }
.score-ring .score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* ── Avatar ── */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ── Badges ── */
.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: white;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  text-decoration: none;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.btn-primary {
  background: var(--c-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(196,98,45,0.32);
}
.btn-primary:active { transform: scale(0.97); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--c-primary);
  color: var(--c-primary);
}

.btn-full { width: 100%; }

/* ── Tasks ── */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1.5px solid var(--c-border);
}
.task-item:last-child { border-bottom: none; }

.task-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--c-border-strong);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.18s;
}
.task-checkbox.done {
  background: var(--c-secondary);
  border-color: var(--c-secondary);
}

/* ── Activity feed ── */
.feed-item {
  display: flex;
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1.5px solid var(--c-border);
}
.feed-item:last-child { border-bottom: none; }

.feed-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  background: var(--c-primary-light);
  border: 1.5px solid var(--c-border);
}

/* ── Elder large buttons ── */
.elder-btn {
  width: 100%;
  padding: 26px 24px;
  border-radius: var(--r-lg);
  border: none;
  font-size: 22px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: white;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  font-family: 'Plus Jakarta Sans', sans-serif;
  position: relative;
  overflow: hidden;
}
.elder-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
}
.elder-btn:active {
  transform: scale(0.975);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.elder-btn-icon {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: rgba(255,255,255,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.25);
}

/* ── Chat bubbles ── */
.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.chat-bubble.user {
  background: var(--c-primary);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  margin-left: auto;
}
.chat-bubble.assistant {
  background: var(--c-surface);
  color: var(--c-text);
  border-bottom-left-radius: 4px;
  border: 1.5px solid var(--c-border);
}

/* ── Mood buttons ── */
.mood-btn {
  flex: 1;
  padding: 20px 10px;
  border-radius: var(--r);
  border: 2px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.mood-btn:hover, .mood-btn.selected {
  border-color: var(--c-primary);
  background: var(--c-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.mood-emoji { font-size: 40px; }

/* ── Progress bar ── */
.progress-bar {
  height: 10px;
  background: var(--c-border);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-gold));
  border-radius: 100px;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── SOS button ── */
.sos-btn {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.4);
  background: #DC2626;
  color: white;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    0 0 0 10px rgba(220,38,38,0.18),
    0 0 0 22px rgba(220,38,38,0.08),
    0 12px 40px rgba(220,38,38,0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s;
  animation: sos-pulse 2.8s ease-in-out infinite;
  font-family: 'Plus Jakarta Sans', sans-serif;
  letter-spacing: 1px;
}
.sos-btn:active { transform: scale(0.95); }

@keyframes sos-pulse {
  0%   { box-shadow: 0 0 0 10px rgba(220,38,38,0.18), 0 0 0 22px rgba(220,38,38,0.08), 0 12px 40px rgba(220,38,38,0.45); }
  50%  { box-shadow: 0 0 0 16px rgba(220,38,38,0.12), 0 0 0 34px rgba(220,38,38,0.05), 0 12px 40px rgba(220,38,38,0.45); }
  100% { box-shadow: 0 0 0 10px rgba(220,38,38,0.18), 0 0 0 22px rgba(220,38,38,0.08), 0 12px 40px rgba(220,38,38,0.45); }
}

/* ── Page content ── */
.page-content {
  padding: 18px;
  padding-bottom: 90px;
}

/* ── Alert card ── */
.alert-card {
  background: #FFFBEB;
  border: 1.5px solid #F5D87A;
  border-radius: var(--r);
  padding: 15px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* ── Shift calendar ── */
.shift-day {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1.5px solid var(--c-border);
}
.shift-day:last-child { border-bottom: none; }
.shift-day-label { width: 60px; flex-shrink: 0; }
.shift-pill {
  flex: 1;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: white;
}

/* ── Stat chips ── */
.stat-chip {
  background: var(--c-primary-light);
  border-radius: var(--r);
  padding: 10px 12px;
  text-align: center;
  border: 1.5px solid var(--c-border);
}

/* ── Typing indicator ── */
.typing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-text-3);
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── Responsive ── */
@media (max-width: 430px) {
  .app-container { max-width: 100%; }
  .bottom-nav { max-width: 100%; }
}

/* ── Utility: entrance animation ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fade-up 0.45s ease-out forwards; }
.fade-up-2 { animation: fade-up 0.45s 0.08s ease-out both; }
.fade-up-3 { animation: fade-up 0.45s 0.16s ease-out both; }
.fade-up-4 { animation: fade-up 0.45s 0.24s ease-out both; }
.fade-up-5 { animation: fade-up 0.45s 0.32s ease-out both; }
