/* ===========================
   Helper Expense App — Style
   =========================== */

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

:root {
  --bg: #FFF8F3;
  --card-bg: #FFFFFF;
  --primary: #FF8FAB;
  --primary-dark: #e8708f;
  --laarnie: #A8D8EA;
  --laarnie-dark: #7bc4de;
  --sandra: #98D8AA;
  --sandra-dark: #6fc888;
  --dad: #7B9EFF;
  --mom: #FF9A9E;
  --text: #2D2D2D;
  --text-light: #888;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-full: 50%;
}

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

body {
  font-family: 'Nunito', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}
@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes slideDown {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(100%); opacity: 0; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-up { animation: fadeUp 0.35s ease-out both; }
.animate-shake { animation: shake 0.4s ease-out; }
.animate-pop { animation: pop 0.3s ease-out both; }
.animate-slide-up { animation: slideUp 0.3s ease-out both; }

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
}
.header h1 {
  font-size: 22px;
  font-weight: 800;
}
.back-btn, .icon-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background 0.15s;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  line-height: 1;
}
.back-btn:hover, .icon-btn:hover { background: rgba(0,0,0,0.06); }

/* ---- Login ---- */
.login-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 0;
}
.login-logo {
  font-size: 52px;
  margin-bottom: 4px;
  animation: pop 0.5s ease-out both;
}
.login-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px;
  text-align: center;
}
.login-sub {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
  text-align: center;
}
.pin-dots {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
}
.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid #ccc;
  transition: all 0.15s;
}
.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}
.pin-dots.error .pin-dot {
  border-color: #ff4d4d;
  background: #ff4d4d;
}
.pin-error {
  color: #ff4d4d;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  height: 18px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 300px;
}
.key {
  height: 56px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  font-size: 24px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.key:active { transform: scale(0.94); box-shadow: none; }
.key.special { font-size: 16px; color: var(--text-light); }
.key.delete { font-size: 20px; }

/* ---- Home ---- */
.home-hero {
  text-align: center;
  padding: 24px 0 32px;
  animation: fadeUp 0.4s ease-out both;
}
.home-hero .emoji { font-size: 48px; }
.home-hero h2 { font-size: 26px; font-weight: 800; margin-top: 8px; }
.home-hero p { color: var(--text-light); font-size: 14px; margin-top: 4px; }

.helper-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 80px;
}
.helper-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  border: 3px solid transparent;
}
.helper-card:nth-child(1) { animation: fadeUp 0.4s 0.1s ease-out both; }
.helper-card:nth-child(2) { animation: fadeUp 0.4s 0.2s ease-out both; }
.helper-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.helper-card:active { transform: scale(0.98); }
.helper-card.laarnie { border-color: var(--laarnie); }
.helper-card.sandra { border-color: var(--sandra); }
.helper-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}
.laarnie .helper-avatar { background: var(--laarnie); }
.sandra .helper-avatar { background: var(--sandra); }
.helper-info { flex: 1; }
.helper-name { font-size: 20px; font-weight: 700; }
.helper-last {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}
.helper-month {
  font-size: 13px;
  color: var(--text-light);
}
.helper-month strong {
  color: var(--text);
  font-size: 15px;
}
.helper-arrow { font-size: 22px; color: #ccc; }

/* ---- Settings ---- */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 80px;
}
.settings-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
}
.settings-item:hover { background: #f5f0eb; }
.settings-item .icon { font-size: 24px; }
.settings-item .arrow { margin-left: auto; color: #ccc; }
.settings-item.danger { color: #e74c3c; }
.settings-item.danger .icon { color: #e74c3c; }

/* ---- Helper Page ---- */
.helper-page-header {
  text-align: center;
  padding: 16px 0 24px;
  animation: fadeUp 0.35s ease-out both;
}
.helper-page-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 8px;
}
.helper-page-name { font-size: 26px; font-weight: 800; }
.helper-page-sub { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.summary-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 10px;
  text-align: center;
  animation: fadeUp 0.35s ease-out both;
}
.summary-card:nth-child(1) { animation-delay: 0.05s; }
.summary-card:nth-child(2) { animation-delay: 0.1s; }
.summary-card:nth-child(3) { animation-delay: 0.15s; }
.summary-label { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.summary-value { font-size: 18px; font-weight: 800; margin-top: 4px; }
.summary-value.green { color: #27ae60; }

.expense-list-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.expense-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 100px;
}
.expense-item {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  animation: fadeUp 0.3s ease-out both;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.expense-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.laarnie-bg { background: rgba(168,216,234,0.3); }
.sandra-bg { background: rgba(152,216,170,0.3); }
.expense-body { flex: 1; min-width: 0; }
.expense-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.expense-amount { font-size: 18px; font-weight: 800; }
.expense-note { font-size: 13px; color: var(--text-light); flex: 1; }
.expense-date { font-size: 12px; color: var(--text-light); }
.expense-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.paid-by {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.paid-by.dad { background: rgba(123,158,255,0.2); color: var(--dad); }
.paid-by.mom { background: rgba(255,154,158,0.2); color: #e05c62; }
.change-badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(39,174,96,0.15);
  color: #27ae60;
  font-weight: 600;
}
.delete-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
  color: #ccc;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.delete-btn:hover { background: #fee; color: #e74c3c; }

.empty-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-light);
}
.empty-state .emoji { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ---- FAB ---- */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  box-shadow: 0 4px 16px rgba(255,143,171,0.4);
  font-size: 30px;
  color: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(255,143,171,0.5); }
.fab:active { transform: scale(0.94); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease-out both;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px 40px;
  animation: slideUp 0.3s ease-out both;
}
.modal.closing { animation: slideDown 0.25s ease-out both; }
.modal-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 0 auto 20px;
}
.modal-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
}
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #eee;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus { border-color: var(--primary); }
.form-input.error { border-color: #e74c3c; }

.toggle-group {
  display: flex;
  gap: 10px;
}
.toggle-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 2px solid #eee;
  background: var(--bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
}
.toggle-btn.active {
  border-color: var(--primary);
  background: rgba(255,143,171,0.12);
  color: var(--primary-dark);
}
.btn-primary {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.1s, background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-cancel {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
}
.btn-cancel:hover { color: var(--text); }

/* ---- Loading ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  flex-direction: column;
  gap: 16px;
}
.loading-emoji { font-size: 48px; animation: pop 0.5s ease-out infinite alternate; }
.loading-text { font-size: 16px; font-weight: 600; color: var(--text-light); }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: #2D2D2D;
  color: white;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  z-index: 300;
  animation: fadeUp 0.3s ease-out both;
  white-space: nowrap;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ---- Settings page specific ---- */
.settings-header {
  text-align: center;
  padding: 32px 0 24px;
}
.settings-header .icon { font-size: 48px; display: block; margin-bottom: 8px; }
.settings-header h2 { font-size: 24px; font-weight: 800; }
.settings-header p { font-size: 14px; color: var(--text-light); margin-top: 4px; }
