/* ==========================================================================
   Portable Santa Fe — Navbar (Opción C)
   Turquesa + logo con fondo blanco + navegación centrada
   Funciona con cualquier logo de cualquier color (multitaller)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Estructura principal
   -------------------------------------------------------------------------- */
nav.navbar-psf {
  background-color: var(--color-primario);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  min-height: 52px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

body.modo-oscuro nav.navbar-psf,
html.modo-oscuro nav.navbar-psf {
  background-color: color-mix(in srgb, var(--color-primario) 85%, #000);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   Logo — fondo blanco para compatibilidad con cualquier logo
   -------------------------------------------------------------------------- */
 .navbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
  background: #ffffff;
  border-radius: 8px;
  padding: 2px;
  width: 80px;
  height: 48px;
  margin-right: 0.5rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.navbar-logo:hover {
  background: #f0fffe;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.20);
  transform: translateY(-1px);
}

.navbar-logo:active {
  transform: translateY(0px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.navbar-logo img {
  height: 44px;
  width: 76px;
  object-fit: contain;
  display: block;
}

/* --------------------------------------------------------------------------
   Navegación centrada
   -------------------------------------------------------------------------- */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  justify-content: center;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border: none;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-base, sans-serif);
  line-height: 1;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-btn:active {
  background: rgba(255, 255, 255, 0.25);
}

.nav-btn.activo {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.6);
}

.nav-btn svg,
.nav-btn i {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   Zona derecha — switch + usuario
   -------------------------------------------------------------------------- */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.navbar-right,
.navbar-right * {
  color: rgba(255, 255, 255, 0.92);
}

.navbar-right a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: 0.82rem;
}

.navbar-right a:hover {
  text-decoration: underline;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Switch modo oscuro
   -------------------------------------------------------------------------- */
.theme-toggle {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.theme-toggle .form-check-input {
  cursor: pointer;
  margin-top: 0;
}

.theme-toggle .form-check-label {
  cursor: pointer;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.92);
  margin-left: 0;
}

/* --------------------------------------------------------------------------
   Barra de usuario
   -------------------------------------------------------------------------- */
.userbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  line-height: 1;
}

.userbar .sep {
  opacity: 0.45;
}

/* Separador visual en navbar */
.nav-separador {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.30);
  margin: 0 4px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── User dropdown ───────────────────────────────────────────────────────── */
.mk-user-dropdown {
  position: relative;
}

.mk-user-btn {
  display:     flex;
  align-items: center;
  gap:         6px;
  background:  rgba(0,0,0,0.2);
  border:      1px solid rgba(255,255,255,0.2);
  cursor:      pointer;
  color:       #fff;
  font-size:   0.82rem;
  font-weight: 600;
  padding:     5px 10px;
  border-radius: 999px;
  transition:  background 0.15s;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mk-user-btn:hover {
  background: rgba(0,0,0,0.15);
}

.mk-user-rol {
  font-size:    0.72rem;
  color:        rgba(255,255,255,0.95);
  padding:      1px 6px;
  background:   rgba(0,0,0,0.2);
  border-radius: 999px;
}

.mk-plan-alerta {
  width:        8px;
  height:       8px;
  background:   #ef4444;
  border-radius: 50%;
  animation:    mk-pulso 1.5s infinite;
  flex-shrink:  0;
}

@keyframes mk-pulso {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}

.mk-user-menu {
  position:   absolute;
  top:        calc(100% + 8px);
  right:      0;
  width:      220px;
  background: var(--surface-1);
  border:     1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  overflow:   hidden;
  z-index:    9999;
  display:    none;
}

.mk-user-menu.mk-menu-visible {
  display: block;
}

.mk-user-menu-header {
  padding:       12px 14px;
  border-bottom: 1px solid var(--border);
}

.mk-user-menu-nombre {
  font-size:   0.88rem;
  font-weight: 700;
  color:       var(--text);
}

.mk-user-menu-rol {
  font-size: 0.75rem;
  color:     var(--text-muted);
}

.mk-user-menu-item {
  display:         flex;
  align-items:     center;
  gap:             10px;
  padding:         10px 14px;
  font-size:       0.85rem;
  color:           var(--text) !important;
  text-decoration: none !important;
  transition:      background 0.15s;
  border:          none;
  background:      transparent;
  width:           100%;
  cursor:          pointer;
}

.mk-user-menu-item:hover {
  background: var(--surface-2);
  color:      var(--text) !important;
}

.mk-user-menu-salir {
  border-top: 1px solid var(--border);
  color:      var(--text-muted) !important;
}

.mk-user-menu-salir:hover {
  color:      #ef4444 !important;
  background: rgba(239,68,68,0.08);
}

.mk-user-menu-item:hover {
  background: var(--surface-2);
  color:      var(--text);
}

.mk-user-menu-salir {
  border-top: 1px solid var(--border);
  color:      var(--text-muted);
}

.mk-user-menu-salir:hover {
  color:      #ef4444;
  background: rgba(239,68,68,0.08);
}

/* ── Íconos del menú de usuario ─────────────────────────────────────────── */
.mk-user-menu-item svg {
  color:  var(--text) !important;
  stroke: var(--text) !important;
}

.mk-user-menu-salir svg {
  color:  var(--text-muted) !important;
  stroke: var(--text-muted) !important;
}

.mk-user-menu-salir:hover svg {
  color:  #ef4444 !important;
  stroke: #ef4444 !important;
}

.mk-user-menu-nombre {
  font-size:   0.88rem;
  font-weight: 700;
  color:       var(--text) !important;
}

.mk-user-menu-rol {
  font-size: 0.75rem;
  color:     var(--text-muted) !important;
}

/* ==========================================================================
   NAVBAR MOBILE — Drawer lateral (hamburguesa)
   Aplica solo en pantallas ≤768px
   ========================================================================== */

/* Botón hamburguesa — oculto en desktop */
#mk-nav-hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
  padding: 5px 8px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}

#mk-nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Overlay oscuro detrás del drawer */
#mk-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(1px);
}

#mk-nav-overlay.mk-nav-overlay-open {
  display: block;
}

/* Drawer lateral */
#mk-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

html:not(.modo-oscuro) #mk-nav-drawer {
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

html.modo-oscuro #mk-nav-drawer {
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

#mk-nav-drawer.mk-drawer-open {
  transform: translateX(0);
}

/* Header del drawer */
.mk-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background-color: var(--color-primario);
}

.mk-drawer-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mk-drawer-header-logo img {
  height: 36px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  padding: 2px 4px;
}

.mk-drawer-nombre {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.mk-drawer-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  color: #ffffff;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.mk-drawer-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Links del drawer */
.mk-drawer-links {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.mk-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none !important;
  border: none;
  background: transparent;
  width: 100%;
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 0;
}

html:not(.modo-oscuro) .mk-drawer-link {
  color: #374151;
}

html.modo-oscuro .mk-drawer-link {
  color: var(--text);
}

html:not(.modo-oscuro) .mk-drawer-link:hover,
html:not(.modo-oscuro) .mk-drawer-link.activo {
  background: #f0fdfe;
  color: var(--color-primario);
}

html.modo-oscuro .mk-drawer-link:hover,
html.modo-oscuro .mk-drawer-link.activo {
  background: var(--surface-2);
  color: var(--color-primario);
}

.mk-drawer-link.activo {
  font-weight: 700;
  border-left: 3px solid var(--color-primario);
  padding-left: 17px;
}

.mk-drawer-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.mk-drawer-separador {
  height: 1px;
  margin: 6px 16px;
}

html:not(.modo-oscuro) .mk-drawer-separador {
  background: #f3f4f6;
}

html.modo-oscuro .mk-drawer-separador {
  background: var(--border);
}

/* Footer del drawer — usuario */
.mk-drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.mk-drawer-usuario {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 8px;
}

html:not(.modo-oscuro) .mk-drawer-usuario {
  color: #374151;
}

html.modo-oscuro .mk-drawer-usuario {
  color: var(--text);
}

.mk-drawer-usuario-rol {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.65;
  margin-left: 4px;
}

.mk-drawer-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  text-decoration: none !important;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.12s;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
}

html:not(.modo-oscuro) .mk-drawer-logout {
  color: #dc2626;
}

html.modo-oscuro .mk-drawer-logout {
  color: #f87171;
}

html:not(.modo-oscuro) .mk-drawer-logout:hover {
  background: rgba(220, 38, 38, 0.08);
}

html.modo-oscuro .mk-drawer-logout:hover {
  background: rgba(248, 113, 113, 0.08);
}

/* ── Mobile: activar hamburguesa, ocultar links del navbar ── */
@media (max-width: 768px) {
  #mk-nav-hamburger {
    display: flex;
  }

  .navbar-links {
    display: none !important;
  }

  /* En mobile: logo + lupa + hamburguesa */
  nav.navbar-psf {
    justify-content: space-between;
    padding: 0 12px;
    gap: 8px;
  }

  .navbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
  }

  /* Ocultar switch de tema y usuario en mobile — están en el drawer */
  .navbar-right .theme-toggle,
  .mk-user-dropdown,
  .mk-notif-wrap {
    display: none !important;
  }
}