/* =========================================
   1. VARIABLES Y BASE
   ========================================= */
:root {
    --bg-body: #f4f6f8; --bg-white: #ffffff; 
    --text-dark: #1a1a1a; --text-body: #555555; --text-light: #999999; 
    --primary-accent: #9ed615; --primary-dark: #7fac0d;
    --secondary-brand: #0f172a; --danger: #ff4757;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --border-light: #ebeeef; --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--bg-body); color: var(--text-body); line-height: 1.6; animation: fadeInPage 0.4s ease-in-out; }
a { text-decoration: none; color: inherit; }
@keyframes fadeInPage { from { opacity: 0; } to { opacity: 1; } }

/*borrame si se ve mal*/
* {
    -webkit-tap-highlight-color: transparent;
}
body {
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none; /* Evita el rebote excesivo al hacer scroll tope */
}
/* Efecto nativo al tocar botones */
button, .icon-btn, .product-card {
    transition: transform 0.1s ease-in-out, opacity 0.1s;
}
button:active, .icon-btn:active, .product-card:active {
    transform: scale(0.96) !important; /* El botón se hunde un poquito al tocarlo */
    opacity: 0.9;
}

/* =========================================
   2. HEADER Y TOP BAR
   ========================================= */
.top-bar { background-color: var(--secondary-brand); color: white; font-size: 0.8rem; padding: 8px 5%; display: flex; justify-content: space-between; font-weight: 300; }
.top-bar i { color: var(--primary-accent); margin-right: 5px; }
.ecommerce-header { background: var(--bg-white); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.header-container { display: flex; align-items: center; justify-content: space-between; padding: 15px 5%; max-width: 1600px; margin: 0 auto; gap: 30px; }
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand img { height: 45px; border-radius: 8px; }
.brand h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; color: var(--text-dark); }
.header-search { flex: 1; max-width: 600px; display: flex; align-items: center; background: #f1f3f5; border-radius: 50px; padding: 5px; border: 1px solid transparent; transition: 0.3s; }
.header-search:focus-within { background: var(--bg-white); border-color: var(--primary-accent); box-shadow: 0 0 0 3px rgba(158,214,21,0.2); }
.header-search input { flex: 1; border: none; background: transparent; padding: 10px 20px; outline: none; font-size: 0.95rem; color: var(--text-dark); }
.search-btn { background: var(--primary-accent); color: var(--secondary-brand); border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s; }
.search-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.header-actions { display: flex; align-items: center; gap: 15px; }
.icon-btn { background: transparent; border: none; font-size: 1.3rem; color: var(--text-dark); cursor: pointer; position: relative; transition: color 0.3s; padding: 5px; }
.icon-btn:hover { color: var(--primary-accent); }
.cart-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; font-size: 0.7rem; font-weight: 700; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

/* Botones y Checkboxes Globales */
.btn-publicar { background: var(--secondary-brand); color: white; border: none; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.btn-publicar:hover { background: var(--primary-accent); color: var(--secondary-brand); }
.custom-checkbox { display: flex; align-items: center; margin-bottom: 12px; cursor: pointer; font-size: 0.9rem; user-select: none; }
.custom-checkbox input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; }
.checkmark { height: 18px; width: 18px; background-color: white; border: 1px solid #ccc; border-radius: 4px; margin-right: 10px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.custom-checkbox:hover input ~ .checkmark { border-color: var(--primary-accent); }
.custom-checkbox input:checked ~ .checkmark { background-color: var(--primary-accent); border-color: var(--primary-accent); }
.checkmark:after { content: "\f00c"; font-family: "Font Awesome 5 Free"; font-weight: 900; color: var(--secondary-brand); font-size: 10px; display: none; }
.custom-checkbox input:checked ~ .checkmark:after { display: block; }

/* =========================================
   3. TOASTS Y CARRITO LATERAL
   ========================================= */
#toast-container { position: fixed; bottom: 30px; right: 30px; z-index: 9999; display: flex; flex-direction: column; gap: 15px; }
.toast { background: var(--secondary-brand); color: white; padding: 15px 25px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 15px; transform: translateX(120%); opacity: 0; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.toast.show { transform: translateX(0); opacity: 1; }
.toast-icon { background: var(--primary-accent); color: var(--secondary-brand); width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; }

.cart-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; display: none; opacity: 0; transition: opacity 0.3s; }
.cart-overlay.active { display: block; opacity: 1; }
.cart-sidebar { position: fixed; top: 0; right: -400px; width: 400px; max-width: 100%; height: 100%; background: var(--bg-white); z-index: 1000; box-shadow: -5px 0 15px rgba(0,0,0,0.1); transition: right 0.3s ease; display: flex; flex-direction: column; }
.cart-sidebar.active { right: 0; }
.cart-header { padding: 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-light); }
.cart-header h3 { font-size: 1.2rem; color: var(--secondary-brand); }
.close-cart { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-light); }
.close-cart:hover { color: var(--danger); }
.cart-items { flex: 1; overflow-y: auto; padding: 20px; }
.cart-item { display: flex; gap: 15px; margin-bottom: 20px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.cart-item img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; }
.cart-item-info { flex: 1; }
.cart-item-title { font-size: 0.9rem; font-weight: 600; color: var(--text-dark); margin-bottom: 5px; }
.cart-item-price { font-size: 1rem; font-weight: 800; color: var(--primary-dark); }
.btn-remove-item { background: none; border: none; color: var(--danger); font-size: 0.8rem; cursor: pointer; margin-top: 5px; }
.cart-footer { padding: 20px; border-top: 1px solid var(--border-light); background: #f9fafb; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 800; margin-bottom: 15px; color: var(--secondary-brand); }
.btn-checkout { width: 100%; background: #25D366; color: white; border: none; padding: 15px; border-radius: 30px; font-size: 1.1rem; font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px; transition: 0.3s; }
.btn-checkout:hover { background: #1ebe57; transform: translateY(-2px); }

/* =========================================
   4. FOOTER ECOMMERCE
   ========================================= */
.ecommerce-footer { background-color: var(--secondary-brand); color: white; padding: 60px 5% 0; margin-top: 50px; font-size: 0.9rem; font-weight: 300; }
.footer-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; max-width: 1600px; margin: 0 auto 50px; }
.footer-column h4 { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; color: var(--primary-accent); text-transform: uppercase; }
.brand-column { display: flex; flex-direction: column; gap: 15px; }
.footer-logo {
    height: 200px; /* 🔥 Aumentamos casi al doble el tamaño (puedes subir o bajar este número) */
    width: auto;       
    max-width: 100%;  
    object-fit: contain; 
    align-self: flex-start; 
    margin-bottom: 15px; 
}
.brand-column p { color: #cbd5e1; line-height: 1.4; }
.accordion-content { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.accordion-content li a { color: #cbd5e1; transition: color 0.3s; }
.accordion-content li a:hover { color: var(--primary-accent); }
.social-icons { display: flex; gap: 15px; font-size: 1.2rem; margin-top: 10px; }
.social-icons a { color: #cbd5e1; transition: color 0.3s; }
.social-icons a:hover { color: var(--primary-accent); }
.info-list i { color: var(--primary-accent); margin-right: 10px; }
.footer-bottom { background-color: rgba(0, 0, 0, 0.2); padding: 20px 5%; font-size: 0.8rem; color: #cbd5e1; }
.footer-bottom-container { max-width: 1600px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.payment-icons { display: flex; gap: 15px; font-size: 1.2rem; align-items: center; }
.payment-icons img { height: 25px; width: auto; }

/* GLOBAL MOBILE */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .top-bar { justify-content: center; } 
    .header-container { flex-wrap: wrap; gap: 15px; padding: 15px 5%; }
    .brand h1 { font-size: 1.3rem; }
    .header-search { order: 3; flex: 0 0 100%; max-width: 100%; }
    #toast-container { left: 20px; right: 20px; bottom: 20px; align-items: center; }
    .toast { width: 100%; justify-content: center; }
    
    /* Footer Mobile */
    .ecommerce-footer { padding: 40px 5% 0; }
    .footer-container { grid-template-columns: 1fr; gap: 0; }
    .brand-column { align-items: center; text-align: center; padding-bottom: 30px; margin-bottom: 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
    .accordion-item { margin-bottom: 10px; }
    .accordion-header { display: flex; justify-content: space-between; align-items: center; background-color: rgba(255, 255, 255, 0.05); padding: 15px; border-radius: 8px; cursor: pointer; user-select: none; }
    .accordion-header i { font-size: 0.8rem; transition: transform 0.3s ease; }
    .accordion-item.activo .accordion-header i { transform: rotate(180deg); }
    .accordion-content { max-height: 0; overflow: hidden; transition: all 0.4s ease-in-out; padding: 0 15px; opacity: 0; }
    .accordion-item.activo .accordion-content { max-height: 400px; padding: 15px; opacity: 1; }
    .footer-bottom-container { flex-direction: column; gap: 15px; text-align: center; }

    .cart-sidebar {
        top: auto;
        bottom: -100%;
        right: 0 !important; /* Anulamos el right anterior */
        width: 100%;
        height: 85vh; /* Ocupa el 85% de la pantalla */
        border-radius: 25px 25px 0 0; /* Bordes redondeados arriba */
        transition: bottom 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.1) !important; /* Animación con rebote sutil */
        box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    }
    .cart-sidebar.active {
        bottom: 0;
    }
    .cart-header {
        padding: 25px 20px 15px;
        position: relative;
    }
    /* Pestaña gris arribita típica de las apps para indicar que se puede deslizar */
    .cart-header::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: #e2e8f0;
        border-radius: 10px;
    }
}

.mobile-bottom-nav {
    display: none; /* Oculto en PC */
}

@media (max-width: 768px) {
    /* Ocultamos los iconos del header viejo para no duplicar */
    .header-actions { display: none; }
    
    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: var(--bg-white);
        box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
        padding: 12px 10px;
        padding-bottom: env(safe-area-inset-bottom, 15px); /* Respeta la barra de inicio de iPhone */
        z-index: 900;
        border-top: 1px solid var(--border-light);
    }
    .nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        color: var(--text-light);
        font-size: 0.7rem;
        font-weight: 500;
    }
    .nav-item i {
        font-size: 1.3rem;
        transition: 0.3s;
    }
    .nav-item.active {
        color: var(--primary-dark);
    }
    .nav-item.active i {
        transform: translateY(-2px);
    }
    .mobile-badge {
        top: -6px;
        right: -10px;
    }
    .footer-logo {
        align-self: center;
    }
    
    /* Le damos espacio al footer para que el menú no lo tape */
    .ecommerce-footer {
        padding-bottom: 80px !important;
    }
}