/* ============================================================
   SFTCRM — Light mode + toggle widget
   Only loaded when user switches from default dark mode.
   ============================================================ */

/* ── Light mode ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg:       #e7eaef;
  --surface:  #ffffff;
  --surface2: #eef1f5;
  --border:   #c7cdd7;
  --text:     #10131a;
  --muted:    #3f4857;
  --accent:   #0e7490;
  --accent2:  #0369a1;
  --danger:   #dc2626;
  --success:  #15803d;
  --warning:  #b45309;
}

[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="light"] .sidebar {
  background: #1a1f2e;
  border-right-color: #2d3748;
}

[data-theme="light"] ::-webkit-scrollbar-track { background: var(--bg); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }

[data-theme="light"] input[type=text],
[data-theme="light"] input[type=email],
[data-theme="light"] input[type=tel],
[data-theme="light"] input[type=password],
[data-theme="light"] input[type=number],
[data-theme="light"] input[type=date],
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] tr:hover td { background: rgba(0,0,0,0.02); }
[data-theme="light"] .modal-backdrop { background: rgba(0,0,0,0.45); }

[data-theme="light"] .login-page {
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(14,116,144,0.08) 0%, transparent 70%);
}

/* ── Dark mode re-assert (in case browser has no data-theme yet) ── */
[data-theme="dark"] {
  --bg:       #0e0f11;
  --surface:  #16181c;
  --surface2: #1e2027;
  --border:   #2a2d36;
  --text:     #e8eaf0;
  --muted:    #6b7280;
  --accent:   #22d3ee;
  --accent2:  #47c8ff;
  --danger:   #ff4757;
  --success:  #2ecc71;
  --warning:  #f39c12;
}

/* ── Toggle widget ──────────────────────────────────────────── */
.dark-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
  opacity: .7;
  transition: opacity .15s;
}
.dark-toggle:hover { opacity: 1; }

.toggle-track {
  width: 34px;
  height: 18px;
  background: #374151;
  border-radius: 9px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.dark-toggle.is-dark .toggle-track { background: var(--accent); }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.dark-toggle.is-dark .toggle-thumb { transform: translateX(16px); }

.toggle-icon { font-size: 12px; line-height: 1; }

/* ── Dark mode: blue menu + top bar (starfishhomes nav blue) ── */
[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar {
  background: #1f3d5c;
}
[data-theme="dark"] .sidebar {
  --muted: #9fb3c8;               /* readable grey-blue text on the blue menu */
  border-right-color: #2b3d52;
}
[data-theme="dark"] .topbar { border-bottom-color: #2b3d52; }
[data-theme="dark"] .sidebar-logo,
[data-theme="dark"] .sidebar-footer { border-color: #2b3d52; }
[data-theme="dark"] .sidebar .nav-item:hover { background: rgba(255,255,255,0.07); }

/* ── Keep the footer (sign out + dark/light switch) reachable ──
   The menu is taller than many windows; let it scroll and pin the footer. */
.sidebar { overflow-y: auto; }
.sidebar-footer {
  position: sticky;
  bottom: 0;
  background: inherit;
  z-index: 1;
}
