/*
  ═══════════════════════════════════════════════════════
  03-LAYOUT.CSS
  ═══════════════════════════════════════════════════════
  Estrutura visual: sidebar, header mobile, navegação inferior, área principal e responsividade estrutural.

  COMO EDITAR:
  - Altere variáveis de cor, espaçamento e sombras preferencialmente em 01-base.css.
  - Evite duplicar classes: procure primeiro se já existe um componente equivalente.
  - Comentários com 'AJUSTE AQUI' indicam pontos comuns de personalização.
*/

/* ── Sidebar ── */
      /* Menu lateral desktop: navegação principal fixa à esquerda. */
      .sidebar {
        width: var(--sidebar);
        background: var(--navy);
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        overflow-y: auto;
        z-index: 210;
        display: flex;
        flex-direction: column;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
        scrollbar-width: none;
      }
      .sidebar::-webkit-scrollbar {
        display: none;
      }
      .sidebar-logo {
        padding: 20px 18px 14px;
        display: flex;
        align-items: center;
        gap: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      }
      .sidebar-logo-mark {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: var(--teal);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 800;
        color: #fff;
        flex-shrink: 0;
        letter-spacing: 0.02em;
      }
      .sidebar-logo-title {
        font-size: 14px;
        font-weight: 700;
        color: #fff;
        letter-spacing: 0.08em;
      }
      .sidebar-logo-sub {
        font-size: 9px;
        color: rgba(255, 255, 255, 0.35);
        letter-spacing: 0.1em;
        margin-top: 1px;
        text-transform: uppercase;
      }
      .sidebar-user {
        padding: 10px 18px;
        margin: 8px 10px 4px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.06);
      }
      .sidebar-user-name {
        font-size: 13px;
        font-weight: 600;
        color: #fff;
      }
      .sidebar-user-sub {
        font-size: 10px;
        color: rgba(255, 255, 255, 0.35);
        margin-top: 1px;
      }
      .sidebar-section {
        padding: 18px 18px 4px;
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0.14em;
        color: rgba(255, 255, 255, 0.22);
        text-transform: uppercase;
      }
      .sidebar-nav {
        flex: 1;
        padding: 0 10px 10px;
      }
      .nav-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 10px;
        border-radius: 7px;
        color: rgba(255, 255, 255, 0.52);
        font-size: 12px;
        font-weight: 500;
        cursor: pointer;
        transition: all var(--trans);
        margin-bottom: 1px;
        width: 100%;
        text-align: left;
      }
      .nav-item:hover {
        background: rgba(255, 255, 255, 0.07);
        color: rgba(255, 255, 255, 0.85);
      }
      .nav-item.active {
        background: rgba(71, 201, 168, 0.12);
        color: var(--teal-b);
        font-weight: 600;
      }
      .nav-icon {
        width: 18px;
        text-align: center;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .nav-icon svg {
        width: 15px;
        height: 15px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      .sidebar-divider {
        height: 1px;
        background: rgba(255, 255, 255, 0.06);
        margin: 6px 18px;
      }
      .sidebar-footer {
        padding: 10px 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
      }
      .sidebar-footer-version {
        font-size: 10px;
        color: rgba(255, 255, 255, 0.18);
        text-align: center;
        padding-top: 8px;
      }

      /* ── Main Content ── */
      #app-layout {
        display: flex;
        min-height: 100vh;
      }
      .main-content {
        margin-left: var(--sidebar);
        flex: 1;
        min-height: 100vh;
        max-width: calc(100vw - var(--sidebar));
        display: flex;
        flex-direction: column;
      }
      .page-wrap {
        padding: 28px 32px;
        max-width: 1140px;
        width: 100%;
        margin: 0 auto;
      }
      .topbar {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 24px;
        gap: 16px;
      }
      .topbar-title {
        font-size: 24px;
        font-weight: 700;
        color: var(--navy);
        letter-spacing: -0.02em;
      }
      .topbar-sub {
        font-size: 13px;
        color: var(--grey);
        margin-top: 4px;
        max-width: 640px;
        line-height: 1.6;
      }
      .topbar-actions {
        display: flex;
        gap: 8px;
        flex-shrink: 0;
        margin-top: 2px;
      }

      /* ── Mobile Header ── */
      /* Cabeçalho mobile: aparece quando a sidebar desktop é escondida. */
      .mobile-header {
        display: none;
        background: rgba(14, 33, 64, 0.97);
        padding: 12px 14px;
        padding-top: max(12px, env(safe-area-inset-top, 12px));
        position: sticky;
        top: 0;
        z-index: 150;
        align-items: center;
        justify-content: space-between;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
      }
      .mobile-header-title {
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 0.03em;
      }
      .mobile-header-actions {
        display: flex;
        gap: 7px;
        align-items: center;
      }
      .btn-icon-nav {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.06);
        color: #fff;
        font-size: 17px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all var(--trans);
      }
      .btn-icon-nav svg {
        width: 16px;
        height: 16px;
        stroke: currentColor;
        fill: none;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      .btn-icon-nav:hover {
        background: rgba(255, 255, 255, 0.12);
      }
      .btn-icon-gold {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        background: var(--teal);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        font-weight: 700;
      }

      /* ── Bottom Nav ── */
      /* Navegação inferior mobile: atalhos principais no celular. */
      .bottom-nav {
        display: none;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.97);
        border-top: 1px solid var(--grey-l);
        z-index: 150;
        padding-bottom: max(env(safe-area-inset-bottom, 0px), 4px);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
      }
      .bottom-nav-inner {
        display: flex;
      }
      .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 10px 2px 8px;
        cursor: pointer;
        color: var(--grey);
        min-width: 0;
        overflow: hidden;
        transition: color var(--trans);
      }
      .bottom-nav-item.active {
        color: var(--navy);
      }
      .bn-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
      }
      .bn-icon svg {
        width: 20px;
        height: 20px;
        stroke: currentColor;
        fill: none;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
      }
      .bn-label {
        font-size: 9px;
        font-weight: 600;
        letter-spacing: 0.02em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
      }
      .bottom-nav-dot {
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: var(--teal);
        opacity: 0;
        margin-top: 2px;
      }
      .bottom-nav-item.active .bottom-nav-dot {
        opacity: 1;
      }
      .mobile-content {
        padding: 14px 12px
          calc(80px + max(env(safe-area-inset-bottom, 0px), 4px));
        flex: 1;
      }

      /* ── Mobile Drawer Backdrop ── */
      .mobile-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(10, 20, 38, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s;
        z-index: 205;
      }
      .mobile-drawer-backdrop.open {
        opacity: 1;
        pointer-events: auto;
      }

      /* ── Responsive ── */
      /* Responsividade tablet/mobile: regras aplicadas até 1024px. */
      @media (max-width: 1024px) {
        .sidebar {
          transform: translateX(-110%);
          box-shadow: 24px 0 48px rgba(10, 20, 38, 0.2);
        }
        .sidebar.open {
          transform: translateX(0);
        }
        .main-content {
          margin-left: 0;
          max-width: 100vw;
        }
        .mobile-header {
          display: flex;
        }
        .bottom-nav {
          display: block;
        }
        .desktop-only {
          display: none !important;
        }
        .grid-4 {
          grid-template-columns: 1fr 1fr;
        }
        body.sidebar-open {
          overflow: hidden;
          position: fixed;
          width: 100%;
          left: 0;
          right: 0;
        }
      }
      @media (min-width: 1025px) {
        .mobile-only {
          display: none !important;
        }
        .mobile-header {
          display: none !important;
        }
        .bottom-nav {
          display: none !important;
        }
        .mobile-content {
          padding: 0;
          flex: 1;
        }
      }
      /* Responsividade celular: ajustes para telas pequenas. */
      @media (max-width: 640px) {
        .grid-2,
        .grid-3,
        .grid-4 {
          grid-template-columns: 1fr;
        }
      }
      @media (min-width: 641px) and (max-width: 1024px) {
        .grid-3,
        .grid-4 {
          grid-template-columns: 1fr 1fr;
        }
        .mobile-content {
          padding: 18px 16px 92px;
          flex: 1;
        }
      }
