/* ============================================================
   CHIKITSAALYE — LAYOUT
   Nav, sidebar, dashboard shell, grid, responsive breakpoints
   ============================================================ */

/* ── PUBLIC NAV ─────────────────────────────────────────────── */
.public-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-nav);
}

.public-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}
.nav-logo-mark {
  width: 38px;
  height: 38px;
  background: var(--brand-teal);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}
.nav-logo-text {
  display: flex;
  flex-direction: column;
}
.nav-logo-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--brand-navy);
  line-height: 1.1;
}
.nav-logo-tagline {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: var(--weight-medium);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
}
.nav-link {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  text-decoration: none;
}
.nav-link:hover { color: var(--brand-teal); background: var(--brand-teal-xlight); }
.nav-link.active { color: var(--brand-teal); background: var(--brand-teal-xlight); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.nav-role-select {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mobile-menu-btn {
  display: none;
  padding: var(--space-2);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
}

/* ── DASHBOARD SHELL ─────────────────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--surface-base);
}

/* ── SIDEBAR ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface-navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: width var(--transition-slow);
  z-index: var(--z-raised);
  position: relative;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--header-height);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow: hidden;
}
.sidebar-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--brand-teal);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
}
.sidebar-logo-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: white;
  white-space: nowrap;
}

.sidebar-toggle {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  background: none;
  border: none;
  transition: var(--transition-fast);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.08); color: white; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-3) 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }

.sidebar-group {
  padding: var(--space-2) 0;
}
.sidebar-group-label {
  font-size: 10px;
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 0 var(--space-4) var(--space-2);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin: 2px var(--space-2);
  border-radius: var(--radius-md);
  color: rgba(255,255,255,0.7);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  border: none;
  background: none;
  width: calc(100% - 16px);
  text-align: left;
}
.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}
.sidebar-link.active {
  background: rgba(14,116,144,0.35);
  color: white;
  border-left: 2px solid var(--brand-teal);
}
.sidebar-link.active .sidebar-link-icon { color: var(--brand-teal); }

.sidebar-link-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-link-text { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-link-badge {
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: var(--weight-bold);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: var(--space-3) var(--space-4);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  overflow: hidden;
}
.sidebar-user-info { min-width: 0; flex: 1; overflow: hidden; }
.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
}

/* ── MAIN CONTENT AREA ───────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  height: var(--header-height);
  background: var(--surface-white);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  gap: var(--space-4);
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

/* ── TAB NAVIGATION ─────────────────────────────────────────── */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  background: var(--surface-white);
  padding: 0 var(--space-6);
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}
.tab-btn:hover { color: var(--brand-teal); }
.tab-btn.active {
  color: var(--brand-teal);
  border-bottom-color: var(--brand-teal);
  font-weight: var(--weight-semibold);
}

.tab-badge {
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: var(--weight-bold);
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── CONTENT GRID SYSTEMS ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-5); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5); }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-5); }
.grid-3-1 { display: grid; grid-template-columns: 3fr 1fr; gap: var(--space-5); }

/* ── SECTION CONTAINER ───────────────────────────────────────── */
.section {
  padding: var(--space-20) 0;
}
.section-narrow { padding: var(--space-16) 0; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-8);
}
.container-sm {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-8);
}

/* ── FOOTER ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--surface-navy-xdark);
  color: rgba(255,255,255,0.7);
  padding: var(--space-16) 0 var(--space-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}
.footer-brand-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: white;
  margin-bottom: var(--space-3);
}
.footer-brand-desc {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: rgba(255,255,255,0.5);
  max-width: 280px;
}
.footer-col-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin-bottom: var(--space-4);
}
.footer-links { display: flex; flex-direction: column; gap: var(--space-2); }
.footer-link {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: var(--transition-fast);
}
.footer-link:hover { color: white; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.35);
}

/* ── RESPONSIVE BREAKPOINTS ─────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-logo-name,
  .sidebar-group-label,
  .sidebar-link-text,
  .sidebar-link-badge,
  .sidebar-user-info { display: none; }
  .sidebar-link { padding: var(--space-3); margin: 2px var(--space-2); justify-content: center; }
  .sidebar-toggle { display: none; }
  .sidebar-header { padding: var(--space-4) var(--space-3); justify-content: center; }
  .sidebar-footer { padding: var(--space-3); }
  .sidebar-user { justify-content: center; }
  .grid-2-1 { grid-template-columns: 1fr; }
  .grid-1-2 { grid-template-columns: 1fr; }
  .grid-3-1 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-5); }
  .content-area { padding: var(--space-4); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  :root { --header-height: 56px; }
  .public-nav-inner { padding: 0 var(--space-4); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .footer-bottom { flex-direction: column; gap: var(--space-3); text-align: center; }
  .section { padding: var(--space-16) 0; }
  .tab-nav { padding: 0 var(--space-4); }
  .app-header { padding: 0 var(--space-4); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE SIDEBAR OVERLAY ─────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: calc(var(--z-raised) - 1);
}
@media (max-width: 768px) {
  .app-shell { position: relative; }
  .sidebar {
    position: fixed;
    left: -var(--sidebar-width);
    top: 0;
    bottom: 0;
    transform: translateX(calc(-1 * var(--sidebar-width) - 10px));
    transition: transform var(--transition-slow);
    z-index: var(--z-overlay);
    width: var(--sidebar-width);
  }
  .sidebar-logo-name,
  .sidebar-group-label,
  .sidebar-link-text,
  .sidebar-link-badge,
  .sidebar-user-info { display: block !important; }
  .sidebar-link { justify-content: flex-start !important; padding: var(--space-2) var(--space-4) !important; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .sidebar-header { justify-content: space-between !important; padding: var(--space-4) !important; }
  .sidebar-footer { padding: var(--space-3) var(--space-4) !important; }
  .sidebar-user { justify-content: flex-start !important; }
}

/* ── BREADCRUMB ──────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-teal); }
.breadcrumb-sep { color: var(--text-faint); font-size: 10px; }
.breadcrumb-current { color: var(--text-primary); font-weight: var(--weight-medium); }
