/* ===================================================================
   Family Nav — shared layout for authenticated pages
   Mount with <div id="family-nav-mount"></div> + family-nav.js
   =================================================================== */

:root {
  --fn-navy:    #1a2e4a;
  --fn-blue:    #2563eb;
  --fn-sky:     #e0f0ff;
  --fn-teal:    #0d9488;
  --fn-orange:  #f97316;
  --fn-yellow:  #fde68a;
  --fn-warm:    #fff7ed;
  --fn-white:   #ffffff;
  --fn-gray-50: #f9fafb;
  --fn-gray-100:#f3f4f6;
  --fn-gray-200:#e5e7eb;
  --fn-gray-400:#9ca3af;
  --fn-gray-600:#4b5563;
  --fn-gray-800:#1f2937;
  --fn-shadow-soft: 0 2px 12px rgba(0,0,0,0.06);
}

/* Layout shell */
.fn-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: #f0f4f8;
  font-family: 'Nunito', system-ui, sans-serif;
}

/* ------------- Sidebar ------------- */
.fn-sidebar {
  background: linear-gradient(180deg, #1a2e4a 0%, #13223a 100%);
  color: #fff;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fn-sidebar::-webkit-scrollbar { width: 6px; }
.fn-sidebar::-webkit-scrollbar-track { background: transparent; }
.fn-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }

.fn-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-decoration: none;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.fn-brand .accent { color: var(--fn-orange); }

.fn-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fn-nav-section {
  font-size: 11px;
  font-weight: 800;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}

.fn-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}

.fn-nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

.fn-nav-item.active {
  background: rgba(249, 115, 22, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--fn-orange);
}

.fn-nav-item .fn-nav-ico { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.fn-nav-item .fn-nav-badge {
  margin-left: auto;
  background: var(--fn-orange);
  color: white;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 50px;
}

.fn-profile-card {
  margin-top: auto;
  padding: 14px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fn-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fn-yellow);
  color: var(--fn-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid var(--fn-orange);
  overflow: hidden;
  object-fit: cover;
}

.fn-avatar img { width: 100%; height: 100%; object-fit: cover; }

.fn-profile-meta { min-width: 0; flex: 1; }
.fn-profile-name { font-weight: 800; color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fn-profile-role { font-size: 12px; color: rgba(255,255,255,0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------- Top bar ------------- */
.fn-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.fn-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--fn-gray-100);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--fn-shadow-soft);
}

.fn-topbar-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 20px;
  color: var(--fn-navy);
  margin-right: auto;
}

.fn-topbar-title small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fn-gray-400);
  margin-top: 2px;
}

.fn-topbar-btn {
  border: none;
  background: var(--fn-gray-50);
  color: var(--fn-gray-600);
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.fn-topbar-btn:hover { background: var(--fn-gray-100); color: var(--fn-navy); transform: translateY(-1px); }
.fn-topbar-btn.primary { background: var(--fn-orange); color: #fff; }
.fn-topbar-btn.primary:hover { background: #ea6c04; }

/* Click-to-call chip in the topbar */
.fn-topbar-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--fn-gray-50);
  color: var(--fn-blue);
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}
.fn-topbar-phone:hover { background: var(--fn-gray-100); transform: translateY(-1px); }
@media (max-width: 640px) {
  .fn-topbar-phone .lbl { display: none; }
  .fn-topbar-phone { padding: 9px 11px; }
}


.fn-bell {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fn-gray-50);
  border: none;
  font-size: 18px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.fn-bell:hover { background: var(--fn-gray-100); }

.fn-bell .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fn-orange);
  border: 2px solid #fff;
  display: none;
}

.fn-bell.has-alerts .dot { display: block; }

.fn-topbar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--fn-yellow);
  color: var(--fn-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  border: 2px solid var(--fn-orange);
  cursor: pointer;
  overflow: hidden;
}
.fn-topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Mobile toggle */
.fn-menu-btn {
  display: none;
  background: var(--fn-gray-50);
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 20px;
  cursor: pointer;
}

/* Content wrapper */
.fn-content {
  padding: 28px 32px;
  flex: 1;
}

/* ------------- Responsive ------------- */
@media (max-width: 900px) {
  .fn-layout { grid-template-columns: 1fr; }
  .fn-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 82%;
    max-width: 300px;
    z-index: 1000;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.25);
  }
  .fn-sidebar.open { transform: translateX(0); }
  .fn-menu-btn { display: inline-flex; }
  .fn-content { padding: 18px 16px; }
  .fn-topbar-title { font-size: 18px; }
  .fn-topbar-btn span.lbl { display: none; }
}

.fn-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.fn-backdrop.open { display: block; }

/* ------------- Common content helpers ------------- */
.fn-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--fn-shadow-soft);
}

.fn-card h2 {
  font-family: 'Nunito', sans-serif;
  color: var(--fn-navy);
  margin-bottom: 8px;
}

.fn-card p { color: var(--fn-gray-600); line-height: 1.6; }

.fn-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--fn-gray-400);
}
.fn-empty .icon { font-size: 54px; margin-bottom: 12px; }
.fn-empty h3 { color: var(--fn-gray-600); font-weight: 800; margin-bottom: 6px; }
.fn-empty p { max-width: 420px; margin: 0 auto; }

.fn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 50px;
  background: var(--fn-sky);
  color: var(--fn-blue);
}
.fn-pill.warm { background: var(--fn-warm); color: var(--fn-orange); }
.fn-pill.teal { background: #ccfbf1; color: var(--fn-teal); }
.fn-pill.gray { background: var(--fn-gray-100); color: var(--fn-gray-600); }

/* Simple grid */
.fn-grid { display: grid; gap: 16px; }
.fn-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.fn-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Hide default scrollbars */
body.fn-body { overflow-x: hidden; }

/* ------------- Shared button (.nt-btn) — used by notifications, settings, family, etc. ------------- */
.nt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  border: 1.5px solid var(--fn-gray-100);
  background: #fff;
  color: var(--fn-gray-600);
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 800;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}
.nt-btn:hover { border-color: var(--fn-orange); color: var(--fn-orange); }
.nt-btn.primary {
  background: var(--fn-blue);
  color: #fff;
  border-color: var(--fn-blue);
}
.nt-btn.primary:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
