/* ============================================================
   Allmighty Hands — Client Tracker App Styles
   Design tokens match landing page: dark green, Space Grotesk
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500&display=swap');

:root {
  --bg: #0a0f0d;
  --bg-alt: #111916;
  --fg: #e8ede9;
  --fg-muted: #8a9b8e;
  --accent: #4ade80;
  --accent-dim: rgba(74, 222, 128, 0.12);
  --accent-hover: rgba(74, 222, 128, 0.2);
  --card-bg: #151d19;
  --card-border: rgba(74, 222, 128, 0.08);
  --card-border-hover: rgba(74, 222, 128, 0.25);
  --radius: 12px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.12);
  --success: #4ade80;
  --sidebar-w: 220px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-alt);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--card-border);
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent-dim);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 8px;
}
.sidebar-logo .brand {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.sidebar-logo .brand-sub {
  font-size: 11px;
  color: var(--fg-muted);
  font-weight: 400;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}
.nav-section {
  padding: 0 12px;
  margin-bottom: 4px;
}
.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: var(--accent-dim); color: var(--fg); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item .nav-icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }

/* ========== MAIN CONTENT ========== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--card-border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
}
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #0a0f0d;
}
.btn-primary:hover { background: #6ee7a0; }
.btn-secondary {
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover { border-color: var(--card-border-hover); background: var(--accent-dim); }
.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(248,113,113,0.2);
}
.btn-danger:hover { background: rgba(248,113,113,0.2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 8px; }

/* ========== PAGE CONTENT ========== */
.page { padding: 28px; display: none; }
.page.active { display: block; }

/* ========== STAT CARDS ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
}
.stat-card:hover { border-color: var(--card-border-hover); }
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-sub { font-size: 12px; color: var(--fg-muted); }

/* ========== SECTION HEADER ========== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}

/* ========== TABLE ========== */
.table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead tr {
  border-bottom: 1px solid var(--card-border);
}
th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--fg-muted);
}
td {
  padding: 13px 16px;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px solid rgba(74,222,128,0.04);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(74,222,128,0.03); }
.client-name { font-weight: 600; color: var(--fg); }
.client-name a { color: inherit; text-decoration: none; }
.client-name a:hover { color: var(--accent); }

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}
.badge-active { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(74,222,128,0.2); }
.badge-inactive { background: rgba(138,155,142,0.1); color: var(--fg-muted); border: 1px solid rgba(138,155,142,0.2); }
.badge-scheduled { background: rgba(96,165,250,0.12); color: #60a5fa; border: 1px solid rgba(96,165,250,0.2); }
.badge-completed { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(74,222,128,0.2); }
.badge-cancelled { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(248,113,113,0.2); }
.badge-outstanding { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(251,191,36,0.2); }
.badge-paid { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(74,222,128,0.2); }

/* ========== SCHEDULE CARDS ========== */
.schedule-list { display: flex; flex-direction: column; gap: 10px; }
.schedule-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color 0.2s;
}
.schedule-card:hover { border-color: var(--card-border-hover); }
.schedule-date-block {
  background: var(--accent-dim);
  border: 1px solid rgba(74,222,128,0.15);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  min-width: 52px;
  flex-shrink: 0;
}
.sched-day { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--accent); line-height: 1; }
.sched-mon { font-size: 11px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; margin-top: 2px; }
.schedule-info { flex: 1; }
.sched-client { font-weight: 600; font-size: 15px; color: var(--fg); }
.sched-address { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.sched-meta { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }
.schedule-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  display: none;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--fg-muted); cursor: pointer; font-size: 20px; padding: 4px; }
.modal-close:hover { color: var(--fg); }

/* ========== FORMS ========== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(74,222,128,0.4); }
select option { background: var(--card-bg); }
textarea { resize: vertical; min-height: 72px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--fg-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-family: var(--font-display); font-size: 15px; color: var(--fg); margin-bottom: 6px; }
.empty-sub { font-size: 13px; }

/* ========== CLIENT DETAIL ========== */
.detail-header {
  display: flex; gap: 20px; align-items: flex-start;
  margin-bottom: 24px;
}
.detail-avatar {
  width: 56px; height: 56px;
  background: var(--accent-dim);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.detail-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.detail-meta { font-size: 13px; color: var(--fg-muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; }
.detail-card-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--fg-muted); margin-bottom: 8px; }
.detail-card-value { font-size: 15px; color: var(--fg); }

/* ========== SEARCH ========== */
.search-bar {
  position: relative;
}
.search-bar input {
  padding-left: 36px;
  width: 240px;
}
.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  font-size: 14px;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(74,222,128,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(74,222,128,0.3); }

/* ========== LOADING ========== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(74,222,128,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-row td { color: var(--fg-muted); font-style: italic; }

/* ========== TOAST ========== */
#toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  color: var(--fg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.toast-success { border-color: rgba(74,222,128,0.3); }
#toast.toast-error { border-color: rgba(248,113,113,0.3); color: var(--danger); }

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
