/* ============================================================
   EQI Budget System — mobile-drawer.css
   B2 — Sidebar Mobile como Drawer com Overlay.
   Depende de: ../styles.css (design tokens)
   ============================================================ */

/* ============================================================
   HAMBURGER BUTTON (injetado no header em < 768px)
   ============================================================ */
.gh-hamburger {
  display: none;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 250, 250, 0.8);
  cursor: pointer;
  transition: background-color 0.15s ease;
  -ms-flex-negative: 0;
      flex-shrink: 0;
}

.gh-hamburger:hover {
  background-color: rgba(99, 198, 165, 0.1);
}

.gh-hamburger:focus-visible {
  outline: 2px solid var(--green-light, #63C6A5);
  outline-offset: 2px;
}

/* ============================================================
   OVERLAY ESCURO
   ============================================================ */
.md-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 85;
  background-color: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.md-overlay.is-visible {
  opacity: 1;
}

@supports (backdrop-filter: blur(1px)) {
  .md-overlay {
    backdrop-filter: blur(2px);
  }
}

/* ============================================================
   MOBILE BREAKPOINT (< 768px)
   ============================================================ */
@media (max-width: 767px) {

  /* Mostrar hamburger */
  .gh-hamburger {
    display: -webkit-box;
    display:    -ms-flexbox;
    display:        flex;
  }

  /* Mostrar overlay quando necessário */
  .md-overlay {
    display: block;
    pointer-events: none;
  }

  .md-overlay.is-visible {
    pointer-events: auto;
  }

  /* Sidebar vira drawer fixo */
  #eqi-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -260px !important;
    width: 240px !important;
    min-width: 240px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 95 !important;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: none !important;
  }

  /* Quando aberto */
  #eqi-sidebar.md-open {
    left: 0 !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3) !important;
  }

  /* Impedir o collapse no mobile (sempre expandido dentro do drawer) */
  #eqi-sidebar.md-open.sb-collapsed {
    width: 240px !important;
    min-width: 240px !important;
  }

  #eqi-sidebar.md-open.sb-collapsed .sb-label,
  #eqi-sidebar.md-open.sb-collapsed .sb-chevron,
  #eqi-sidebar.md-open.sb-collapsed .sb-group-label,
  #eqi-sidebar.md-open.sb-collapsed .sb-brand-name {
    display: initial !important;
    opacity: 1 !important;
    width: auto !important;
    pointer-events: auto !important;
  }

  #eqi-sidebar.md-open.sb-collapsed .sb-link {
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 7px 12px 7px 14px !important;
    width: auto !important;
  }

  #eqi-sidebar.md-open.sb-collapsed .sb-sub-list {
    display: block !important;
  }

  #eqi-sidebar.md-open.sb-collapsed .sb-header {
    justify-content: space-between !important;
    padding: 0 12px !important;
  }

  #eqi-sidebar.md-open.sb-collapsed .sb-brand {
    display: flex !important;
  }

  /* Body scroll lock when drawer is open */
  body.md-drawer-open {
    overflow: hidden !important;
  }

  /* Esconder o sidebar toggle no mobile (hamburger substitui) */
  #sb-toggle-btn {
    display: none !important;
  }
}

/* ============================================================
   ACCESSIBILITY: prefers-reduced-motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  #eqi-sidebar,
  .md-overlay {
    transition: none !important;
  }
}

/* ============================================================
   PRINT: esconder
   ============================================================ */
@media print {
  .gh-hamburger,
  .md-overlay {
    display: none !important;
  }
}
