@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #ea1d2c;
    --primary-hover: #b51521;
    --bg-color: #f7f7f7;
    --card-bg: #ffffff;
    --text-main: #3e3e3e;
    --text-muted: #717171;
    --border-color: #f0f0f0;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Hero Section */
.comercio-hero {
    position: relative;
    background: var(--card-bg);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.comercio-hero-cover {
    height: 180px;
    background: url('https://images.unsplash.com/photo-1504674900247-0877df9cc836?q=80&w=2070&auto=format&fit=crop') center/cover;
    position: relative;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
}

.hero-content {
    flex-wrap: wrap;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 10;
    padding: 10px 0 15px 0;
}

.comercio-logo-large {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 4px solid var(--card-bg);
    object-fit: cover;
    background: #fff;
    box-shadow: var(--shadow);
    margin-top: -65px;
    flex-shrink: 0;
    align-self: flex-start;
}

.hero-content .info {
    flex: 1;
}

.hero-content .info h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-main);
}

.hero-content .desc-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-admin-link {
    color: var(--text-main);
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    transition: all 0.2s;
}

.btn-admin-link:hover {
    background: #e0e0e0;
    color: var(--primary);
}

/* Banners Promocionais */
.banners-wrapper {
    position: relative;
    margin: 15px 0;
}

.banners-container {
    padding: 10px 0 20px 0;
    overflow-x: auto;
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    gap: 15px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.banners-container::-webkit-scrollbar {
    display: none;
}

.btn-carousel {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6) !important;
    border: none;
    border-radius: 50%;
    color: #fff !important;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-carousel:hover {
    background: rgba(0, 0, 0, 0.8) !important;
    transform: translateY(-50%) scale(1.1);
}

.btn-prev { left: 10px; }
.btn-next { right: 10px; }

.btn-carousel svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .btn-carousel { display: none; } /* On mobile, use touch scroll */
    .btn-prev { left: 5px; }
    .btn-next { right: 5px; }
}

.banner-item {
    min-width: 320px;
    width: 320px;
    height: 150px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.banner-item:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

.banner-item:active {
    transform: scale(0.98);
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 768px) {
    .banner-item {
        min-width: 450px;
        width: 450px;
        height: 180px;
    }
}

/* Nav Categorias */
.nav-categorias-wrapper {
    background: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 90;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.nav-categorias {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 15px 20px;
    scroll-behavior: smooth;
}

.nav-categorias::-webkit-scrollbar {
    display: none;
}

.nav-cat-link {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-cat-link.active,
.nav-cat-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Categorias e Produtos */
.categoria-section {
    padding-top: 40px;
    margin-top: -20px;
    /* Offset for anchor links due to sticky header */
    margin-bottom: 30px;
}

.categoria-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.produto-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.produto-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.produto-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.produto-info h4 {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.produto-info .desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preco {
    font-weight: 600;
    color: var(--text-main);
    margin-top: auto;
}

.produto-foto,
.produto-foto-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
}

.produto-foto-placeholder {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Produto */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overhead {
    background: var(--card-bg);
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-foto-wrapper {
    width: 100%;
    height: 250px;
    background: #f0f0f0;
}

.modal-foto {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.modal-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.modal-price-row {
    margin-bottom: 25px;
}

.preco-large {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.qty-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.btn-qty {
    background: transparent;
    border: none;
    padding: 10px 15px;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--primary);
}

.qty-selector span {
    padding: 0 15px;
    font-weight: 600;
}

/* Buttons */
.btn {
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:active {
    opacity: 0.8;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: space-between;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

/* Carrinho Bottom Bar */
.carrinho-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    z-index: 99;
}

.carrinho-resumo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 500;
}

.carrinho-icon {
    position: relative;
    display: flex;
}

.carrinho-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: white;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Carrinho Checkout Panel */
.carrinho-pane {
    background: var(--bg-color);
    width: 100%;
    max-width: 450px;
    height: 100%;
    position: absolute;
    right: 0;
    display: flex;
    flex-direction: column;
    animation: slideLeft 0.3s ease;
}

@keyframes slideLeft {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.carrinho-header {
    background: var(--card-bg);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.carrinho-header .close-modal {
    position: static;
    background: transparent;
    color: var(--text-main);
}

.carrinho-body {
    flex: 1;
    overflow-y: auto;
}

.carrinho-itens {
    padding: 20px;
}

.cart-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
}

.carrinho-form {
    background: var(--card-bg);
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.carrinho-form h4 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.input-group {
    margin-bottom: 15px;
}

.input-form {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-color);
    outline: none;
}

.input-form:focus {
    border-color: var(--primary);
}

textarea.input-form {
    resize: vertical;
    min-height: 80px;
}

.carrinho-footer {
    background: var(--card-bg);
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.carrinho-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.carrinho-total-row strong {
    font-weight: 700;
}
/* Footer */
.site-footer {
    background: #1a1a1a;
    color: #ffffff;
    padding: 60px 0 110px; /* Espaço extra para a barra fixa do carrinho */
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: space-between;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-logo {
    width: 60px;
    height: auto;
    margin-bottom: 15px;
    border-radius: 50%;
}

.footer-section h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #ffffff;
}

.footer-section h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-section p {
    color: #b3b3b3;
    line-height: 1.6;
    margin-bottom: 15px;
}

.footer-link {
    display: block;
    color: #b3b3b3;
    text-decoration: none;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.footer-link:hover {
    color: #ffffff;
    transform: translateX(5px);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-icon {
    background: #333;
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.social-icon:hover {
    background: var(--primary);
}

.footer-bottom {
    border-top: 1px solid #333;
    margin-top: 40px;
    padding-top: 20px;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .footer-link:hover {
        transform: none;
    }
}

@media (max-width: 600px) {
    .hero-content {
        flex-direction: column;
        text-align: center;
        padding-top: 40px;
    }
    .hero-content .info {
        width: 100%;
        margin-top: 10px;
    }
    .comercio-logo-large {
        margin-top: -80px;
        align-self: center;
        width: 90px;
        height: 90px;
    }
    .hero-actions {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}
