/* ========== MOBILE FIRST APPROACH ========== */

/* Extra Small Devices (Phones < 576px) */
@media (max-width: 575.98px) {
    /* Header e Navigation - CORRIGIDO LOGO CORTADO */
    .navbar-brand {
        margin-left: 0 !important;
        padding-left: 0 !important;
    }
    
    .navbar-brand img {
        width: 120px;
        margin-left: 0;
    }
    
    .navbar-toggler {
        border: none;
        padding: 4px 8px;
    }
    
    .navbar-toggler-icon i {
        font-size: 24px;
    }
    
    .nav-link {
        padding: 10px 15px !important;
        font-size: 16px;
    }
    
    /* Banner Section */
    .banner {
        padding-top: 80px;
        padding-bottom: 50px;
    }
    
    .text-banner h1 {
        font-size: 32px;
        line-height: 1.2;
    }
    
    .text-banner p {
        font-size: 16px;
        margin-bottom: 20px;
    }
    
    .btn {
        font-size: 16px !important;
        padding: 12px 20px !important;
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-icon-left {
        padding-left: 50px;
    }
    
    .btn-icon-left span.icon-left {
        width: 35px;
        height: 35px;
        margin-left: -45px;
        margin-top: -6px;
    }
    
    /* Social Buttons */
    .btn-social {
        display: inline-block;
        width: auto !important;
        margin-right: 5px !important;
    }
    
    /* Services Section */
    .servicos {
        padding: 60px 0;
    }
    
    .hint-title {
        font-size: 14px;
    }
    
    .title {
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .card-icon {
        height: 120px;
        margin-bottom: 20px;
    }
    
    .card-icon img {
        max-width: 80px;
    }
    
    .card-text {
        padding: 0 15px;
    }
    
    .card-text p {
        font-size: 18px;
    }
    
    .card-text span {
        font-size: 14px;
    }
    
    /* Menu Categories */
    .container-menu {
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 20px;
        justify-content: center;
    }
    
    .container-menu a {
        flex: 0 0 calc(50% - 5px);
        font-size: 12px !important;
        padding: 8px 5px !important;
        text-align: center;
        margin: 2px;
    }
    
    .container-menu a span {
        font-size: 11px;
    }
    
    .container-menu i {
        display: none !important;
    }
    
    /* Product Cards */
    .card-item {
        height: 200px;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .card-item .title-produto {
        font-size: 16px;
    }
    
    .card-item .dsc-produto {
        font-size: 12px;
        height: 35px;
    }
    
    .card-item .price-produto {
        font-size: 20px;
    }
    
    .card-item:hover .price-produto {
        font-size: 22px;
    }
    
    /* === CORREÇÃO DO SELETOR DE QUANTIDADE === */
    .card-item .add-carrinho {
        flex-wrap: wrap;
        padding: 0 10px;
    }
    
    .add-numero-itens {
        padding: 8px 12px !important;
        font-size: 14px !important;
        min-width: 40px !important;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 !important;
        text-align: center;
    }
    
    .btn-menos, .btn-mais {
        padding: 8px 10px !important;
        font-size: 14px !important;
        min-width: 35px !important;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 !important;
    }
    
    .btn-add {
        font-size: 13px !important;
        padding: 6px 12px !important;
        margin-left: 8px !important;
        height: 35px;
        display: flex;
        align-items: center;
        white-space: nowrap;
    }
    
    /* Testimonials */
    .depoimento {
        margin-top: 30px;
    }
    
    .nome-depoimento {
        font-size: 18px;
    }
    
    .texto-depoimento {
        font-size: 14px;
    }
    
    .texto-depoimento i {
        font-size: 24px;
    }
    
    /* Reservation Section */
    .card-secondary {
        padding: 40px 20px;
        border-radius: 30px;
    }
    
    /* Footer */
    .rodape {
        padding: 30px 0;
    }
    
    .container-logo-footer, 
    .container-texto-footer, 
    .container-redes-footer {
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .logo-footer {
        width: 100px;
    }
    
    /* === CORREÇÃO DO MODAL CARRINHO === */
    .modal-full {
        padding: 15px !important;
        display: flex;
        flex-direction: column;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .m-header {
        padding: 15px;
        padding-bottom: 15px;
        background-color: var(--color-white);
        position: sticky;
        top: 0;
        z-index: 100;
        border-bottom: 1px solid var(--color-separate);
        min-height: 120px;
    }
    
    .m-body {
        flex: 1;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 15px;
        padding-bottom: 20px;
    }
    
    /* === CORREÇÃO DO FOOTER DO MODAL === */
    .m-footer {
        position: sticky !important;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--color-white);
        padding: 15px !important;
        box-shadow: 0px -5px 15px rgba(0, 0, 0, 0.1);
        z-index: 100;
        border-top: 1px solid var(--color-separate);
    }
    
    /* === CORREÇÃO PARA O BOTÃO FECHAR === */
    .m-header .btn.float-right {
        position: absolute;
        right: 15px;
        top: 15px;
        font-size: 13px !important;
        padding: 5px 12px !important;
        margin: 0 !important;
        float: none !important;
        z-index: 101;
    }
    
    /* === CORREÇÃO DA ÁREA DAS ETAPAS === */
    .etapas {
        transform: scale(0.85);
        justify-content: center;
        margin: 10px 0;
        margin-top: 40px;
        display: flex;
    }
    
    .etapa {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        margin-right: 12px !important;
    }
    
    .etapa::before {
        width: 12px !important;
        margin-left: 42px !important;
    }
    
    .etapa:last-child {
        margin-right: 0 !important;
    }
    
    .title-carrinho {
        font-size: 16px !important;
        margin-top: 10px !important;
        text-align: center;
    }
    
    /* === CORREÇÃO DOS ITENS DO CARRINHO === */
    .modal-full .item-carrinho {
        padding: 12px 8px !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 10px;
        display: flex !important;
    }
    
    .modal-full .dados-produto {
        flex: 1;
        margin-bottom: 0 !important;
        padding-right: 10px !important;
        width: auto !important;
        text-align: left !important;
    }
    
    .modal-full .title-produto {
        font-size: 14px !important;
        line-height: 1.2;
        margin-bottom: 3px !important;
    }
    
    .modal-full .price-produto {
        font-size: 14px !important;
    }
    
    /* Controles de quantidade no carrinho */
    .modal-full .add-carrinho {
        width: auto !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 5px;
        display: flex !important;
        justify-content: center;
    }
    
    .modal-full .add-carrinho .btn-menos,
    .modal-full .add-carrinho .btn-mais {
        min-width: 28px !important;
        height: 28px !important;
        padding: 4px 6px !important;
        font-size: 12px !important;
    }
    
    .modal-full .add-carrinho .add-numero-itens {
        min-width: 35px !important;
        padding: 4px 8px !important;
        font-size: 13px !important;
        height: 28px !important;
    }
    
    .btn-remove {
        display: inline-block !important;
        margin-top: 5px !important;
        margin-left: 0 !important;
        font-size: 12px !important;
        padding: 3px 8px !important;
    }
    
    /* === CORREÇÃO DOS BOTÕES DE TIPO DE PEDIDO === */
    .btn-group-toggle {
        flex-direction: row !important;
        gap: 0 !important;
        width: 100% !important;
        box-shadow: 0px 5px 10px -3px rgba(0, 0, 0, 0.1) !important;
        display: flex !important;
    }
    
    .btn-group-toggle .btn {
        width: 50% !important;
        font-size: 14px !important;
        padding: 10px 5px !important;
        border-radius: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 5px !important;
    }
    
    .btn-group-toggle .btn:first-child {
        border-top-left-radius: 20px !important;
        border-bottom-left-radius: 20px !important;
    }
    
    .btn-group-toggle .btn:last-child {
        border-top-right-radius: 20px !important;
        border-bottom-right-radius: 20px !important;
    }
    
    .btn-group-toggle .btn i {
        font-size: 18px;
    }
    
    /* Form Controls */
    .form-control {
        font-size: 16px !important;
        padding: 12px 20px !important;
        height: 45px !important;
    }
    
    select.form-control {
        height: 45px !important;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 5px;
        font-weight: 600;
        color: var(--color-black);
    }
    
    /* === CORREÇÃO DA ÁREA DO CEP === */
    .container-cep {
        position: relative;
        margin-bottom: 15px;
    }
    
    .container-cep .form-control {
        padding-right: 50px !important;
    }
    
    .container-cep .btn {
        position: absolute;
        top: 32px !important;
        right: 5px !important;
        width: 40px;
        height: 35px;
        padding: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px !important;
    }
    
    /* === CORREÇÃO DOS CAMPOS DE ENDEREÇO === */
    .campos-endereco {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        margin: 0 -5px;
    }
    
    .campos-endereco .form-group {
        margin-bottom: 12px;
    }
    
    .campos-endereco > div {
        padding: 0 5px;
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    /* Campos que podem ser menores */
    .campos-endereco .col-lg-2 {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50% !important;
    }
    
    /* Info Card */
    .card-info-retirada {
        margin: 15px 0;
    }
    
    .card-info-retirada h5 {
        font-size: 18px;
    }
    
    .card-info-retirada p {
        font-size: 14px;
    }
    
    /* === CORREÇÃO DO RESUMO DO CARRINHO === */
    #resumoCarrinho .item-carrinho {
        padding: 12px 8px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 10px !important;
    }
    
    #resumoCarrinho .item-carrinho.resumo {
        padding: 12px !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px;
    }
    
    .img-map {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
        flex-shrink: 0;
        background-color: var(--color-secondary);
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #resumoCarrinho .dados-produto {
        flex: 1;
        text-align: left !important;
    }
    
    #resumoCarrinho .texto-endereco,
    #resumoCarrinho .cidade-endereco {
        font-size: 14px !important;
        line-height: 1.3;
        margin-bottom: 3px !important;
    }
    
    /* Total Container */
    .container-total {
        padding: 10px 0 !important;
        margin-bottom: 10px !important;
    }
    
    .container-total p {
        font-size: 14px !important;
        margin-bottom: 3px !important;
    }
    
    .container-total .valor-total {
        font-size: 18px !important;
    }
    
    /* Botões do footer */
    .m-footer .btn {
        width: 100% !important;
        margin-bottom: 8px !important;
        font-size: 14px !important;
        padding: 10px 15px !important;
        float: none !important;
    }
    
    .m-footer #btnVoltar {
        margin-right: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* === CORREÇÃO PARA O BOTÃO FECHAR === */
    .m-header .btn.float-right {
        position: absolute;
        right: 15px;
        top: 15px;
        font-size: 13px !important;
        padding: 5px 12px !important;
        margin: 0 !important;
        float: none !important;
    }
    
    /* Fixed Cart Button */
    .botao-carrinho {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .badge-total-carrinho {
        font-size: 12px;
    }
    
    /* Messages */
    .container-mensagens {
        right: 10px;
        top: 10px;
        left: 10px;
        z-index: 9999;
    }
    
    .toast {
        font-size: 14px;
        padding: 8px 15px;
        margin: 0 auto;
        max-width: 90%;
    }
    
    /* === AJUSTES ADICIONAIS === */
    
    /* Evitar que o conteúdo fique muito próximo das bordas */
    #itensCarrinho,
    #localEntrega,
    #resumoCarrinho {
        padding: 0 5px;
    }
    
    /* Melhorar espaçamento entre seções */
    #localEntrega .col-12,
    #resumoCarrinho .col-12 {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    /* UF ao lado do número */
    #txtNumero, #ddlUF {
        width: 100%;
    }
}

/* Small Devices (Landscape Phones & Small Tablets 576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Banner */
    .text-banner h1 {
        font-size: 40px;
    }
    
    .text-banner p {
        font-size: 18px;
    }
    
    /* Menu Categories */
    .container-menu {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .container-menu a {
        flex: 0 0 calc(33.333% - 8px);
        font-size: 14px !important;
    }
    
    /* Product Cards */
    .card-item {
        height: 210px;
    }
    
    /* Modal */
    .modal-full {
        padding: 20px !important;
    }
    
    /* Type Selection */
    .btn-group-toggle {
        flex-direction: row !important;
    }
    
    .btn-group-toggle .btn {
        flex: 1;
        width: 50% !important;
    }
    
    /* Etapas */
    .etapas {
        transform: scale(0.9);
    }
    
    .etapa {
        width: 35px !important;
        height: 35px !important;
    }
    
    /* Campos de endereço em grid */
    .campos-endereco .col-lg-2,
    .campos-endereco .col-lg-4 {
        width: 50% !important;
        max-width: 50% !important;
        flex: 0 0 50% !important;
    }
    
    .campos-endereco .col-lg-6 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* Medium Devices (Tablets 768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Navigation */
    .navbar-brand {
        margin-left: 0 !important;
    }
    
    .nav-link {
        padding-left: 20px !important;
        padding-right: 20px !important;
        font-size: 16px;
    }
    
    /* Banner */
    .text-banner h1 {
        font-size: 45px;
    }
    
    /* Menu Categories */
    .container-menu {
        gap: 10px;
    }
    
    .container-menu a {
        flex: 0 0 auto;
        padding: 10px 15px !important;
    }
    
    /* Cards Grid */
    .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    /* Cart Modal */
    .modal-full {
        padding: 40px;
    }
    
    /* Form Grid */
    .col-md-4, .col-md-6 {
        margin-bottom: 15px;
    }
}

/* Large Devices (Desktops 992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Banner */
    .text-banner h1 {
        font-size: 50px;
    }
    
    /* Product Cards */
    .card-item {
        height: 240px;
    }
}

/* Extra Large Devices (Large Desktops 1200px+) */
@media (min-width: 1200px) {
    /* Default styles from main CSS apply */
}

/* ========== UTILITY CLASSES ========== */

/* Hide on Mobile */
@media (max-width: 767.98px) {
    .no-mobile {
        display: none !important;
    }
}

/* Hide on Desktop */
@media (min-width: 768px) {
    .no-desktop {
        display: none !important;
    }
}

/* ========== ORIENTATION SPECIFIC ========== */

/* Landscape Mode for Small Devices */
@media (max-width: 767.98px) and (orientation: landscape) {
    .banner {
        padding-top: 60px;
        padding-bottom: 30px;
    }
    
    .text-banner h1 {
        font-size: 28px;
    }
    
    .modal-full {
        padding: 15px;
    }
    
    .m-body {
        max-height: 300px;
    }
    
    /* Ajustar categorias em landscape */
    .container-menu a {
        flex: 0 0 calc(25% - 5px);
        font-size: 12px !important;
        padding: 6px 8px !important;
    }
}

/* ========== HIGH DPI SCREENS ========== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders and shadows for retina displays */
    .card, .btn, .form-control {
        box-shadow: 0px 5px 10px -2px rgba(0, 0, 0, 0.1);
    }
}

/* ========== ACCESSIBILITY ========== */

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles here if needed */
}

/* ========== PRINT STYLES ========== */

@media print {
    .no-print,
    .navbar,
    .botao-carrinho,
    .container-mensagens,
    .btn {
        display: none !important;
    }
    
    .modal-full {
        position: static;
        padding: 0;
    }
}

/* ========== FIXES FOR SPECIFIC ISSUES ========== */

/* Fix horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
}

/* Ensure touch targets are large enough */
@media (max-width: 767.98px) {
    button, a, .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Melhorar área de toque dos controles de quantidade */
    .btn-menos, .btn-mais {
        min-width: 35px;
        min-height: 35px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-add {
        min-width: 40px;
        min-height: 35px;
    }
}

/* Fix input zoom on iOS */
@media (max-width: 767.98px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Correção para scroll suave em iOS */
@media (max-width: 767.98px) {
    .modal-full,
    .m-body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Prevenir zoom em inputs no iOS */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 767.98px) {
        input[type="text"],
        input[type="email"],
        input[type="tel"],
        input[type="number"],
        select,
        textarea {
            font-size: 16px !important;
        }
    }
}