/* =========================================
   DESIGN SYSTEM - FRESCO À PORTA
   ========================================= */
:root {
    --primary: #2B7A0B;
    --primary-light: #5BB318;
    --primary-soft: #E8F5E9;
    --accent: #FF9F29;
    --danger: #E74C3C;
    --bg-main: #F8FAF8;
    --bg-card: #FFFFFF;
    --text-dark: #1A2F24;
    --text-muted: #7D8F85;
    --border-color: #E2EAE3;
    
    --shadow-sm: 0 2px 8px rgba(43, 122, 11, 0.04);
    --shadow-md: 0 8px 24px rgba(43, 122, 11, 0.08);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --font: 'Nunito', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg-main); color: var(--text-dark); line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* Utilitários */
.hidden { display: none !important; }
.w-100 { width: 100%; }
.mt-3 { margin-top: 1rem; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* =========================================
   HEADER
   ========================================= */
.app-header { background: var(--bg-card); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-sm); }
.header-top { display: flex; align-items: center; justify-content: space-between; padding: 1rem 2rem; max-width: 1200px; margin: 0 auto; gap: 2rem; }

.brand-logo { height: 85px; object-fit: contain; transition: transform 0.3s ease; cursor: pointer; }
.brand-logo:hover { transform: scale(1.03); }

.search-bar { flex: 1; display: flex; align-items: center; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 50px; padding: 0.6rem 1.2rem; transition: border 0.3s; }
.search-bar:focus-within { border-color: var(--primary); }
.search-bar input { flex: 1; border: none; background: transparent; outline: none; margin-left: 10px; font-family: var(--font); font-size: 0.95rem; }

.header-actions { display: flex; gap: 1rem; }
.action-btn { background: transparent; border: 1px solid var(--border-color); border-radius: 50px; padding: 0.5rem 1rem; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; font-family: var(--font); font-weight: 700; transition: all 0.2s; color: var(--text-dark); }
.action-btn:hover { background: var(--bg-main); }

.cart-btn { background: var(--primary); color: white; border-color: var(--primary); }
.cart-btn:hover { background: var(--primary-light); color: white; }
.cart-icon-wrapper { position: relative; display: flex; align-items: center; justify-content: center; }
.badge { position: absolute; top: -10px; right: -12px; background: var(--danger); color: white; border-radius: 50px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 900; border: 2px solid var(--primary); }

/* =========================================
   TRUST BAR
   ========================================= */
.trust-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 3rem; background: white; padding: 1.5rem 2rem; border-bottom: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.02); }
.trust-item { display: flex; align-items: center; gap: 1rem; cursor: pointer; transition: transform 0.2s; }
.trust-item:hover { transform: translateY(-2px); }
.trust-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.trust-text { display: flex; flex-direction: column; }
.trust-title { font-weight: 900; font-size: 0.95rem; color: var(--text-dark); }
.trust-sub { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

/* =========================================
   DELIVERY BANNER (VERDE PREMIUM)
   ========================================= */
.delivery-banner-wrapper { max-width: 1200px; margin: 2rem auto 1rem; padding: 0 2rem; }
.delivery-banner { background: linear-gradient(135deg, var(--primary-soft), #C8E6C9); border: 1px solid #A5D6A7; border-radius: var(--radius-md); padding: 1.5rem 2rem; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-sm); flex-wrap: wrap; gap: 1rem; }
.delivery-info { display: flex; align-items: center; gap: 1.2rem; }
.delivery-icon-box { width: 50px; height: 50px; background: white; color: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; box-shadow: 0 4px 10px rgba(43, 122, 11, 0.15); }
.delivery-text h4 { color: var(--text-dark); font-weight: 900; font-size: 1.1rem; margin-bottom: 0.2rem; }
.delivery-text p { color: var(--primary); font-size: 0.85rem; font-weight: 800; }
.delivery-timer { display: flex; gap: 0.5rem; }
.timer-box { background: var(--primary); color: white; padding: 0.6rem 0.8rem; border-radius: 10px; min-width: 65px; text-align: center; box-shadow: 0 4px 10px rgba(43, 122, 11, 0.2); }
.timer-value { font-weight: 900; font-size: 1.4rem; line-height: 1; }
.timer-label { font-size: 0.65rem; display: block; font-weight: 800; text-transform: uppercase; margin-top: 4px; opacity: 0.9; }

/* =========================================
   NAVEGAÇÃO DE CATEGORIAS
   ========================================= */
.category-nav { max-width: 1200px; margin: 1rem auto; padding: 0 2rem; }
.nav-scroll { display: flex; gap: 0.8rem; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: none; }
.cat-btn { background: white; border: 1px solid var(--border-color); padding: 0.6rem 1.2rem; border-radius: 50px; cursor: pointer; font-family: var(--font); font-weight: 700; color: var(--text-muted); white-space: nowrap; transition: all 0.2s; }
.cat-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* =========================================
   GRID & CARDS
   ========================================= */
.main-content { max-width: 1200px; margin: 0 auto 4rem; padding: 0 2rem; }
.section-title { margin-bottom: 1.5rem; font-weight: 900; color: var(--text-dark); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }

.card { background: white; border-radius: var(--radius-md); padding: 1rem; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); transition: transform 0.2s; display: flex; flex-direction: column; position: relative; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card-img { width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--primary-soft); }
.card-badge { position: absolute; top: 1.5rem; left: 1.5rem; background: var(--danger); color: white; font-size: 0.7rem; font-weight: 900; padding: 3px 8px; border-radius: 20px; }
.card-title { font-weight: 800; font-size: 1.1rem; line-height: 1.2; margin-bottom: 0.3rem; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; }

/* Acções do Produto (Preço, Quantidade e Botão) */
.card-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 1rem; width: 100%; border-top: 1px solid var(--border-color); padding-top: 1rem; }
.price-box { display: flex; flex-direction: column; }
.price-new { font-size: 1.3rem; font-weight: 900; color: var(--primary); display: flex; align-items: baseline; gap: 3px; }
.price-new span.unit { font-size: 0.85rem; color: var(--text-muted); font-weight: 700; }
.price-old { font-size: 0.8rem; text-decoration: line-through; color: #aaa; }
.card-actions-row { display: flex; gap: 0.5rem; height: 38px; width: 100%; }
.card-qty { display: flex; align-items: center; background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; height: 100%; width: 90px; flex-shrink: 0; }
.card-qty button { width: 28px; height: 100%; background: transparent; border: none; color: var(--text-dark); font-weight: 900; cursor: pointer; transition: background 0.2s; }
.card-qty button:hover { background: var(--border-color); color: var(--primary); }
.card-qty input { flex: 1; height: 100%; border: none; text-align: center; background: transparent; font-weight: 800; color: var(--text-dark); font-family: var(--font); width: 100%; -moz-appearance: textfield; }
.card-qty input::-webkit-outer-spin-button, .card-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn-add { flex: 1; background: var(--primary-soft); color: var(--primary); border: none; border-radius: 8px; cursor: pointer; font-size: 0.9rem; font-weight: 800; font-family: var(--font); transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-add:hover { background: var(--primary); color: white; }
.btn-add:active { transform: scale(0.96); }

/* =========================================
   MODALS
   ========================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; padding: 1rem; backdrop-filter: blur(4px); }
.modal-content { background: white; width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; border-radius: var(--radius-lg); padding: 2rem; position: relative; box-shadow: var(--shadow-md); }
.modal-sm { max-width: 400px; }
.close-modal { position: absolute; top: 1rem; right: 1rem; background: var(--bg-main); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; }
.modal-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.icon-circle { width: 50px; height: 50px; background: var(--primary-soft); color: var(--primary); border-radius: 50px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.modal-footer { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; gap: 1rem;}

/* FORMS E BOTÕES */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text-muted); }
.form-group input { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-family: var(--font); font-size: 1rem; outline: none; transition: border 0.3s; box-sizing: border-box; }
.form-group input:focus { border-color: var(--primary); }
.btn-primary { background: var(--primary); color: white; border: none; padding: 0.8rem 1.5rem; border-radius: var(--radius-sm); font-family: var(--font); font-weight: 800; font-size: 1rem; cursor: pointer; transition: background 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary:hover { background: var(--primary-light); }
.alert { padding: 0.8rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.85rem; font-weight: 700; }
.alert.error { background: #FDEDED; color: var(--danger); border: 1px solid #FADCDC; }

/* =========================================
   TIMELINE DE ENCOMENDAS (HISTÓRICO)
   ========================================= */
.timeline { display: flex; justify-content: space-between; position: relative; margin: 1.5rem 0 0.5rem; padding: 0 5px; }
.timeline::before { content: ''; position: absolute; top: 12px; left: 10%; right: 10%; height: 3px; background: #E2EAE3; z-index: 1; }
.step { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; flex: 1; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; background: #E2EAE3; border: 4px solid var(--bg-main); font-size: 0.6rem; color: transparent; display: flex; align-items: center; justify-content: center; transition: all 0.3s; }
.step.active .step-dot { background: var(--primary); color: white; }
.step-label { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; text-align: center; line-height: 1.1; }
.step.active .step-label { color: var(--text-dark); }

/* =========================================
   CARRINHO PREMIUM (REDESIGN COM BARRAS)
   ========================================= */
.cart-progress-container { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.2rem; margin-bottom: 1.5rem; }
.progress-box { display: flex; flex-direction: column; gap: 0.5rem; }
.progress-header { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; font-weight: 800; }
.progress-title { color: var(--text-dark); }
.progress-status { color: var(--text-muted); }
.progress-status.reached { color: var(--primary); }
.progress-bar-bg { width: 100%; height: 8px; background: #E2EAE3; border-radius: 50px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 50px; transition: width 0.4s ease; }
.progress-bar-fill.success { background: var(--primary); }
.progress-bar-fill.warning { background: var(--accent); }
.progress-bar-fill.info { background: #3498db; }

.cart-item-premium { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; border-bottom: 1px dashed var(--border-color); gap: 1rem; }
.cart-item-icon { width: 45px; height: 45px; background: var(--primary-soft); color: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.cart-item-details { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.cart-item-title { font-weight: 800; color: var(--text-dark); font-size: 0.95rem; line-height: 1.2; }
.cart-item-price { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }
.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.cart-qty-control { display: flex; align-items: center; gap: 0.8rem; background: var(--bg-main); border-radius: 50px; padding: 0.3rem 0.5rem; border: 1px solid var(--border-color); }
.cart-qty-control button { background: white; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 900; box-shadow: var(--shadow-sm); color: var(--text-dark); transition: transform 0.2s; }
.cart-qty-control button:active { transform: scale(0.9); }
.cart-qty-control span { font-weight: 900; font-size: 0.9rem; min-width: 15px; text-align: center; }
.cart-item-subtotal { font-weight: 900; color: var(--primary); font-size: 1.05rem; }

/* =========================================
   ANIMAÇÃO DE SUCESSO (CHECKOUT)
   ========================================= */
.success-animation { display: flex; justify-content: center; margin-bottom: 2rem; }
.success-icon { 
    width: 80px; height: 80px; 
    background: var(--primary); color: white; 
    border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 2.5rem; 
    box-shadow: 0 0 0 15px var(--primary-soft); 
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; 
}
@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
/* =========================================
   SCROLLBAR PERSONALIZADA (MODAIS)
   ========================================= */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 1rem 0; /* Dá um pequeno espaço nas pontas */
}
.modal-content::-webkit-scrollbar-thumb {
    background: #C8E6C9; /* Verde muito suave */
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light); /* Fica mais escura ao passar o rato */
}
/* Suporte para Firefox */
.modal-content {
    scrollbar-width: thin;
    scrollbar-color: #C8E6C9 transparent;
}
/* =========================================
   RODAPÉ INSTITUCIONAL (FOOTER)
   ========================================= */
.site-footer {
    background-color: #1A2F24; /* Verde muito escuro, quase preto */
    color: #E2EAE3;
    padding: 3rem 1rem 1rem;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.9rem;
}
.site-footer a {
    color: var(--primary-light);
    text-decoration: none;
    margin: 0 0.5rem;
    font-weight: 600;
    transition: color 0.2s;
}
.site-footer a:hover {
    color: white;
}
.footer-social {
    font-size: 1.5rem;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 2rem;
    padding-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* =========================================
   AVISO DE COOKIES (BANNER)
   ========================================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #FFFFFF;
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 9999;
    flex-wrap: wrap;
    gap: 1rem;
}
.cookie-text {
    font-size: 0.85rem;
    color: var(--text-dark);
    flex: 1;
    min-width: 250px;
}
.cookie-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.cookie-btn:hover {
    background-color: #1A2F24; /* Fica com aquele verde escuro premium do rodapé */
    color: white;
}
/* =========================================
   CARRINHO FLUTUANTE E MOBILE
   ========================================= */
#floating-cart { display: none !important; }

@media (max-width: 768px) {
    .header-top { padding: 1rem; flex-wrap: wrap; }
    .brand-logo { height: 60px; }
    .search-bar { order: 3; min-width: 100%; margin-top: 1rem; }
    .header-actions span { display: none; }
    .trust-bar { gap: 1.5rem; padding: 1rem; flex-direction: column; align-items: flex-start; }
    
    .delivery-banner-wrapper { padding: 0 1rem; margin-top: 1rem; }
    .delivery-banner { justify-content: center; text-align: center; padding: 1.2rem; }
    .delivery-info { flex-direction: column; gap: 0.8rem; }
    
    #floating-cart {
        display: flex !important;
        position: fixed; bottom: 20px; right: 20px; 
        background: var(--primary); color: white; 
        border: none; border-radius: 50px; 
        padding: 1rem 1.5rem; gap: 0.5rem; 
        font-weight: 800; font-family: var(--font); 
        box-shadow: var(--shadow-md); z-index: 99; 
        cursor: pointer; transition: transform 0.2s;
        align-items: center;
    }
    #floating-cart.hidden { display: none !important; }
    #floating-cart:active { transform: scale(0.95); }
    #floating-cart .badge { position: relative; top: auto; right: auto; background: rgba(255,255,255,0.2); border: none; }
    
    .modal-content { padding: 1.5rem; }
    .modal-footer { flex-direction: column; }
    .modal-footer button { width: 100%; margin-bottom: 0.5rem; }
    .cart-item-premium { flex-direction: column; align-items: flex-start; }
    .cart-item-actions { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
}