/* =========================
   Sidebar – IGM desktop
   Visible en ≥992px, oculto en mobile (usa navbott)
   ========================= */

:root {
  --sidebar-w:      240px;
  --sidebar-bg:     #b81f19;
  --sidebar-hover:  rgba(255,255,255,0.10);
  --sidebar-active: rgba(255,255,255,0.18);
  --sidebar-text:   rgba(255,255,255,0.88);
  --sidebar-muted:  rgba(255,255,255,0.52);
}

/* ── Desktop layout ───────────────────────────────────────── */
@media (min-width: 992px) {
  #app-header { display: none !important; }

  body {
    padding-bottom: 0 !important;
    padding-top: 48px;
    padding-left: var(--sidebar-w);
    transition: padding-left 0.22s ease;
  }

  body.sidebar-collapsed {
    padding-left: 0;
  }

  .bottom-nav { display: none !important; }

  .mb-safe {
    padding-bottom: 1.5rem !important;
  }
}

/* ── Sidebar ──────────────────────────────────────────────── */
.igm-sidebar {
  display: none; /* oculto por defecto (mobile) */
}

@media (min-width: 992px) {
  .igm-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: transform 0.22s ease, width 0.22s ease;
  }
  .igm-sidebar::-webkit-scrollbar { display: none; }

  body.sidebar-collapsed .igm-sidebar {
    transform: translateX(-100%);
  }
}

/* ── Desktop topbar fijo ──────────────────────────────────── */
.igm-desktop-topbar {
  display: none;
}

@media (min-width: 992px) {
  .igm-desktop-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: 48px;
    background: var(--sidebar-bg);
    border-bottom: none;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: left 0.22s ease;
  }

  body.sidebar-collapsed .igm-desktop-topbar {
    left: 0;
  }

  /* Modo compacto (default): contenido centrado con ancho máximo */
  body:not(.content-expanded) .container,
  body:not(.content-expanded) .container-fluid,
  body:not(.content-expanded) .container-lg,
  body:not(.content-expanded) .container-xl {
    max-width: 960px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Modo expandido: todo el ancho disponible */
  body.content-expanded .container,
  body.content-expanded .container-fluid,
  body.content-expanded .container-lg,
  body.content-expanded .container-xl {
    max-width: 100% !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}


.igm-dtb-spacer {
  flex: 1;
}

.igm-dtb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.igm-dtb-btn:hover,
.igm-dtb-btn:focus {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.igm-dtb-btn--exit:hover {
  background: rgba(255, 80, 80, 0.3);
  color: #fca5a5;
}

/* Brand */
.igm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  text-decoration: none;
  flex-shrink: 0;
}
.igm-sidebar-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,0.92);
  padding: 4px;
  flex-shrink: 0;
}
.igm-sidebar-brand-name {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  letter-spacing: 0.1px;
}
.igm-sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  font-weight: 500;
  display: block;
  margin-top: 1px;
}

/* Sección de usuario */
.igm-sidebar-user {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}
.igm-sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}
.igm-sidebar-user-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.igm-sidebar-user-role {
  font-size: 0.68rem;
  color: var(--sidebar-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav */
.igm-sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.igm-sidebar-section {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 10px 8px 4px;
}

.igm-sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.14s ease, color 0.14s ease;
  white-space: nowrap;
  overflow: hidden;
}
.igm-sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  opacity: 0.85;
}
.igm-sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.igm-sidebar-link:hover i { opacity: 1; }

.igm-sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 700;
}
.igm-sidebar-link.active i { opacity: 1; }

/* Footer del sidebar */
.igm-sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}

.igm-sidebar-footer-tools {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}

.igm-sidebar-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.igm-sidebar-tool-btn:hover,
.igm-sidebar-tool-btn:focus {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
  text-decoration: none;
  outline: none;
}

.igm-sidebar-tool-btn--exit:hover {
  background: rgba(255, 80, 80, 0.3);
  color: #fca5a5;
}

/* Versión */
.igm-sidebar-version {
  font-size: 0.65rem;
  color: var(--sidebar-muted);
  text-align: center;
  padding: 2px 0 4px;
}

/* ── Header mobile ────────────────────────────────────────── */
.app-header-mobile {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sidebar-bg);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

@media (min-width: 992px) {
  .app-header-mobile { display: none !important; }
}

.app-mobile-hamburger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.app-mobile-hamburger:hover,
.app-mobile-hamburger:focus {
  background: rgba(255,255,255,0.26);
  outline: none;
}

.app-mobile-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.app-mobile-logo {
  height: 30px;
  width: 30px;
  border-radius: 8px;
  object-fit: cover;
}

.app-mobile-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-mobile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.app-mobile-btn:hover { background: rgba(255,255,255,0.24); color: #fff; }
.app-mobile-btn--exit:hover { background: rgba(255,80,80,0.3); color: #fca5a5; }

/* ── Offcanvas menú mobile ────────────────────────────────── */
.igm-offcanvas {
  background: var(--sidebar-bg) !important;
  width: 260px !important;
  border-right: none !important;
}

.igm-offcanvas__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.igm-offcanvas__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.igm-offcanvas__close:hover { background: rgba(255,255,255,0.24); color: #fff; }

.igm-offcanvas__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.igm-offcanvas__nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}
.igm-offcanvas__nav::-webkit-scrollbar { display: none; }

.igm-offcanvas__footer {
  font-size: 0.65rem;
  color: var(--sidebar-muted);
  text-align: center;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,0.08);
}

