/* App-specific styles on top of theme.css */

/* ---- NAV ---- */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-link {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover, .nav-link.active { background: var(--bg-warm); color: var(--fg); }
.nav-link.primary { background: var(--accent); color: #fff; }
.nav-link.primary:hover { background: var(--accent-light); }

/* ---- APP LAYOUT ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 60px;
}
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  padding: 24px 12px;
  position: fixed;
  top: 60px;
  bottom: 0;
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 8px; }
.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 12px 6px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-item:hover { background: var(--bg-warm); color: var(--fg); }
.sidebar-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.sidebar-icon { font-size: 16px; flex-shrink: 0; }
.main-content {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  max-width: calc(100vw - 220px);
  min-height: calc(100vh - 60px);
}

/* ---- PAGE HEADER ---- */
.page-header { margin-bottom: 28px; }
.page-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 4px;
}
.page-sub { color: var(--fg-muted); font-size: 15px; }

/* ---- CARDS ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
}
.card-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--fg);
  margin-bottom: 16px;
}

/* ---- HEALTH SCORE ---- */
.health-score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 6px solid;
  margin-right: 20px;
}
.health-score-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
}
.health-score-label { font-size: 11px; color: var(--fg-muted); }

/* ---- STATS ROW ---- */
.stats-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.stat-card-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 36px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 4px;
}
.stat-card-label { color: var(--fg-muted); font-size: 13px; }

/* ---- TASK LIST ---- */
.task-list { display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  transition: box-shadow 0.15s;
}
.task-item:hover { box-shadow: 0 2px 12px rgba(26,22,18,0.06); }
.task-item.overdue { border-left: 3px solid var(--red-muted); }
.task-item.upcoming { border-left: 3px solid var(--accent); }
.task-item.completed { opacity: 0.55; }
.task-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  background: var(--card-bg);
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.task-check:hover { border-color: var(--accent); }
.task-check.done { background: var(--green); border-color: var(--green); color: #fff; font-size: 13px; }
.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 500; font-size: 15px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-meta { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.task-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-high { background: var(--red-bg); color: var(--red-muted); }
.badge-medium { background: var(--accent-glow); color: var(--accent); }
.badge-low { background: var(--green-bg); color: var(--green); }
.badge-overdue { background: var(--red-bg); color: var(--red-muted); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary { background: var(--bg-warm); color: var(--fg); }
.btn-secondary:hover { background: #e8ddd4; }
.btn-ghost { background: transparent; color: var(--fg-muted); border: 1px solid var(--card-border); }
.btn-ghost:hover { background: var(--bg-warm); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: var(--red-bg); color: var(--red-muted); border: 1px solid rgba(158,74,74,0.2); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid rgba(26,22,18,0.15);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--fg);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,22,18,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(26,22,18,0.2);
}
.modal-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--fg);
  margin-bottom: 6px;
}
.modal-sub { color: var(--fg-muted); font-size: 14px; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ---- PROVIDER CARD ---- */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.provider-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.15s;
}
.provider-card:hover { box-shadow: 0 4px 20px rgba(26,22,18,0.08); }
.provider-name { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 16px; color: var(--fg); margin-bottom: 4px; }
.provider-category { font-size: 12px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.provider-rating { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--fg-muted); margin-bottom: 8px; }
.provider-phone { font-size: 14px; color: var(--accent); font-weight: 500; text-decoration: none; }
.star { color: #e8945a; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 60px 24px; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 20px; color: var(--fg); margin-bottom: 8px; }
.empty-sub { color: var(--fg-muted); font-size: 15px; margin-bottom: 24px; }

/* ---- LOADING ---- */
.loading { display: flex; align-items: center; justify-content: center; padding: 48px; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- TOAST ---- */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast-success { background: var(--green); }
.toast-error { background: var(--red-muted); }
.toast-info { background: var(--accent); }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ---- HOME SELECTOR ---- */
.home-selector {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-warm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  border: none;
  max-width: 180px;
}

/* ---- AUTH PAGE ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 8px 40px rgba(26,22,18,0.08);
}
.auth-brand { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 28px; color: var(--accent); text-align: center; margin-bottom: 8px; }
.auth-sub { color: var(--fg-muted); font-size: 14px; text-align: center; margin-bottom: 32px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--fg-muted); }
.auth-switch a { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }

/* ---- SYSTEM CHIPS ---- */
.system-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.system-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--bg-warm);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}
.system-chip-remove { cursor: pointer; color: var(--fg-muted); font-size: 16px; line-height: 1; }
.system-chip-remove:hover { color: var(--red-muted); }

/* ---- TABS ---- */
.tabs { display: flex; gap: 2px; background: var(--bg-warm); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 24px; }
.tab { flex: 1; padding: 8px; text-align: center; font-size: 14px; font-weight: 500; color: var(--fg-muted); cursor: pointer; border-radius: 8px; border: none; background: none; transition: background 0.15s, color 0.15s; }
.tab.active { background: var(--card-bg); color: var(--fg); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 20px; max-width: 100vw; }
  .form-row { grid-template-columns: 1fr; }
  .stats-row { flex-direction: column; }
}
