/* =============================================
   ESTILOS RESPONSIVOS MOBILE - CARDÁPIO DIGITAL
   ============================================= */

/* Ajustes para Desktop e Tablet - garantir layout lado a lado */
@media (min-width: 769px) {
    .store-info {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 6px 12px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .store-status {
        color: #10b981;
        background: rgba(16, 185, 129, 0.1);
        padding: 4px 8px;
        border-radius: 6px;
        border: 1px solid rgba(16, 185, 129, 0.2);
        margin-right: 8px;
    }
    
    .store-details {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .delivery-time,
    .min-order {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
    }
}

/* Desktops grandes (acima de 1200px) */
@media (min-width: 1200px) {
    .store-info {
        gap: 15px;
        padding: 8px 16px;
    }
    
    .store-status {
        font-size: 13px;
        padding: 5px 10px;
        margin-right: 10px;
    }
    
    .delivery-time,
    .min-order {
        font-size: 13px;
        gap: 5px;
    }
    
    .status-icon,
    .detail-icon {
        font-size: 15px;
    }
}

/* Regra geral para todos os dispositivos móveis */
@media (max-width: 768px) {
    /* Prevenir barra de rolagem horizontal */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Garantir ordem correta: sidebar primeiro, depois menu-area */
    .main-content .container {
        display: flex;
        flex-direction: column;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .sidebar {
        order: -1;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .menu-area {
        order: 1;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Smartphones (até 480px) */
@media (max-width: 480px) {
    /* Container geral */
    .container {
        padding: 0 15px;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Header */
    .header-container {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
        height: auto;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        align-items: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-link {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .header-right {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }
    
    .store-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        text-align: center;
    }
    
    .store-status {
        width: 100%;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .store-details {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 10px;
    }
    
    .delivery-time,
    .min-order {
        flex: 1;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
        white-space: nowrap;
    }
    
    /* Hero Banner */
    .hero-banner {
        margin-top: 180px;
        height: 280px;
    }
    
    .hero-content {
        padding: 0 20px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 24px;
        line-height: 1.3;
        margin-bottom: 12px;
    }
    
    .hero-subtitle {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 20px;
    }
    
    .hero-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    /* Main Content */
    .main-content {
        padding: 30px 0;
    }
    
    .main-content .container {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        position: static;
        order: -1;
    }
    
    .sidebar-card {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    .sidebar-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    /* Categorias - Horizontal Scroll */
    .category-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 5px 0 15px 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .category-list::-webkit-scrollbar {
        display: none;
    }
    
    .category-item {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 15px;
        font-size: 13px;
        border-radius: 20px;
        min-width: fit-content;
        max-width: none;
        box-sizing: border-box;
    }
    
    .category-icon {
        font-size: 16px;
        margin-right: 6px;
    }
    
    /* Search */
    .search-container {
        display: flex;
        gap: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .search-input {
        flex: 1;
        padding: 12px 15px;
        font-size: 14px;
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }
    
    .search-submit {
        padding: 12px 15px;
        font-size: 16px;
        flex-shrink: 0;
        box-sizing: border-box;
    }
    
    /* Menu Area */
    .menu-area {
        order: 1;
    }
    
    /* Daily Offers */
    .daily-offers {
        padding: 20px 15px;
        margin-bottom: 25px;
        border-radius: 12px;
    }
    
    .daily-offers-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .daily-offers-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .daily-offers-title h2 {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    .daily-offers-title p {
        font-size: 13px;
    }
    
    .daily-offers-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .offer-card {
        padding: 12px;
        flex-direction: row;
        align-items: center;
        min-height: 100px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }
    
    .offer-image {
        width: 70px;
        height: 70px;
        margin-bottom: 0;
        margin-right: 12px;
        flex-shrink: 0;
    }
    
    .offer-info {
        flex: 1;
        margin-bottom: 0;
    }
    
    .offer-name {
        font-size: 14px;
        margin-bottom: 4px;
        line-height: 1.3;
    }
    
    .offer-description {
        font-size: 12px;
        margin-bottom: 6px;
        line-height: 1.4;
    }
    
    .offer-price-container {
        margin-bottom: 8px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .offer-original-price {
        font-size: 11px;
    }
    
    .offer-price {
        font-size: 15px;
    }
    
    .offer-discount {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .offer-actions {
        flex-direction: column;
        gap: 6px;
        flex-shrink: 0;
        min-width: 80px;
    }
    
    .offer-action,
    .offer-details-btn {
        padding: 6px 8px;
        font-size: 11px;
        white-space: nowrap;
    }
    
    /* Menu Header */
    .menu-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        margin-bottom: 20px;
    }
    
    .menu-title {
        font-size: 20px;
        text-align: center;
    }
    
    .menu-title-icon {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .view-buttons {
        justify-content: center;
        gap: 8px;
    }
    
    .view-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Products Grid */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .product-card {
        border-radius: 12px;
        overflow: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-badges {
        margin-bottom: 8px;
        gap: 6px;
    }
    
    .product-badge {
        font-size: 10px;
        padding: 3px 6px;
    }
    
    .product-name {
        font-size: 15px;
        margin-bottom: 6px;
        line-height: 1.3;
    }
    
    .product-description {
        font-size: 13px;
        margin-bottom: 8px;
        line-height: 1.4;
    }
    
    .offer-price-container {
        margin-bottom: 10px;
        gap: 6px;
    }
    
    .offer-original-price {
        font-size: 12px;
    }
    
    .offer-price {
        font-size: 16px;
    }
    
    .offer-discount {
        font-size: 10px;
        padding: 2px 5px;
    }
    
    .product-category {
        font-size: 11px;
        margin-bottom: 12px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-add,
    .btn-details {
        padding: 10px 15px;
        font-size: 13px;
        border-radius: 6px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
    }
    
    /* Modal */
    .product-modal {
        padding: 20px;
    }
    
    .modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 40px);
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px 20px;
    }
    
    .modal-image {
        height: 180px;
        margin-bottom: 15px;
    }
    
    .modal-info h4 {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .modal-info p {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .modal-price {
        margin-bottom: 12px;
    }
    
    .original-price {
        font-size: 13px;
    }
    
    .current-price {
        font-size: 18px;
    }
    
    .modal-footer {
        padding: 15px 20px;
    }
    
    .modal-add-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
    
    /* Controle de quantidade responsivo */
    .modal-quantity {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .modal-quantity label {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .quantity-controls {
        gap: 8px;
    }
    
    .quantity-input {
        width: 50px;
        height: 36px;
        font-size: 14px;
    }
    
    .quantity-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    /* Modal responsivo */
    .product-modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: none;
        width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-image {
        height: 180px;
        margin-bottom: 15px;
    }
    
    .modal-info h4 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .modal-info p {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .modal-price {
        margin-bottom: 15px;
    }
    
    .original-price {
        font-size: 13px;
    }
    
    .current-price {
        font-size: 20px;
    }
    
    .modal-footer {
        padding: 15px;
    }
    
    .modal-add-btn {
        padding: 12px 20px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* Tablets pequenos (481px a 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    /* Header - manter layout desktop */
    .header-container {
        padding: 15px 20px;
    }
    
    .store-info {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 6px 12px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .store-status {
        color: #10b981;
        background: rgba(16, 185, 129, 0.1);
        padding: 4px 8px;
        border-radius: 6px;
        border: 1px solid rgba(16, 185, 129, 0.2);
        margin-right: 8px;
    }
    
    .store-details {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .delivery-time,
    .min-order {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
    }
    
    .hero-banner {
        margin-top: 140px;
        height: 320px;
    }
    
    .hero-title {
        font-size: 28px;
    }
    
    .hero-subtitle {
        font-size: 15px;
    }
    
    /* Main Content */
    .main-content .container {
        gap: 25px;
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        order: -1;
    }
    
    .store-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        text-align: center;
    }
    
    .store-status {
        width: 100%;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .store-details {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 10px;
    }
    
    .delivery-time,
    .min-order {
        flex: 1;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
        white-space: nowrap;
    }
    
    .category-list {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 15px;
    }
    
    .category-item {
        flex-shrink: 0;
        white-space: nowrap;
    }
    
    /* Daily Offers */
    .daily-offers-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .offer-card {
        flex-direction: column;
        text-align: center;
    }
    
    .offer-image {
        width: 100%;
        height: 120px;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .offer-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 6px;
    }
}

/* Landscape orientation para mobile */
@media (max-width: 768px) and (orientation: landscape) {
    /* Main Content */
    .main-content .container {
        flex-direction: column;
        gap: 20px;
    }
    
    /* Sidebar */
    .sidebar {
        width: 100%;
        order: -1;
    }
    
    .store-info {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
        text-align: center;
    }
    
    .store-status {
        width: 100%;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .store-details {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 10px;
    }
    
    .delivery-time,
    .min-order {
        flex: 1;
        justify-content: center;
        font-size: 11px;
        padding: 3px 6px;
        white-space: nowrap;
    }
    
    .hero-banner {
        margin-top: 120px;
        height: 200px;
    }
    
    .hero-title {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .hero-subtitle {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .daily-offers {
        padding: 15px;
    }
    
    .offer-card {
        min-height: 80px;
        padding: 8px;
    }
    
    .offer-image {
        width: 50px;
        height: 50px;
    }
    
    .offer-name {
        font-size: 12px;
    }
    
    .offer-description {
        display: none;
    }
    
    .product-image {
        height: 140px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 13px;
    }
    
    .product-description {
        font-size: 11px;
        margin-bottom: 6px;
    }
}

/* Ajustes para iOS Safari */
@supports (-webkit-touch-callout: none) {
    .header {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .product-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .offer-card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Melhorias para touch */
@media (hover: none) and (pointer: coarse) {
    .category-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .btn-add,
    .btn-details,
    .search-submit,
    .hero-btn,
    .offer-action,
    .offer-details-btn {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-user-select: none;
    }
    
    /* Melhorias específicas para botões de detalhes */
    .btn-details,
    .offer-details-btn {
        position: relative;
        overflow: hidden;
    }
    
    .btn-details:active,
    .offer-details-btn:active {
        transform: scale(0.95);
        background: var(--primary-600);
        color: white;
    }
    
    /* Modal - melhorias para touch */
    .product-modal {
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-close {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .modal-add-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Melhorias de touch para controle de quantidade */
    .quantity-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        min-width: 44px;
        min-height: 44px;
    }
    
    .quantity-input {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    .search-input {
        min-height: 44px;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
    
    .offer-card:active {
        transform: scale(0.98);
    }
}

/* Ajustes para telas muito pequenas (até 360px) */
@media (max-width: 360px) {
    .container {
        padding: 0 10px;
    }
    
    .hero-title {
        font-size: 20px;
    }
    
    .hero-subtitle {
        font-size: 13px;
    }
    
    .daily-offers {
        padding: 15px 10px;
    }
    
    .offer-card {
        padding: 10px;
    }
    
    .offer-image {
        width: 60px;
        height: 60px;
    }
    
    .offer-name {
        font-size: 13px;
    }
    
    .product-name {
        font-size: 14px;
    }
    
    .product-description {
        font-size: 12px;
    }
    
    .btn-add,
    .btn-details {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* Regra geral final para prevenir transbordamento */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    img, video, canvas {
        max-width: 100%;
        height: auto;
    }
    
    .daily-offers-grid,
    .products-grid {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .offer-card,
    .product-card {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Prevenir transbordamento de texto */
    .offer-name,
    .product-name,
    .offer-description,
    .product-description {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        max-width: 100%;
    }
}
