/* ==========================================================================
   PRODUT — MOBILE APP-LIKE NAVIGATION (BOTTOM NAV & HEADER DRAWER)
   Design System: Branco Tecnológico, Grafite Profundo, Laranja PRODUT (#ff4b18)
   ========================================================================== */

:root {
  --mobile-nav-height: 62px;
  --mobile-header-height: 56px;
  --produt-orange: #ff4b18;
  --produt-orange-glow: rgba(255, 75, 24, 0.35);
  --mobile-glass: rgba(255, 255, 255, 0.92);
  --mobile-glass-dark: rgba(17, 23, 25, 0.95);
  --mobile-border: rgba(17, 23, 24, 0.08);
}

/* Ocultar completamente em telas Desktop (> 800px) */
@media (min-width: 801px) {
  .mobile-bottom-nav,
  .mobile-app-header,
  .mobile-menu-drawer,
  .mobile-drawer-backdrop {
    display: none !important;
  }
}

/* Regras Mobile & Tablet (<= 800px) */
@media (max-width: 800px) {
  /* Blindagem contra scroll horizontal acidental */
  html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
  }

  /* Suprimir docks e barras concorrentes no mobile */
  .commercial-dock {
    display: none !important;
  }

  /* Garantir que o rodapé e conteúdos não fiquem cobertos pela Bottom Bar */
  body {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 16px) + 24px) !important;
  }

  body.drawer-open {
    overflow: hidden !important;
    touch-action: none;
  }

  /* --------------------------------------------------------------------------
     1. MOBILE HEADER COMPACTO (SUPERIOR)
     -------------------------------------------------------------------------- */
  .mobile-app-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    height: var(--mobile-header-height);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(245, 243, 238, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--mobile-border);
    transition: transform 0.3s ease, background 0.3s ease;
  }

  .mobile-header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--ink);
    flex-shrink: 1;
    min-width: 0;
  }

  .mobile-header-brand svg {
    height: 18px;
    width: auto;
    max-width: 145px;
    display: block;
  }

  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  /* Botão Rápido WhatsApp no Header */
  .mobile-wa-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #25d36618;
    border: 1px solid rgba(37, 211, 102, 0.35);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #128c7e;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-wa-pill:active {
    transform: scale(0.94);
    background: #25d36628;
  }

  .mobile-wa-pill .online-dot {
    width: 6px;
    height: 6px;
    background: #25d366;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(37, 211, 102, 0.8);
    display: inline-block;
  }

  /* Botão Menu Hambúrguer Drawer */
  .mobile-drawer-toggle {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid rgba(17, 23, 24, 0.12);
    border-radius: 10px;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
  }

  .mobile-drawer-toggle:active {
    transform: scale(0.92);
    background: rgba(17, 23, 24, 0.05);
  }

  .mobile-drawer-toggle svg {
    width: 18px;
    height: 18px;
  }

  /* --------------------------------------------------------------------------
     2. BOTTOM NAVIGATION BAR (INFERIOR FIXA APP-LIKE)
     -------------------------------------------------------------------------- */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    z-index: 999;
    background: var(--mobile-glass);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--mobile-border);
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.07);
    padding-bottom: env(safe-area-inset-bottom, 8px);
    user-select: none;
    -webkit-user-select: none;
  }

  .bottom-nav-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    height: var(--mobile-nav-height);
    position: relative;
    box-sizing: border-box;
    padding: 0 2px;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    position: relative;
    padding: 6px 1px;
    min-width: 0;
    box-sizing: border-box;
    text-decoration: none;
    color: #626f75;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav-item:active {
    transform: scale(0.9);
  }

  .bottom-nav-icon-wrap {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bottom-nav-icon-wrap svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease;
  }

  .bottom-nav-label {
    line-height: 1.1;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.2s ease, font-weight 0.2s ease;
  }

  /* Indicador Visual do Destino Ativo */
  .bottom-nav-indicator {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 20px;
    height: 3px;
    background: var(--produt-orange);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 2px 8px var(--produt-orange-glow);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Estado Ativo */
  .bottom-nav-item.is-active {
    color: var(--produt-orange);
    font-weight: 700;
  }

  .bottom-nav-item.is-active .bottom-nav-icon-wrap {
    transform: translateY(-2px);
  }

  .bottom-nav-item.is-active .bottom-nav-indicator {
    transform: translateX(-50%) scaleX(1);
  }

  /* Estilização especial para item Contato / WhatsApp */
  .bottom-nav-item.is-contact {
    color: #1a8754;
  }
  .bottom-nav-item.is-contact:active {
    color: #12633d;
  }
  .bottom-nav-item.is-contact .bottom-nav-icon-wrap svg {
    stroke: #25d366;
  }
  .bottom-nav-item.is-contact .bottom-nav-label {
    color: #187748;
    font-weight: 600;
  }

  /* --------------------------------------------------------------------------
     3. MENU DRAWER COMPLEMENTAR (BOTTOM SHEET / SLIDE OVER)
     -------------------------------------------------------------------------- */
  .mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 23, 25, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .mobile-drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }

  .mobile-menu-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1001;
    background: #fff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px 20px calc(env(safe-area-inset-bottom, 20px) + 20px);
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .mobile-menu-drawer.is-open {
    transform: translateY(0);
  }

  .drawer-handle-bar {
    width: 44px;
    height: 5px;
    background: #d8deda;
    border-radius: 3px;
    margin: 0 auto 10px;
  }

  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #edf1ee;
    padding-bottom: 14px;
  }

  .drawer-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
  }

  .drawer-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f2f4f1;
    border: none;
    font-size: 20px;
    color: var(--ink);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s;
  }

  .drawer-close-btn:active {
    background: #e2e6e1;
  }

  .drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .drawer-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    background: #f9faf8;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
  }

  .drawer-nav-link:active {
    background: #eef2ec;
    transform: scale(0.98);
  }

  .drawer-nav-link span {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .drawer-nav-link svg {
    width: 18px;
    height: 18px;
    color: var(--produt-orange);
  }

  .drawer-nav-link i {
    font-style: normal;
    color: #929d95;
    font-size: 16px;
  }

  /* Cartão de Contato Comercial WhatsApp no Drawer */
  .drawer-contact-card {
    background: linear-gradient(135deg, #0d1e18, #182e25);
    color: #fff;
    padding: 18px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(37, 211, 102, 0.25);
    margin-top: 6px;
  }

  .drawer-contact-card h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4eed91;
  }

  .drawer-contact-card p {
    margin: 0;
    font-size: 13px;
    color: #c9ded3;
    line-height: 1.5;
  }

  .drawer-wa-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #25d366;
    color: #0b2416;
    font-weight: 700;
    font-size: 14px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    transition: transform 0.15s;
  }

  .drawer-wa-button:active {
    transform: scale(0.96);
  }
}

/* Acessibilidade: Redução de Movimento */
@media (prefers-reduced-motion: reduce) {
  .bottom-nav-item,
  .bottom-nav-indicator,
  .mobile-menu-drawer,
  .mobile-drawer-backdrop {
    transition: none !important;
  }
}
