/* =========================================
   SIDEBAR E GAVETAS - MOBILE (BOTTOM NAV)
   Arquivo: /assets/css/mobile/sidebar.css
   ========================================= */

@media (max-width: 1024px) {

    /* --- 1. BARRA INFERIOR (BOTTOM NAV) --- */
    .site-sidebar {
        background: var(--cor-quase-preto, #1C1C1C);
        width: 100% !important; 
        height: 70px !important; 
        position: fixed !important; 
        top: auto !important; bottom: 0 !important; 
        left: 0 !important; right: 0 !important;
        z-index: 3000;
        display: flex; flex-direction: row; 
        align-items: center; justify-content: space-around; 
        padding: 0; 
        border-top: 1px solid rgba(255,255,255,0.1);
        border-right: none;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
        transform: none !important; 
    }
    
    body.scrolled-header .site-sidebar {
        top: auto !important; height: 70px !important; padding: 0;
    }
    
    .site-sidebar.active { box-shadow: none; }

    .sidebar-menu { 
        width: 100%; height: 100%;
        display: flex; flex-direction: row; 
        justify-content: space-evenly; align-items: center;
        gap: 0; padding: 0;
    }

    .sidebar-btn {
        background: transparent; border: none; cursor: pointer; 
        color: #9E9E9E; 
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        width: auto; flex: 1; height: 100%; padding: 5px 0; 
        transition: all 0.2s ease;
        border-left: none; border-top: 3px solid transparent; 
        position: relative;
    }

    .sidebar-btn.active-btn { 
        background: rgba(255,255,255,0.05); 
        color: var(--cor-branco, #fff); 
        border-left-color: transparent;
        border-top-color: var(--cor-principal, #0067ab); 
    }

    /* ÍCONE */
    .sidebar-btn .icon-box { 
        width: 30px; height: 30px; margin-bottom: 4px; 
        display: flex; align-items: center; justify-content: center; 
        background: transparent; border-radius: 0;
        transition: transform 0.2s;
    }
    .sidebar-btn.active-btn .icon-box { transform: translateY(-2px); background: transparent; }

    .sidebar-btn .icon-box img { 
        width: 100%; height: 100%; object-fit: contain; opacity: 0.6; 
        filter: grayscale(100%) brightness(1.5); transition: all 0.2s; 
    }
    .sidebar-btn.active-btn .icon-box img { opacity: 1; filter: grayscale(0%) brightness(1); }
    
    .sidebar-btn span { 
        font-size: 10px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; display: block;
    }


    /* --- 2. GAVETA DE PRODUTOS (SOBE DO FUNDO) --- */
    .product-drawer {
        position: fixed; left: 0 !important; right: 0 !important; width: 100% !important;
        top: 0 !important; bottom: 70px !important; height: auto !important; 
        background: var(--cor-fundo-site, #f4f6f8); 
        z-index: 2900; 
        transform: translateY(100%); 
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
        display: flex; flex-direction: column; padding-top: 0;
    }

    body.scrolled-header .product-drawer {
        top: 0 !important; height: auto !important; bottom: 70px !important;
    }

    .product-drawer.active { transform: translateY(0); }

    /* Botão Fechar Gaveta */
    .close-btn-circle {
        position: absolute; top: 15px; right: 15px; width: 42px; height: 42px; 
        font-size: 20px; background: var(--cor-branco, #fff); color: var(--cor-preto, #000); 
        border: 1px solid rgba(0,0,0,0.1); border-radius: 50%;
        display: flex; align-items: center; justify-content: center; z-index: 20; 
        cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    .close-btn-circle:active { transform: scale(0.95); background: #f0f0f0; }

    
    /* --- 3. HEADER PROMOCIONAL --- */
    .drawer-promo-header {
        padding: 25px 20px 20px; background: var(--cor-branco, #fff);
        display: flex; flex-direction: column; gap: 15px;
        border-bottom: 1px solid rgba(0,0,0,0.06); box-shadow: 0 5px 15px rgba(0,0,0,0.03);
        margin-bottom: 20px; border-radius: 0 0 20px 20px; position: relative; z-index: 5;
    }

    .drawer-main-title { 
        font-size: 24px; color: var(--cor-preto, #000); font-weight: 900; letter-spacing: -0.5px;
        margin: 0; line-height: 1.1; padding-right: 50px; text-align: left;
    }

    .promo-text-col p {
        font-size: 13px; color: var(--cor-texto-medio, #555); margin: 5px 0 15px;
    }

    .promo-img-col {
        position: relative; overflow: hidden; display: flex; justify-content: center;
        width: 100%; height: auto; min-height: 140px;
        background: #f9f9f9; border-radius: 12px; padding: 15px;
        margin-bottom: 10px; border: 1px solid rgba(0,0,0,0.03);
    }
    .promo-img-col img { max-height: 250px; max-width: 100%; object-fit: contain; }

    /* Botão Download */
    .btn-banner-download {
        display: flex; width: 100%; padding: 14px;
        background: var(--cor-principal, #0067ab); color: var(--cor-branco, #fff); border-radius: 10px;
        font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
        justify-content: center; align-items: center; gap: 10px; text-decoration: none;
        box-shadow: 0 5px 15px rgba(0, 103, 171, 0.25);
    }

    /* Ajuste Hero Serviços */
    #panel-servicos .drawer-promo-header {
        padding: 40px 20px;
        background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
        margin-bottom: 0;
    }
    #panel-servicos .btn-banner-download {
        background-color: #28a745;
        box-shadow: 0 5px 15px rgba(40, 167, 69, 0.25);
    }
    #panel-servicos .btn-banner-download:active { background-color: #218838; }


    /* Conteúdo Scroll */
    .drawer-scroll-content { 
        flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
        padding: 0 20px 40px 20px; 
    }
    
    .subcategory-title { 
        font-size: 13px; color: var(--cor-texto-medio, #555); 
        margin: 10px 0 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
        display: flex; align-items: center; gap: 10px;
    }
    .subcategory-title::after { content: ''; flex: 1; height: 1px; background: #e0e0e0; }
    .sub-divider { display: none; }

    /* Grid */
    .drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
    
    .drawer-item {
        background: var(--cor-branco, #fff); padding: 15px 10px; border-radius: 12px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.02);
        display: flex; flex-direction: column; align-items: center; text-align: center;
        position: relative; overflow: hidden;
    }
    .drawer-item:active { transform: scale(0.96); background: #fcfcfc; }
    
    .drawer-item img { 
        width: 100%; aspect-ratio: 16/9; object-fit: contain; 
        margin-bottom: 10px; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.05)); 
    }
    .drawer-item span { font-size: 11px; color: var(--cor-texto-forte, #222); font-weight: 700; line-height: 1.3; }


    /* --- 4. MODAL DE PRODUTO ÚNICO --- */
    .modal-overlay { 
        position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
        background: rgba(0,0,0,0.95); z-index: 99999; 
        display: flex; align-items: center; justify-content: center; 
        opacity: 0; visibility: hidden; transition: 0.3s; padding: 15px; backdrop-filter: blur(8px);
    }
    .modal-overlay.active { opacity: 1; visibility: visible; }
    
    .modal-content { 
        background: var(--cor-branco, #fff); width: 100%; max-height: 85vh; border-radius: 20px; 
        overflow-y: auto; position: relative; display: flex; flex-direction: column; 
        box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    }
    
    .modal-close { 
        position: absolute; top: 15px; right: 15px; z-index: 20; 
        background: rgba(255,255,255,0.9); border-radius: 50%; width: 40px; height: 40px; 
        border: 1px solid rgba(0,0,0,0.1); font-size: 22px; display: flex; align-items: center; justify-content: center;
    }

    .modal-gallery-area { padding: 30px 20px 20px; background: var(--cor-branco, #fff); border-bottom: 1px solid #f0f0f0; }
    
    .main-img-box { 
        width: 100%; aspect-ratio: 16/9; background: var(--cor-branco, #fff); 
        display: flex; align-items: center; justify-content: center;
    }
    .main-img-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
    
    .thumbs-row { display: flex; gap: 8px; justify-content: center; margin-top: 15px; overflow-x: auto; }
    .thumb-img { width: 50px; height: 35px; border-radius: 4px; border: 2px solid transparent; background: #f9f9f9; }
    .thumb-img.active { border-color: var(--cor-principal, #0067ab); transform: scale(1.05); }
    .nav-arrow { display: none; } 

    .modal-info { padding: 25px 20px; background: var(--cor-branco, #fff); }
    .modal-info h3 { font-size: 22px; margin-top: 0; margin-bottom: 10px; font-weight: 900; line-height: 1.2; color: var(--cor-preto, #000); }
    .modal-desc { font-size: 14px; color: var(--cor-texto-medio, #555); line-height: 1.5; margin-bottom: 20px; }
    
    .btn-whatsapp-modal { 
        display: flex; width: 100%; padding: 16px; 
        background: #25D366; 
        color: white; font-weight: 800; border-radius: 10px; 
        justify-content: center; align-items: center; gap: 8px; text-decoration: none; 
        font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;
        box-shadow: 0 8px 25px rgba(37,211,102,0.3);
    }

    /* =======================================================
       5. MODAL GATE (LEAD FORM) - DESIGN COM BOTÃO EMBAIXO
       ======================================================= */
    #modal-gate.modal-container {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.9); z-index: 10000;
        display: flex; align-items: center; justify-content: center;
        padding: 15px; backdrop-filter: blur(5px);
    }
    
    /* Configuração Flex para reordenar elementos */
    #modal-gate .modal-content.form-content {
        width: 100%; max-width: 100%; padding: 35px 25px;
        border-radius: 16px; background: var(--cor-branco, #fff);
        text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5);
        max-height: 90vh; overflow-y: auto;
        
        display: flex; 
        flex-direction: column; /* Empilha: Header > Form > Botão Fechar */
    }

    /* Ordem dos elementos */
    #modal-gate .form-header { order: 1; }
    #modal-gate form { order: 2; width: 100%; }
    #modal-gate .fechar-modal-btn-2 { order: 3; } /* Joga o botão para o final */

    /* === BOTÃO "CANCELAR" (Antigo X) === */
    #modal-gate .fechar-modal-btn-2 {
        position: static; /* Remove posição absoluta */
        width: 100%; 
        height: auto; 
        padding: 16px;
        margin-top: 10px;
        
        background: transparent;
        border: 2px solid #ddd;
        border-radius: 8px;
        color: #999;
        
        font-size: 14px;
        font-weight: 800;
        text-transform: uppercase;
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        z-index: 1;
        transition: all 0.2s;
    }
    
    /* Remove os traços do "X" */
    #modal-gate .fechar-modal-btn-2::before, 
    #modal-gate .fechar-modal-btn-2::after {
        display: none;
    }
    
    /* Injeta o texto "CANCELAR" */
    #modal-gate .fechar-modal-btn-2::after {
        content: 'CANCELAR';
        display: block;
        transform: none;
        width: auto; height: auto;
        background: transparent;
        color: inherit;
    }
    
    #modal-gate .fechar-modal-btn-2:active {
        background: #f5f5f5; 
        color: #666; 
        border-color: #ccc;
    }

    /* --- FIM DO BOTÃO AJUSTADO --- */
    #modal-gate .form-header h3 { 
        font-size: 22px; color: var(--cor-principal, #0067ab); margin-bottom: 10px; font-weight: 800;
    }
    #modal-gate .form-header p { 
        font-size: 13px; color: #666; margin-bottom: 20px; line-height: 1.4;
    }

    #modal-gate .form-group input {
        width: 100%; padding: 14px; margin-bottom: 10px;
        border: 1px solid #ddd; border-radius: 8px; font-size: 16px;
        background: #f9f9f9; box-sizing: border-box;
    }

    #modal-gate .checkbox-wrapper {
        display: flex; gap: 10px; align-items: flex-start; justify-content: flex-start;
        margin-bottom: 20px; text-align: left;
        background: #f5f5f5; padding: 10px; border-radius: 8px;
    }
    #modal-gate .checkbox-wrapper input { 
        width: 24px; height: 24px; margin: 0; flex-shrink: 0; 
    }
    #modal-gate .checkbox-wrapper label { font-size: 12px; line-height: 1.4; color: #555; margin-top: 2px; }
    #modal-gate .checkbox-wrapper a { color: var(--cor-principal, #0067ab); font-weight: 700; text-decoration: none; }

    #modal-gate .btn-enviar-form {
        width: 100%; padding: 16px; 
        background: var(--cor-principal, #0067ab); color: #fff;
        border: none; border-radius: 8px; font-size: 15px; font-weight: 800;
        text-transform: uppercase; letter-spacing: 0.5px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    }
    #modal-gate .btn-enviar-form:active { transform: translateY(2px); }

    /* --- 6. REMOVER FAB E AJUSTE SETAS --- */
    .mobile-sidebar-toggle { display: none !important; }

    .header-nav-arrow {
        position: absolute; top: 50%; transform: translateY(-50%);
        width: 30px; height: 30px;
        background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(4px);
        border: 1px solid rgba(0, 0, 0, 0.05); border-radius: 50%;
        color: var(--cor-principal, #0067ab); display: flex; align-items: center; justify-content: center;
        z-index: 15; font-size: 12px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    }
    .header-nav-arrow.prev { left: 8px; }
    .header-nav-arrow.next { right: 8px; }

    .header-active-img { transition: opacity 0.3s ease-in-out; display: block; max-width: 100%; height: auto; }
    .header-active-img.fading { opacity: 0.3; }
}