/* ==========================================================================
   NdisCare Pro — Custom Styles  (Bootstrap 5.3 base)
   Only things Bootstrap cannot do are defined here.
   ========================================================================== */

/* ── Root tokens ──────────────────────────────────────────────────────── */
:root {
  --nc-sidebar-width:  240px;
  --nc-topbar-h:       60px;
  --nc-primary:        #2563eb;
  --nc-ndis:           #0073bc;
}

/* ── Body ─────────────────────────────────────────────────────────────── */
body { background: #f4f6f9; font-size: .9rem; }

/* ── Sidebar (push — flex sibling of #nc-main) ──────────────────── */
#nc-sidebar {
  width: var(--nc-sidebar-width);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  overflow: hidden;
  transition: margin-left .25s ease, width .25s ease;
  z-index: 1030;
}
#nc-sidebar.nc-sidebar-hidden {
  margin-left: calc(-1 * var(--nc-sidebar-width));
}

/* Auto-hide sidebar on mobile */
@media (max-width: 991.98px) {
  #nc-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    margin-left: calc(-1 * var(--nc-sidebar-width));
  }
  #nc-sidebar.nc-sidebar-visible {
    margin-left: 0;
  }
  #nc-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1035;
  }
  #nc-backdrop.show { display: block; }
}
#nc-sidebar .brand-name    { font-weight: 700; font-size: .95rem; color: #111827; line-height: 1.1; }
#nc-sidebar .brand-tagline { font-size: .65rem; color: #9ca3af; }
#nc-sidebar .nav-section-label {
  padding: 16px 18px 4px;
  font-size: .62rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #9ca3af;
}
#nc-sidebar .nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; margin: 1px 8px;
  color: #4b5563; font-size: .84rem;
  text-decoration: none; border-radius: 7px;
  transition: background .12s, color .12s;
}
#nc-sidebar .nav-link:hover  { background: #f3f4f6; color: #111827; }
#nc-sidebar .nav-link.active {
  background: #eff6ff; color: var(--nc-primary); font-weight: 600;
}
#nc-sidebar .nav-link .nav-icon { width: 17px; text-align: center; flex-shrink: 0; opacity: .75; }
#nc-sidebar .nav-link.active .nav-icon { opacity: 1; }
#nc-sidebar .nav-link .badge   { margin-left: auto; background: var(--nc-primary) !important; color: #fff; font-size: .7rem; }
#nc-sidebar .sidebar-footer {
  border-top: 1px solid #f0f0f0; padding: 12px 14px;
}
#nc-sidebar .sidebar-footer .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--nc-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff; font-weight: 700; flex-shrink: 0;
}
#nc-sidebar .sidebar-footer .user-name { font-size: .82rem; color: #111827; font-weight: 600; }
#nc-sidebar .sidebar-footer .user-role { font-size: .7rem; color: #9ca3af; }

/* ── Layout ───────────────────────────────────────────────────────────── */
#nc-wrapper { display: flex; min-height: 100vh; align-items: stretch; }
#nc-main    { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#nc-content { padding: 24px; flex: 1; }

/* ── Top bar ──────────────────────────────────────────────────────────── */
#nc-topbar {
  height: var(--nc-topbar-h); background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; padding: 0 24px; gap: 12px;
  position: sticky; top: 0; z-index: 1020;
}
#nc-topbar .topbar-title      { font-weight: 600; font-size: .95rem; color: #111827; }
#nc-topbar .topbar-breadcrumb { font-size: .75rem; color: #9ca3af; }
#nc-topbar .topbar-actions    { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── Card  (thin wrapper — Bootstrap .card does the rest) ─────────────── */
.nc-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ── Stat cards (dashboard widgets) ──────────────────────────────────── */
.stat-card {
  border-radius: .75rem; padding: 14px 18px;
  position: relative; overflow: hidden; color: #fff;
  display: flex; align-items: center; gap: 14px;
}
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-card .stat-body { display: flex; flex-direction: column; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: .75rem; opacity: .85; margin-top: 2px; }
.stat-card .stat-bg    { position: absolute; right: -12px; bottom: -12px; font-size: 5rem; opacity: .08; }

/* ── Participant avatar ───────────────────────────────────────────────── */
.participant-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--nc-primary, #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: #fff; font-weight: 700; flex-shrink: 0;
}
.participant-avatar.lg { width: 72px; height: 72px; font-size: 1.4rem; }

/* ── Form section heading ─────────────────────────────────────────────── */
.form-section-heading {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--bs-secondary-color, #6c757d);
  padding-bottom: .5rem; margin-bottom: 1rem;
  border-bottom: 2px solid var(--bs-border-color, #dee2e6);
}

/* ── Signature pad ────────────────────────────────────────────────────── */
.sig-container {
  border: 2px dashed #cbd5e1; border-radius: 8px;
  background: #fafafa; position: relative; height: 180px; cursor: crosshair;
}
.sig-container canvas { width: 100%; height: 100%; border-radius: 6px; }
.sig-placeholder {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8; font-size: .8rem; flex-direction: column; gap: 6px;
}

/* ── NDIS item lookup dropdown ───────────────────────────────────────── */
.ndis-lookup-dropdown {
  position: absolute; top: 100%; left: 0; z-index: 1055;
  min-width: 320px; max-width: 480px; max-height: 240px; overflow-y: auto;
  background: #fff; border: 1px solid #cbd5e1; border-radius: 6px;
  padding: 4px 0; margin-top: 2px;
}
.ndis-lookup-dropdown li {
  padding: 6px 12px; font-size: .8rem; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ndis-lookup-dropdown li:hover { background: #f1f5f9; }

/* ── Tables inside nc-card: match card edge padding ─────────────────── */
.nc-card .table { font-size: .8rem; }
.nc-card .table > :not(caption) > * > th:first-child,
.nc-card .table > :not(caption) > * > td:first-child { padding-left: 1.25rem; }
.nc-card .table > :not(caption) > * > th:last-child,
.nc-card .table > :not(caption) > * > td:last-child  { padding-right: 1.25rem; }
.nc-card .table thead th { padding-top: .85rem; padding-bottom: .85rem; }
.nc-card .table tbody tr:last-child td { padding-bottom: .85rem; }

/* ── Care notes ───────────────────────────────────────────────────────── */
.note-card-incident { border-left: 4px solid #ef4444 !important; }
.note-content-preview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Login page ───────────────────────────────────────────────────────── */
.login-page  { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); display: flex; align-items: center; justify-content: center; }
.login-card  { width: 420px; border-radius: 16px; background: #fff; box-shadow: 0 25px 50px rgba(0,0,0,.35); padding: 40px; }
.login-logo  { width: 56px; height: 56px; border-radius: 14px; background: var(--nc-primary); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.6rem; margin: 0 auto 20px; }

/* ── Collapsible nav groups ───────────────────────────────────────────── */
#nc-sidebar .nav-group-toggle {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; margin: 1px 8px;
  color: #4b5563; font-size: .84rem;
  background: none; border: none;
  border-radius: 7px; width: calc(100% - 16px);
  text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
#nc-sidebar .nav-group-toggle:hover { background: #f3f4f6; color: #111827; }
#nc-sidebar .nav-group-toggle .chevron {
  margin-left: auto; font-size: .68rem;
  transition: transform .2s;
}
#nc-sidebar .nav-group-toggle.collapsed .chevron { transform: rotate(-90deg); }
#nc-sidebar .nav-group-toggle .nav-icon { width: 17px; text-align: center; flex-shrink: 0; opacity: .75; }
#nc-sidebar .nav-sub-link {
  display: flex; align-items: center;
  padding: 6px 18px 6px 44px; margin: 1px 8px;
  color: #6b7280; font-size: .81rem;
  text-decoration: none; border-radius: 7px;
  transition: background .12s, color .12s;
  position: relative;
}
#nc-sidebar .nav-sub-link::before {
  content: '»'; font-size: .75rem; color: #d1d5db;
  position: absolute; left: 28px;
}
#nc-sidebar .nav-sub-link:hover { background: #f3f4f6; color: #111827; }
#nc-sidebar .nav-sub-link.active {
  background: #eff6ff; color: var(--nc-primary); font-weight: 600;
}
#nc-sidebar .nav-sub-link.active::before { color: var(--nc-primary); }
#nc-sidebar .nav-future { opacity: .45; pointer-events: none; cursor: default; }
#nc-sidebar button.nav-future { opacity: .45; pointer-events: none; }
#nc-sidebar .nav-recent-releases { background: #e8f5e9; color: #2e7d32 !important; opacity: 1 !important; pointer-events: auto !important; }
#nc-sidebar .nav-recent-releases:hover { background: #c8e6c9 !important; }
#nc-sidebar .nav-badge-premium {
  font-size: .6rem; font-weight: 700; padding: 2px 6px; border-radius: 20px;
  background: #e0e0e0; color: #757575; text-transform: uppercase; letter-spacing: .04em;
}
#nc-sidebar .nav-badge-new {
  font-size: .6rem; font-weight: 700; padding: 2px 6px; border-radius: 20px;
  background: #1565c0; color: #fff; text-transform: uppercase; letter-spacing: .04em;
}

/* ── Sidebar colour overrides (set via settings) ─────────────────────── */

/* ── Invoice line items: ensure qty/price inputs are usable on iOS ────── */
#lines-table th.col-qty,
#lines-table td.col-qty  { width: 90px; min-width: 80px; }
/* Prevent iOS from shrinking number inputs below 16px (stops auto-zoom)  */
#lines-table input[type="number"] {
  font-size: 1rem !important;
  min-width: 70px;
}
@media (max-width: 767.98px) {
  #lines-table input[type="number"],
  #lines-table input[type="text"],
  #lines-table input[type="date"],
  #lines-table select {
    font-size: 1rem !important;
    min-width: 60px;
  }
}

/* ── Utilities not yet in Bootstrap 5.3 ──────────────────────────────── */
.cursor-pointer { cursor: pointer; }
.text-ndis { color: var(--nc-ndis) !important; }
.bg-ndis   { background-color: var(--nc-ndis) !important; }

