/* FamApp — app.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Serif+Display&display=swap');

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

:root {
  --bg:        #0d0d1f;
  --bg2:       #1a1a2e;
  --bg3:       #f5f4f0;
  --purple:    #6c63ff;
  --green:     #2d8a2d;
  --orange:    #c47000;
  --blue:      #1e3a8a;
  --pink:      #831843;
  --teal:      #0f4c75;
  --white:     #ffffff;
  --text:      #1a1a2e;
  --muted:     #888;
  --border:    #f0f0f0;
  --radius:    18px;
  --radius-sm: 12px;
  --safe-top:  env(safe-area-inset-top, 0px);
  --safe-bot:  env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--white);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---- SCREENS ---- */
.screen {
  display: none;
  flex-direction: column;
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
}
.screen.active { display: flex; }
.screen.slide-in  { animation: slideIn  0.25s ease both; }
.screen.slide-out { animation: slideOut 0.25s ease both; }
@keyframes slideIn  { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideOut { from { transform: translateX(0); }   to { transform: translateX(-30%); opacity: 0; } }

/* ---- LOGIN ---- */
.login-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 48px) 24px calc(var(--safe-bot) + 24px);
  overflow-y: auto;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.logo-box {
  width: 84px; height: 84px; border-radius: 24px;
  background: var(--purple);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 40px; margin-bottom: 16px;
}
.app-name    { font-family: 'DM Serif Display', serif; font-size: 28px; letter-spacing: -0.5px; }
.app-tagline { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 6px; }
.login-btns  { display: flex; flex-direction: column; gap: 12px; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: white; border: none; border-radius: 16px; padding: 14px;
  font-size: 14px; font-weight: 600; color: #1a1a2e; cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.btn-bio {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px; padding: 14px; font-size: 14px; font-weight: 600;
  color: white; cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.divider {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.2); font-size: 11px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.1); }
.email-form { display: flex; flex-direction: column; gap: 10px; }
.field-input {
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px; padding: 14px 16px; color: white; font-size: 14px;
  font-family: 'DM Sans', sans-serif; outline: none; width: 100%;
}
.field-input::placeholder { color: rgba(255,255,255,0.25); }
.field-input:focus { border-color: rgba(108,99,255,0.6); }
.btn-primary {
  background: var(--purple); border: none; border-radius: 16px; padding: 15px;
  font-size: 15px; font-weight: 600; color: white; cursor: pointer;
  font-family: 'DM Sans', sans-serif; width: 100%;
}
.btn-primary:active { opacity: 0.85; }
.form-links {
  display: flex; justify-content: space-between;
  font-size: 12px; color: rgba(255,255,255,0.35);
}
.form-links span { cursor: pointer; }
.form-links span:last-child { color: rgba(108,99,255,0.8); }
.form-error {
  font-size: 12px; color: #f87171;
  background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.2);
  border-radius: 10px; padding: 8px 12px; display: none;
}
.form-error.show { display: block; }
.terms { font-size: 10px; color: rgba(255,255,255,0.2); text-align: center; margin-top: 20px; line-height: 1.6; }

/* ---- STATUS BAR ---- */
.status-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--safe-top) + 14px) 22px 0;
  font-size: 12px; font-weight: 500; color: white;
  background: var(--bg2); flex-shrink: 0;
}
.sb-icons { display: flex; gap: 6px; font-size: 10px; }

/* ---- HOME HEADER ---- */
.home-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 22px 8px; background: var(--bg2); flex-shrink: 0;
}
.greeting { font-family: 'DM Serif Display', serif; font-size: 22px; }
.home-date { font-size: 12px; color: rgba(255,255,255,0.45); margin-top: 2px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), #e96c8a);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; cursor: pointer;
}

/* ---- HOME SEARCH ---- */
.home-search {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 18px 12px; background: rgba(255,255,255,0.07);
  border-radius: 14px; padding: 10px 16px; border: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.home-search input {
  background: transparent; border: none; outline: none;
  color: white; font-size: 13px; font-family: 'DM Sans', sans-serif; flex: 1;
}
.home-search input::placeholder { color: rgba(255,255,255,0.3); }

/* ---- SECTION LABEL ---- */
.section-label {
  padding: 0 22px 8px;
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.4);
  letter-spacing: 0.8px; text-transform: uppercase; flex-shrink: 0;
}

/* ---- TILES GRID ---- */
.tiles-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; padding: 0 16px; overflow-y: auto;
  flex: 1;
}
.tile {
  border-radius: 22px; padding: 18px 16px 16px;
  cursor: pointer; border: none; text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 120px; position: relative; overflow: hidden;
  transition: transform 0.12s;
}
.tile:active { transform: scale(0.96); }
.tile-icon  { font-size: 28px; margin-bottom: 8px; }
.tile-title { font-size: 13px; font-weight: 700; line-height: 1.2; }
.tile-meta  { font-size: 10px; opacity: 0.65; margin-top: 3px; }
.tile-count {
  position: absolute; top: 12px; right: 12px;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
}

.t-notes  { background: #1a1a2e; color: white; }
.t-notes  .tile-count { background: var(--purple); }
.t-shop   { background: #fff5e6; color: #7a4400; }
.t-shop   .tile-count { background: var(--orange); color: white; }
.t-cal    { background: #e8f4e8; color: #1a4a1a; }
.t-cal    .tile-count { background: var(--green); }
.t-docs   { background: #eef2ff; color: #1e3a8a; }
.t-docs   .tile-count { background: #4f46e5; }
.t-tasks  { background: #f0eeff; color: #3730a3; }
.t-tasks  .tile-count { background: var(--purple); }
.t-teams  { background: #f0fdf4; color: #14532d; }
.t-teams  .tile-count { background: #16a34a; }

/* ---- POINTS BANNER ---- */
.points-banner {
  display: flex; gap: 0; margin: 12px 16px 16px;
  background: rgba(255,255,255,0.06); border-radius: 16px;
  overflow: hidden; cursor: pointer; flex-shrink: 0;
}
.pb-item {
  flex: 1; padding: 12px 8px; text-align: center;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.pb-item:last-child { border-right: none; }
.pb-val { font-size: 15px; font-weight: 700; color: white; }
.pb-lbl { font-size: 9px; color: rgba(255,255,255,0.35); margin-top: 2px; }

/* ---- MODULE SCREEN HEADER ---- */
.screen-hdr {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 14px) 18px 12px;
  flex-shrink: 0;
}
.back-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.15); display: flex; align-items: center;
  justify-content: center; color: white; cursor: pointer;
  font-size: 16px; border: none; flex-shrink: 0;
}
.screen-title { font-family: 'DM Serif Display', serif; font-size: 20px; color: white; }
.screen-sub   { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }
.hdr-btn {
  margin-left: auto; background: rgba(255,255,255,0.15); border: none;
  color: white; border-radius: 10px; padding: 6px 14px;
  font-size: 12px; font-weight: 600; font-family: 'DM Sans', sans-serif; cursor: pointer;
}

/* ---- MODULE BODY ---- */
.module-body {
  flex: 1; overflow-y: auto; background: var(--bg3);
  border-radius: 28px 28px 0 0; padding: 16px 14px 100px;
}

/* ---- CARDS ---- */
.card {
  background: white; border-radius: 16px; padding: 14px 16px;
  margin-bottom: 8px; border: 1px solid var(--border);
  cursor: pointer; transition: transform 0.1s;
}
.card:active { transform: scale(0.98); }
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---- FAB ---- */
.fab {
  position: absolute; bottom: calc(var(--safe-bot) + 24px); right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: white; border: none; cursor: pointer;
  z-index: 10; transition: transform 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.fab:active { transform: scale(0.9); }

/* ---- MODAL ---- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 100; display: flex; align-items: flex-end;
  border-radius: 0;
}
.modal-box {
  background: var(--bg2); border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(var(--safe-bot) + 28px); width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal-title { font-size: 16px; font-weight: 700; color: white; margin-bottom: 4px; }
.modal-sub   { font-size: 12px; color: rgba(255,255,255,0.4); margin-bottom: 16px; }
.modal-input {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 12px 14px; color: white; font-size: 13px;
  font-family: 'DM Sans', sans-serif; width: 100%; outline: none; margin-bottom: 10px;
}
.modal-input::placeholder { color: rgba(255,255,255,0.25); }
.modal-select {
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 12px 14px; color: white; font-size: 13px;
  font-family: 'DM Sans', sans-serif; width: 100%; outline: none;
  margin-bottom: 10px; appearance: none;
}
.modal-select option { background: var(--bg2); }
.modal-label {
  font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 5px; display: block;
}
.modal-btns { display: flex; gap: 8px; margin-top: 8px; }
.mb {
  flex: 1; padding: 12px; border-radius: 12px; font-size: 13px;
  font-weight: 700; cursor: pointer; border: none; font-family: 'DM Sans', sans-serif;
}
.mb.cancel { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.6); }
.mb.confirm { background: var(--purple); color: white; }
.mb.danger  { background: #e24b4a; color: white; }
.mb.green   { background: var(--green); color: white; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: calc(var(--safe-bot) + 80px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg2); color: white; padding: 10px 20px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
  white-space: nowrap; z-index: 200; max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; }

/* ---- LOADING ---- */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 150; display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--purple); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center; padding: 60px 30px; color: var(--muted);
}
.empty-icon { font-size: 48px; margin-bottom: 14px; }
.empty-text { font-size: 14px; line-height: 1.6; }

/* ---- SECTION HEADER IN MODULE ---- */
.mod-sec { font-size: 10px; font-weight: 600; color: #aaa; letter-spacing: 0.7px;
           text-transform: uppercase; margin: 12px 2px 7px;
           display: flex; align-items: center; gap: 6px; }
.mod-sec span { flex: 1; height: 1px; background: #e8e8e8; }

/* ---- BADGE ---- */
.badge {
  font-size: 9px; font-weight: 700; padding: 2px 8px;
  border-radius: 6px; display: inline-block;
}

/* ---- TASK SPECIFIC ---- */
.task-card { border-left: 3px solid transparent; }
.task-chk {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ddd;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; font-size: 11px; color: white;
  transition: all 0.2s;
}
.task-chk.done-full { background: var(--green); border-color: var(--green); }
.task-chk.done-half { background: #f59e0b; border-color: #f59e0b; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 0; }

/* ---- SAFE AREA ---- */
.safe-bottom { padding-bottom: calc(var(--safe-bot) + 16px); }
