/* ==========================================================================
   AMB-SYSTEM-REWORK-VIBRANT.CSS
   REWORK DE INTERFACE: OTIMIZAÇÃO ESPACIAL, ORGANIZAÇÃO EM 4 CLUSTERS &
   ICONOGRAFIA DUOTONE VIBRANTE (AMB-ICON-SYSTEM)
   ========================================================================== */

/* 1. VARIÁVEIS DE CORES VIBRANTES & IDENTIDADE VISUAL POR CLUSTER */
:root {
  /* Cluster 1: Operação & Agenda (Azul Royal Vibrante) */
  --c-oper-primary: #2563eb;
  --c-oper-light: #eff6ff;
  --c-oper-border: rgba(37, 99, 235, 0.25);
  --c-oper-glow: rgba(37, 99, 235, 0.15);

  /* Cluster 2: Atendimento, Pacientes & Aprovações (Esmeralda & Âmbar Solar) */
  --c-atend-emerald: #10b981;
  --c-atend-emerald-light: #ecfdf5;
  --c-atend-amber: #f59e0b;
  --c-atend-amber-light: #fffbeb;
  --c-atend-rose: #f43f5e;
  --c-atend-rose-light: #fff1f2;

  /* Cluster 3: Inteligência, Finanças & Telemetria (Roxo Neon & Cyan Pix) */
  --c-intel-purple: #8b5cf6;
  --c-intel-purple-light: #f5f3ff;
  --c-intel-cyan: #06b6d4;
  --c-intel-cyan-light: #ecfeff;

  /* Cluster 4: Gestão, Infra & Integrações (Indigo & Slate Metálico) */
  --c-gestao-indigo: #6366f1;
  --c-gestao-indigo-light: #eef2ff;
  --c-gestao-slate: #64748b;
  --c-gestao-slate-light: #f8fafc;
}

/* 2. CABEÇALHOS DE GRUPO/CLUSTER NO MENU LATERAL */
.sidebar-cluster-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px 6px 10px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  user-select: none;
  transition: all 0.25s ease;
  margin-top: 4px;
}

.sidebar-cluster-label span {
  white-space: nowrap;
}

.sidebar-cluster-label::after {
  content: '';
  flex: 1;
  height: 1.5px;
  border-radius: 2px;
  opacity: 0.35;
}

.sidebar-cluster-label.cluster-oper { color: #2563eb; }
.sidebar-cluster-label.cluster-oper::after { background: #2563eb; }

.sidebar-cluster-label.cluster-atend { color: #059669; }
.sidebar-cluster-label.cluster-atend::after { background: #059669; }

.sidebar-cluster-label.cluster-finan { color: #d97706; }
.sidebar-cluster-label.cluster-finan::after { background: #d97706; }

.sidebar-cluster-label.cluster-intel { color: #7c3aed; }
.sidebar-cluster-label.cluster-intel::after { background: #7c3aed; }

.sidebar-cluster-label.cluster-gestao { color: #475569; }
.sidebar-cluster-label.cluster-gestao::after { background: #64748b; }

.sidebar-cluster-label.cluster-integ { color: #0891b2; }
.sidebar-cluster-label.cluster-integ::after { background: #0891b2; }

.sidebar.collapsed .sidebar-cluster-label {
  padding: 6px 0;
  margin: 6px auto;
  width: 32px;
  height: 2px;
  overflow: hidden;
  text-indent: -9999px;
  background: rgba(100, 116, 139, 0.2);
  border-radius: 2px;
}
.sidebar.collapsed .sidebar-cluster-label::after { display: none; }

/* 3. ICONOGRAFIA VIBRANTE & CAIXAS DE ÍCONE DUOTONE */
.nav-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 6px 10px !important;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  background: transparent !important;
  margin-bottom: 2px !important;
}

/* Ícones com caixas coloridas vivas estilo Duotone / App Store */
.nav-item .nav-icon-badge {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.25s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Paletas Individuais dos Ícones */
.nav-icon-badge.icon-blue    { background: #eff6ff; color: #2563eb; border: 1px solid rgba(37, 99, 235, 0.2); }
.nav-icon-badge.icon-teal    { background: #f0fdfa; color: #0d9488; border: 1px solid rgba(13, 148, 136, 0.2); }
.nav-icon-badge.icon-indigo  { background: #eef2ff; color: #4f46e5; border: 1px solid rgba(79, 70, 229, 0.2); }
.nav-icon-badge.icon-amber   { background: #fffbeb; color: #d97706; border: 1px solid rgba(217, 119, 6, 0.25); }
.nav-icon-badge.icon-rose    { background: #fff1f2; color: #e11d48; border: 1px solid rgba(225, 29, 72, 0.2); }
.nav-icon-badge.icon-emerald { background: #ecfdf5; color: #059669; border: 1px solid rgba(5, 150, 105, 0.2); }
.nav-icon-badge.icon-purple  { background: #f5f3ff; color: #7c3aed; border: 1px solid rgba(124, 58, 237, 0.2); }
.nav-icon-badge.icon-cyan    { background: #ecfeff; color: #0891b2; border: 1px solid rgba(8, 145, 178, 0.2); }
.nav-icon-badge.icon-slate   { background: #f1f5f9; color: #475569; border: 1px solid rgba(71, 85, 105, 0.2); }

/* Hover States Vivos */
.nav-item:hover {
  background: #ffffff !important;
  border-color: rgba(226, 232, 240, 0.8) !important;
  color: #0f172a !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05) !important;
  transform: translateX(2px);
}

.nav-item:hover .nav-icon-badge {
  transform: scale(1.1) rotate(-2deg);
}

/* Item Ativo - Destaque Nobre e Marcante */
.nav-item.active {
  background: #ffffff !important;
  border-color: rgba(37, 99, 235, 0.35) !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12), 0 0 0 1px rgba(37, 99, 235, 0.15) !important;
}

.nav-item.active .nav-icon-badge {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transform: scale(1.08);
}

/* Badges de Contadores e Pendências mais Vivos */
.nav-item .pending-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* 4. TOPBAR DINÂMICA COMPACTA (SISTEMA INTEGRADO) */
.system-topbar-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  margin-bottom: 8px !important;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-breadcrumb-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
}

.topbar-breadcrumb-wrap .crumb-highlight {
  color: #0f172a;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topbar-right-actions {
  display: none !important;
}

.btn-quick-new-appt {
  display: none !important;
}

/* 5. GAVETA RETRÁTIL (APP DRAWER / SIDE SHEET) */
.app-side-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99990;
  opacity: 0;
  visibility: hidden;
  transition: all 0.28s ease;
}

.app-side-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.app-side-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.18);
  z-index: 99999;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.app-side-drawer-panel.active {
  transform: translateX(0);
}

/* 6. RESPONSIVIDADE UNIFICADA MOBILE <= 768px */
@media screen and (max-width: 768px) {
  .system-topbar-compact {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .topbar-right-actions,
  .btn-quick-new-appt {
    display: none !important;
  }
}
