/* Reglas heredadas del menú lateral; se mantienen antes de sus variantes actuales. */
/* ------------------ Sidebar ---------------- */
.sidebar {
  
  border-right: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-xs);
}

.sidebar .item {
  display: flex;
  align-items: center;
  gap: 12px;

  min-height: 50px;
  padding: 12px 14px;

  border-radius: var(--radius-md);

  color: var(--color-muted);
  font-weight: 700;

  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.sidebar .item:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  transform: translateX(2px);
}

.sidebar .item.is-active {
  background: var(--color-primary-soft);
  color: #158c78;
  font-weight: 800;
}

.sidebar .item.is-active svg,
.sidebar .item:hover svg {
  color: var(--color-primary-hover);
}


/* frontend/css/sidebar.css */
/* =========================================================
   Rasta Pets – Minimalist Modern Sidebar
   Aesthetic: Clean, SaaS / Minimalist, High-contrast Active State
   ========================================================= */

:root {
  /* Dimensions */
  --sidebar-w: 245px;
  
  --footer-h: 68px;

  /* Colors */
  --sidebar-bg: #ffffff;
  --sidebar-border: #edf2f7;
  --sidebar-text: #0f172a;
  --sidebar-text-muted: #475569;
  --sidebar-hover-bg: #f8fafc;
  --sidebar-hover-text: #0f172a;

  /* Active state (High-end Dark SaaS) */
  --sidebar-active-bg: #0f172a;
  --sidebar-active-text: #ffffff;
  --sidebar-active-icon: #22c7a9;
  --sidebar-active-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);

  /* Brand */
  --sidebar-brand-bg: #f0fdf9;
  --sidebar-brand-border: rgba(34, 199, 169, 0.2);

  /* Danger / Logout */
  --sidebar-danger: #e11d48;
  --sidebar-danger-bg: #fff1f2;

  /* Border radius */
  --sidebar-radius: 9px;

  /* Transitions */
  --sidebar-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------ Contenedor Fijo ---------------------- */
.sidebar-container {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  transition: width var(--sidebar-transition);
  z-index: 25;
}

.app-root {
  margin-left: var(--sidebar-w);
  transition: margin-left var(--sidebar-transition);
}

/* ------------------ Base del Sidebar --------------------- */
.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--sidebar-bg);
  user-select: none;
}

/* ------------------ Brand / Logo ------------------------- */
.sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  
  
  height: 72px;
  
  border-bottom: 1px solid var(--sidebar-border);
}

.brand__link {
  display: flex;
  align-items: center;
  
  flex: 1;
  min-width: 0;
  text-decoration: none;
  cursor: pointer;
  background: transparent !important;
  box-shadow: none !important;
}

.brand__logo {
  
  
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: #ffffff;
  border: 1px solid var(--sidebar-brand-border);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.brand__link:hover .brand__logo {
  transform: scale(1.03);
}

.brand__logo img {
  width: 98%;
  height: 98%;
  object-fit: contain;
  border-radius: 8px;
}

.brand__info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  line-height: 1.15;
}

.brand__name {
  font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
  color: var(--sidebar-text);
  
  font-weight: 800;
  
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__branch {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary, #059669);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar__toggle {
  
  
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  
  color: var(--sidebar-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.sidebar__toggle svg {
  width: 17px;
  height: 17px;
}

.sidebar__toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
  border-color: #cbd5e1;
}

/* ------------------ Navegación Principal ----------------- */
.sidebar__nav {
  flex: 1;
  
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar__group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.sidebar__group-title {
  margin: 8px 12px 4px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav__item {
  position: relative;
  display: flex;
  align-items: center;
  
  
  height: 40px;
  
  
  color: var(--sidebar-text-muted);
  text-decoration: none;
  
  
  
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav__item .label {
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Íconos */
.nav-icon {
  
  
  flex: 0 0 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sidebar-text-muted);
  transition: color 0.15s ease;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2px;
}

/* Hover */
.nav__item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-hover-text);
}

.nav__item:hover .nav-icon {
  color: var(--sidebar-hover-text);
}

/* Active State - Dark Modern SaaS */
.nav__item.active {
  background: var(--sidebar-active-bg) !important;
  color: var(--sidebar-active-text) !important;
  box-shadow: var(--sidebar-active-shadow) !important;
  font-weight: 700;
}

.nav__item.active .label {
  color: var(--sidebar-active-text) !important;
}

.nav__item.active .nav-icon {
  color: var(--sidebar-active-icon) !important;
}

.nav__item.active::before {
  display: none !important;
}

/* ------------------ Footer / Logout ---------------------- */
.sidebar__footer {
  
  border-top: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
}

.nav__logout {
  width: 100%;
  display: flex;
  align-items: center;
  
  
  height: 40px;
  
  background: transparent;
  border: 1px solid transparent;
  
  color: var(--sidebar-text-muted);
  
  
  
  transition: all 0.15s ease;
}

.nav__logout:hover {
  background: var(--sidebar-danger-bg);
  color: var(--sidebar-danger);
}

.nav__logout:hover .nav-icon {
  color: var(--sidebar-danger);
}

/* ------------------ Modo Mini (Colapsado) ---------------- */
body.sidebar-mini .sidebar-container {
  width: var(--sidebar-w-mini);
}

body.sidebar-mini .app-root {
  margin-left: var(--sidebar-w-mini);
}

body.sidebar-mini :where(.sidebar) .brand__name,
body.sidebar-mini :where(.sidebar) .label {
  display: none !important;
}

body.sidebar-mini :where(.sidebar) .sidebar__group-title {
  display: none;
}

body.sidebar-mini :where(.sidebar) .sidebar__brand {
  
  justify-content: center;
}

body.sidebar-mini :where(.sidebar) .brand__link {
  display: none !important;
}

body.sidebar-mini :where(.sidebar) .sidebar__toggle {
  margin: 0 auto;
}

body.sidebar-mini :where(.sidebar) .sidebar__nav {
  padding: 10px 8px;
}

body.sidebar-mini :where(.sidebar) .nav__item,
body.sidebar-mini :where(.sidebar) .nav__logout {
  justify-content: center !important;
  padding: 0 !important;
  width: 40px;
  height: 40px;
  
  margin: 0 auto 3px auto;
  border-radius: 8px;
}

/* Tooltip para mini sidebar */
body.sidebar-mini :where(.sidebar) .nav__item::after,
body.sidebar-mini :where(.sidebar) .nav__logout::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  padding: 5px 10px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

body.sidebar-mini :where(.sidebar) .nav__item:hover::after,
body.sidebar-mini :where(.sidebar) .nav__logout:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ------------------ Scrollbar ---------------------------- */
.sidebar__nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar__nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar__nav::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

.sidebar__nav::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

/* ------------------ Dark Mode Support -------------------- */
:root[data-theme="dark"] .sidebar-container,
:root[data-theme="dark"] .sidebar {
  background: #0f172a;
  border-color: #1e293b;
}

:root[data-theme="dark"] .sidebar__brand,
:root[data-theme="dark"] .sidebar__footer {
  border-color: #1e293b;
  background: #0f172a;
}

:root[data-theme="dark"] .brand__name {
  color: #f8fafc;
}

:root[data-theme="dark"] .brand__logo {
  background: #1e293b;
  border-color: #334155;
}

:root[data-theme="dark"] .sidebar__toggle {
  border-color: #334155;
  color: #94a3b8;
}

:root[data-theme="dark"] .sidebar__toggle:hover {
  background: #1e293b;
  color: #f8fafc;
}

:root[data-theme="dark"] .nav__item {
  color: #94a3b8;
}

:root[data-theme="dark"] .nav__item:hover {
  background: #1e293b;
  color: #f8fafc;
}

:root[data-theme="dark"] .nav__item.active {
  background: #1e293b !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

:root[data-theme="dark"] .nav__item.active .nav-icon {
  color: #22c7a9 !important;
}

/* ------------------ Móvil / Responsive ------------------- */
@media (max-width: 900px) {
  .sidebar-container {
    width: 0;
    border-right: none;
  }

  .app-root {
    margin-left: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(84vw, 270px);
    max-width: 290px;
    background: var(--sidebar-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform var(--sidebar-transition);
    z-index: 40;
  }

  .sidebar.show {
    transform: translateX(0);
  }
}

body.no-sidebar .sidebar-container {
  display: none !important;
}

body.no-sidebar .app-root {
  margin-left: 0 !important;
}

/* Botón flotante móvil */
.mobile-menu-btn {
  display: none;
}

@media (max-width: 900px) {
  body.with-sidebar .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    left: 14px;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    color: #0f172a;
    font-size: 18px;
    z-index: 30;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
  }

  body.with-sidebar .mobile-menu-btn:hover {
    background: #f8fafc;
    color: #22c7a9;
  }

  body.with-sidebar .page__header {
    padding-left: 56px;
  }
}

body.no-sidebar .mobile-menu-btn {
  display: none !important;
}

/* SuperAdmin nav oculto por defecto (D-02) */
.nav__superadmin {
  display: none;
}
