* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: #f3f4f6;
    min-height: 100vh;
}


/* Filtros */
.filters-section {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #e5e7eb;
}

.filters-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background-color: #f9fafb;
    color: #374151;
}

.filter-btn:hover {
    background-color: #dcfce7;
    color: #16a34a;
}

.filter-btn.active {
    background-color: #16a34a;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Main Content */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* Product Card */
.product-card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s;
}

.product-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    position: relative;
}

.product-image {
    width: 100%;
    height: 10rem;
    object-fit: cover;
}

.product-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.badge-bestseller {
    background-color: #16a34a;
}

.badge-promotion {
    background-color: #ef4444;
}

.badge-new {
    background-color: #16a34a;
}

.product-content {
    padding: 1rem;
}

.product-category {
    font-size: 0.75rem;
    color: #16a34a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.product-name {
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-rating {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.stars {
    display: flex;
    color: #fbbf24;
}

.star {
    width: 0.75rem;
    height: 0.75rem;
}

.rating-text {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: 0.25rem;
}

.product-description {
    color: #6b7280;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 1.125rem;
    font-weight: bold;
    color: #16a34a;
}

.add-to-cart-btn {
    background-color: #16a34a;
    color: white;
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s;
}

.add-to-cart-btn:hover {
    background-color: #15803d;
}

.plus-icon {
    width: 1rem;
    height: 1rem;
}

/* Cart Modal */
.cart-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.cart-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.cart-container {
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
    width: 100%;
    max-width: 28rem;
    background-color: white;
    box-shadow: -10px 0 25px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.cart-modal.show .cart-container {
    transform: translateX(0);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-header h2 {
    font-size: 1.125rem;
    font-weight: bold;
    color: #1f2937;
}

.close-btn {
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
}

.close-btn:hover {
    color: #6b7280;
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.empty-cart {
    text-align: center;
    color: #6b7280;
}

.empty-cart-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    color: #d1d5db;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
}

.cart-item-image {
    width: 4rem;
    height: 4rem;
    border-radius: 0.5rem;
    object-fit: cover;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 0.875rem;
}

.cart-item-price {
    font-size: 0.875rem;
    color: #6b7280;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: #e5e7eb;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.quantity-btn:hover {
    background-color: #d1d5db;
}

.quantity-btn.remove {
    background-color: #fee2e2;
    color: #dc2626;
}

.quantity-btn.remove:hover {
    background-color: #fecaca;
}

.quantity {
    font-size: 0.875rem;
    font-weight: 500;
}

.cart-item-total {
    text-align: right;
}

.cart-item-total-price {
    font-weight: 600;
    color: #16a34a;
}

.cart-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cart-total span:first-child {
    font-size: 1.125rem;
    font-weight: bold;
}

.total-price {
    font-size: 1.125rem;
    font-weight: bold;
    color: #16a34a;
}

.checkout-btn {
    width: 100%;
    background: linear-gradient(to right, #16a34a, #15803d);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.checkout-btn:hover {
    background: linear-gradient(to right, #15803d, #166534);
}

/* Checkout Page */
.checkout-page {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: env(safe-area-inset-left, 0px);
    right: env(safe-area-inset-right, 0px);
    bottom: env(safe-area-inset-bottom, 0px);
    background-color: #f3f4f6;
    z-index: 60;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.checkout-header {
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 70;
    flex-shrink: 0;
}

.checkout-header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-height: 70px;
}

.back-btn {
    display: flex;
    align-items: center;
    color: #16a34a;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.back-btn:hover {
    color: #15803d;
}

.back-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

.checkout-logo {
    text-align: center;
}

.checkout-logo img {
    height: 3rem;
    width: auto;
    margin-bottom: -0.5rem;
}

.checkout-logo p {
    color: #6b7280;
    font-size: 0.875rem;
}

.spacer {
    width: 6rem;
}

.checkout-content {
    max-width: 1536px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1rem 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.customer-form, .order-summary {
    background-color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    height: fit-content;
}

.customer-form h2, .customer-form h3 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #1f2937;
    display: flex;
    align-items: center;
}

.customer-form h2 svg, .customer-form h3 svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    color: #16a34a;
}

.customer-form h3 {
    margin-top: 2rem;
    font-size: 1.125rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.order-summary h2 {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.summary-items {
    max-height: 24rem;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    padding-right: 0.5rem;
}

.summary-items::-webkit-scrollbar {
    width: 0.5rem;
}

.summary-items::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 0.25rem;
}

.summary-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 0.25rem;
}

.summary-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
}

.summary-item-image {
    width: 4rem;
    height: 4rem;
    border-radius: 0.5rem;
    object-fit: cover;
}

.summary-item-details {
    flex: 1;
}

.summary-item-name {
    font-weight: 500;
    color: #1f2937;
}

.summary-item-qty {
    font-size: 0.875rem;
    color: #6b7280;
}

.summary-item-price {
    text-align: right;
    font-weight: 600;
    color: #16a34a;
}

.summary-total {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.summary-total span:first-child {
    color: #374151;
    font-size: 1.125rem;
    font-weight: bold;
}

.summary-price {
    color: #16a34a;
    font-size: 1.25rem;
    font-weight: bold;
}

.finalize-btn {
    width: 100%;
    background: linear-gradient(to right, #16a34a, #15803d);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.125rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.finalize-btn:hover {
    background: linear-gradient(to right, #15803d, #166534);
}

.finalize-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .checkout-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .filters-content {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .checkout-content {
        padding: 1rem;
    }
}

@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cart-container {
        max-width: 100%;
    }
}

/* iOS Safari - Ajuste específico */
@supports (padding: max(0px)) {
    .checkout-content {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* ===============================
   FRETE / ENDEREÇO (FINAL)
================================ */
.frete-box {
    margin-top: 20px;
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

/* Linha CEP + Botão */
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
}

/* Botão calcular frete */
.btn-frete {
    height: 42px;
    padding: 0 20px;
    border-radius: 8px;
    border: none;
    background: #16a34a;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.btn-frete:hover {
    background: #15803d;
}

/* ===============================
   OPÇÕES DE FRETE
================================ */
#frete-opcoes {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.frete-opcao {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.frete-opcao:hover {
    border-color: #16a34a;
    background: #f0fdf4;
}

.frete-opcao input {
    accent-color: #16a34a;
    transform: scale(1.1);
}

.frete-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.frete-left {
    display: flex;
    flex-direction: column;
}

.frete-title {
    font-weight: 600;
    color: #111827;
}

.frete-prazo {
    font-size: 13px;
    color: #6b7280;
}

.frete-preco {
    font-size: 16px;
    font-weight: 700;
    color: #16a34a;
}

.frete-opcao.retirada {
    background: #f0fdf4;
    border-color: #86efac;
}