* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --primary-color: #1B4F88;
    --secondary-color: #0D1F3B;
    --accent-color: #5EC0FF;
    --text-color: #0F172A;
    --light-gray: #EEF5FB;
    --border-color: #C1D8EF;
    --success-color: #2ECC71;
    --error-color: #E74C3C;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--light-gray);
    line-height: 1.6;
}

body.no-scroll {
    overflow: hidden;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- LOGO & LINKS GENERALISTAS --- */
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.logo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo i {
    font-size: 1.8rem;
}

.logo h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    font-weight: bold;
}

.admin-link {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}

footer a {
    color: #fff;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* --- CORE ESTRUTURAL DO CABEÇALHO (DESKTOP PADRÃO) --- */
header {
    background-color: #fff;
    position: sticky;
    top: 0;
    z-index: 990;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* Container de Busca Única Arredondada */
.search-container {
    flex: 1;
    max-width: 500px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--light-gray);
    border-radius: 1.5rem;
    padding: 0.45rem 1.2rem;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.search-container input {
    width: 100%;
    border: none;
    background: none;
    outline: none;
    padding: 0.2rem 0;
    font-size: 0.95rem;
    color: var(--text-color);
}

.search-container i {
    color: var(--primary-color);
    cursor: pointer;
}

/* --- COMPONENTES DA VITRINE E LAYOUT --- */
.product-meta {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.35rem;
}

.store-info-bar {
    background-color: #fff;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.store-info-bar p {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin: 0;
}

.store-info-bar i {
    color: var(--primary-color);
}

.categories-container {
    background-color: var(--secondary-color);
    display: flex;
    overflow-x: auto;
}

.categories-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.category-btn {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border: none;
    color: #fff;
    border-radius: 1.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    background: none;
    white-space: nowrap;
    font-size: 0.9rem;
}

.category-btn.active {
    background-color: var(--primary-color);
}

.hero-section {
    background: linear-gradient(160deg, #0D1F3B 0%, #1B4F88 100%);
    color: #fff;
    text-align: center;
    padding: 2.5rem 1rem;
}

.hero-section img {
    display: block;
    margin: 0 auto 1.25rem;
    width: min(320px, 60%);
    max-width: 320px;
    height: auto;
    border-radius: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 24px 45px rgba(0, 0, 0, 0.25);
}

.hero-section p {
    font-size: 1.15rem;
    max-width: 760px;
    margin: 0 auto;
    line-height: 1.7;
}

.carousel-section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    padding: 0 1rem;
}

.carousel-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.carousel-container::-webkit-scrollbar {
    height: 10px;
}

.carousel-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
}

.carousel-slide {
    position: relative;
    overflow: hidden;
    border-radius: 1.5rem;
    min-width: 280px;
    max-width: 320px;
    height: 220px;
    background-color: rgba(255, 255, 255, 0.12);
    flex: 0 0 auto;
    scroll-snap-align: center;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-caption {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    padding: 0.85rem 0.95rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.95rem;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
}

.carousel-controls, .carousel-indicators {
    display: none;
}

footer {
    background-color: var(--secondary-color);
    color: #fff;
    text-align: center;
    padding: 2rem;
}

.products {
    width: 100%;
    max-width: 1200px;
    padding: 1rem;
    margin: 0 auto;
}

.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.product-card {
    background-color: #fff;
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.product-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.product-info {
    padding: 1rem;
}

.product-name {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.product-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: #6c757d;
}

.product-price {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: bold;
}

.product-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    border: none;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: 0.3s;
}

.product-button:hover {
    background-color: #3aa9f3;
}

/* --- SISTEMA DO CARRINHO & REQUISITOS --- */
.cart-icon {
    position: relative;
    cursor: pointer;
    padding: 0.5rem;
}

.cart-icon i {
    font-size: 1.8rem;
    color: var(--secondary-color);
}

.cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    font-weight: bold;
    transform: translate(25%, -25%);
}

.cart-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.cart-overlay.show {
    opacity: 1;
    visibility: visible;
}

body.modal-open {
    overflow: hidden;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background-color: #fff;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart-sidebar.show {
    transform: translateX(0);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.close-cart-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
}

.cart-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex-shrink: 1;
}

.cart-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-gray);
    overflow-y: auto;
    flex-grow: 1;
}

.finish-order-btn-container {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #fff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

.cart-body::-webkit-scrollbar, .cart-footer::-webkit-scrollbar {
    width: 6px;
}

.cart-body::-webkit-scrollbar-thumb, .cart-footer::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}

.cart-empty {
    text-align: center;
    padding-top: 4rem;
    color: #999;
}

.cart-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

.cart-empty p {
    font-size: 1.2rem;
    font-weight: 600;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: bold;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-btn {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
}

.quantity-btn:hover {
    background-color: #ddd;
}

.remove-item-btn {
    background: none;
    border: none;
    color: #f44336;
    font-size: 1.8rem;
    cursor: pointer;
    margin-left: auto;
}

.product-image-fly {
    position: fixed;
    z-index: 1001;
    border-radius: 50%;
    transition: all 0.7s cubic-bezier(0.55, 0.055, 0.675, 0.19);
    object-fit: cover;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-group input.error, .form-group textarea.error, .form-group select.error {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2) !important;
}

.payment-options-container {
    border-top: 1px solid var(--border-color);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
}

.payment-options-container h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.payment-help {
    margin: 0 0 1rem;
    color: #5f6f88;
    font-size: 0.95rem;
}

.payment-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.payment-option.selected {
    border-color: var(--primary-color);
    background-color: #fff5f0;
}

#troco-container {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

/* --- FINANCE MODAL INTERFACES --- */
.finance-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.65);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: 0.25s;
}

.finance-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.finance-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1101;
    width: min(520px, 92%);
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: 0.28s;
}

.finance-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.finance-modal-card {
    background-color: #fff;
    border-radius: 1.25rem;
    padding: 1.75rem;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.22);
}

.finance-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.finance-modal-header h3 {
    font-size: 1.35rem;
    color: var(--secondary-color);
}

.close-finance-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-color);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.delivery-fee-notice {
    font-size: 0.8rem;
    text-align: center;
    color: #777;
    padding: 0.5rem;
    margin: 1.5rem 0;
}

.cart-summary {
    margin: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.summary-line.total {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 1rem;
}

.coupon-container {
    display: flex;
    gap: 0.5rem;
}

#apply-coupon-btn {
    border: none;
    background-color: var(--secondary-color);
    color: #fff;
    padding: 0 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
}

.coupon-feedback {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    height: 1em;
}

.coupon-feedback.success { color: var(--success-color); }
.coupon-feedback.error { color: var(--error-color); }

.finish-order-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
}

.finish-order-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.view-cart-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    width: 100%;
    background-color: var(--secondary-color);
    color: #fff;
    z-index: 980;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    transition: bottom 0.4s ease-in-out;
}

.view-cart-banner.show {
    bottom: 0;
}

.view-cart-banner p {
    margin: 0;
    font-weight: 600;
}

.view-cart-banner-btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}


/* --- TELA INTEIRA / DESKTOP (A partir de 721px) --- */
@media (min-width: 721px) {
    header {
        flex-wrap: nowrap; /* Não quebra elementos principais */
    }

    .search-container {
        margin: 0 2rem; /* Mantém a busca centralizada com respiro lateral */
    }

    .view-cart-banner {
        display: none;
    }
}

/* --- DISPOSITIVOS MOBILE / CELULARES (Telas até 720px) --- */
@media (max-width: 720px) {
    header {
        flex-direction: row; 
        flex-wrap: wrap;    
        justify-content: space-between;
        padding: 0.6rem 1rem;
    }

    .logo {
        width: auto;
        justify-content: flex-start;
    }

    .logo-img {
        height: 42px; /* Reduz a proporção da logo sutilmente */
    }

    .cart-icon {
        padding: 0.3rem;
    }

    /* 🎯 BARRA DE BUSCA DISCRETA E ALINHADA NO MOBILE */
    .search-container {
        width: 100%;
        max-width: 100%;
        margin: 8px 0 2px 0; /* Espaçamento limpo, sem esmagar o topo */
        padding: 0.35rem 1rem; /* Padding fino */
        border-radius: 1rem; /* Bordas arredondadas e discretas */
        background-color: var(--light-gray);
    }

    .search-bar {
        height: 28px; /* Altura exata controlada para não inflar no celular */
    }

    .search-container input {
        font-size: 0.88rem;
        padding: 0;
        height: 100%;
    }

    /* Outros ajustes mobile essenciais */
    .categories-bar {
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .category-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .hero-section {
        padding: 1.8rem 1rem;
    }

    .products {
        padding: 1rem 0.5rem;
    }

    .products-container {
        grid-template-columns: 1fr;
    }

    .product-card {
        width: 100%;
    }

    .product-img {
        height: 180px;
    }

    .cart-sidebar {
        max-width: 100%;
    }

    .cart-item {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-item-img {
        width: 100%;
        height: 140px;
    }

    .finish-order-btn {
        padding: 0.85rem;
        font-size: 1.1rem;
    }
}