/* Variables de Color e Identidad (Basado en el documento) */
:root {
    --color-green: #1a4a38; /* Verde corporativo oscuro */
    --color-green-light: #2c6e55;
    --color-black: #111111;
    --color-white: #ffffff;
    --color-gray-light: #f5f5f5;
    --color-gray-medium: #dddddd;
    --color-gray-dark: #666666;
    --color-danger: #e53e3e; /* Para precios tachados y alertas */
    --font-primary: 'Inter', sans-serif;
    
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

/* Reset y Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    color: var(--color-black);
    background-color: var(--color-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 50px; /* Margen amplio para evitar que cualquier cosa toque el borde */
}

.section-padding {
    padding: 60px 0;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--color-green);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: var(--color-green-light);
}

.btn-secondary {
    background-color: var(--color-white);
    color: var(--color-green);
    border: 2px solid var(--color-green);
}

.btn-secondary:hover {
    background-color: var(--color-gray-light);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Componentes Genéricos: Imágenes */
.logo {
    height: 85px;
    width: auto;
    object-fit: contain;
}

.logo-footer {
    height: 90px;
    width: auto;
    object-fit: contain;
    margin-bottom: 20px;
}

/* Header */
.header {
    background-color: var(--color-black);
    border-bottom: 1px solid #333333;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 95px;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-gray-medium);
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-white);
}

.header-actions {
    display: flex;
    align-items: center;
}

.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    color: var(--color-white);
}

.hamburger-btn {
    display: none; /* Oculto en escritorio */
    background: none;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    margin-left: 20px;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--color-green);
    color: var(--color-white);
    font-size: 0.75rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* Banner Principal (Hero) */
.hero {
    position: relative;
    height: 450px;
    background-color: var(--color-gray-medium); /* Fallback */
}

.hero-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #d1d5db; /* Gris para simular foto */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 100%);
    display: flex;
    align-items: center;
}

.hero-content {
    color: var(--color-white);
    max-width: 600px;
}

.hero-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

/* Categorías */
.categories {
    text-align: center;
}

.categories h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    color: var(--color-black);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
}

.category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.category-image-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: var(--color-gray-medium);
    transition: var(--transition);
}

.category-item:hover .category-image-placeholder {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.category-item span {
    font-weight: 600;
    color: var(--color-black);
}

/* Productos */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2rem;
}

.view-all {
    color: var(--color-green);
    font-weight: 600;
}

.products-carousel-container {
    position: relative;
    width: 100%;
}

.products-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 30px;
    padding-bottom: 20px;
    /* Hide scrollbar */
    scrollbar-width: none; /* Firefox */
}
.products-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.product-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-medium);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    flex: 0 0 calc(25% - 22.5px); /* Show 4 items on large screens */
    scroll-snap-align: start;
    min-width: 250px;
    display: flex;
    flex-direction: column;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--color-white);
    color: var(--color-black);
    border: 1px solid var(--color-gray-medium);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    box-shadow: var(--shadow);
    z-index: 10;
    transition: var(--transition);
}

.carousel-btn:hover {
    background-color: var(--color-green);
    color: var(--color-white);
}

.prev-btn { left: -25px; } /* Flechas en el espacio del padding para no tapar la foto */
.next-btn { right: -25px; }

.product-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-5px);
}

.product-image-placeholder {
    width: 100%;
    height: 250px;
    background-color: var(--color-gray-medium);
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-category {
    font-size: 0.8rem;
    color: var(--color-gray-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 8px 0;
    line-height: 1.3;
}

.product-format {
    font-size: 0.9rem;
    color: var(--color-gray-dark);
    margin-bottom: 15px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    margin-top: auto;
}

.current-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-green);
}

.old-price {
    font-size: 1rem;
    color: var(--color-gray-dark);
    text-decoration: line-through;
}

/* Footer */
.footer {
    background-color: var(--color-black);
    color: var(--color-white);
    padding-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-col p {
    color: #aaaaaa;
}

.footer-col h4 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--color-white);
}

.footer-col ul li {
    margin-bottom: 10px;
}

.footer-col ul li a {
    color: #aaaaaa;
}

.footer-col ul li a:hover {
    color: var(--color-white);
}

.footer-bottom {
    border-top: 1px solid #333333;
    padding: 20px 0;
    text-align: center;
    color: #aaaaaa;
    font-size: 0.9rem;
}

/* WhatsApp Float */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: transparent;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    z-index: 1000;
    transition: var(--transition);
}

.whatsapp-float:hover {
    transform: scale(1.1);
}

/* Catalog Page */
.catalog-header {
    text-align: center;
    margin-bottom: 40px;
}
.catalog-header h2 {
    font-size: 2.5rem;
    color: var(--color-black);
    margin-bottom: 10px;
}
.catalog-header p {
    color: var(--color-gray-dark);
    font-size: 1.1rem;
}

.catalog-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.sidebar-filters {
    flex: 0 0 250px;
    background: var(--color-gray-light);
    padding: 20px;
    border-radius: var(--radius);
    position: sticky;
    top: 100px;
}

.filter-widget {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-gray-medium);
}

.btn-clear-filters {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-clear-filters:hover {
    text-decoration: underline;
}

.filter-group {
    margin-bottom: 25px;
}

.filter-group h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--color-black);
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--color-gray-dark);
}

.filter-label:hover {
    color: var(--color-black);
}

.price-range {
    margin-bottom: 10px;
}

.price-range input[type=range] {
    width: 100%;
    accent-color: var(--color-green);
}

.price-values {
    font-size: 0.9rem;
    color: var(--color-gray-dark);
}

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

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: var(--color-gray-light);
    border-radius: var(--radius);
    color: var(--color-gray-dark);
}

/* Dashboard / Perfil */
.dashboard-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.dashboard-nav {
    flex: 0 0 250px;
    background: var(--color-gray-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.dashboard-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dashboard-nav li {
    border-bottom: 1px solid var(--color-gray-medium);
}

.dashboard-nav li:last-child {
    border-bottom: none;
}

.dashboard-nav a {
    display: block;
    padding: 15px 20px;
    color: var(--color-gray-dark);
    font-weight: 600;
    transition: var(--transition);
}

.dashboard-nav a:hover,
.dashboard-nav a.active {
    background: var(--color-green);
    color: var(--color-white);
}

.dashboard-content {
    flex: 1;
    background: var(--color-white);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--color-gray-medium);
}

.tab-section {
    display: none;
}

.tab-section.active {
    display: block;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.orders-table th,
.orders-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-medium);
}

.orders-table th {
    background: var(--color-gray-light);
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.entregado {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.preparacion {
    background-color: #fff3cd;
    color: #856404;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-gray-medium);
    border-radius: 4px;
    font-family: inherit;
}

/* Detalle de Producto */
.product-detail-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    background: var(--color-white);
    padding: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--color-gray-medium);
    margin-bottom: 40px;
}

.product-detail-image {
    flex: 0 0 500px;
    background: var(--color-gray-light);
    border-radius: var(--radius);
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-detail-info {
    flex: 1;
}

.product-detail-category {
    font-size: 0.9rem;
    color: var(--color-gray-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: block;
}

.product-detail-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-black);
}

.product-detail-brand {
    color: var(--color-gray-dark);
    font-size: 1rem;
    margin-bottom: 20px;
}

.product-detail-price-box {
    margin-bottom: 25px;
}

.product-detail-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-green);
    margin-bottom: 5px;
}

.product-detail-price-kilo {
    color: var(--color-gray-dark);
    font-size: 0.95rem;
}

.product-detail-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.product-detail-actions .btn {
    flex: 1;
}

.btn-whatsapp {
    background-color: #25D366;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

.product-detail-description {
    border-top: 1px solid var(--color-gray-medium);
    padding-top: 25px;
    margin-bottom: 25px;
}

.product-detail-description h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.product-detail-description p {
    color: var(--color-gray-dark);
    line-height: 1.6;
    margin-bottom: 15px;
}

.similar-products-header {
    border-bottom: 2px solid var(--color-gray-medium);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.similar-products-header h3 {
    font-size: 1.5rem;
}

/* Botón WhatsApp Flotante */
.floating-wsp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25D366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease;
    text-decoration: none;
}

.floating-wsp:hover {
    background-color: #128C7E;
    transform: scale(1.1);
    color: white;
}

.wsp-tooltip {
    position: absolute;
    bottom: 75px; /* Above the button */
    right: 0;
    background-color: var(--color-white);
    color: var(--color-black);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    border: 1px solid var(--color-gray-medium);
}

.wsp-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background-color: var(--color-white);
    border-right: 1px solid var(--color-gray-medium);
    border-bottom: 1px solid var(--color-gray-medium);
    transform: rotate(45deg);
}

.floating-wsp:hover .wsp-tooltip,
.wsp-tooltip.show-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Search System */
.search-trigger-btn {
    background: none;
    border: none;
    color: var(--color-white);
    cursor: pointer;
    margin-right: 15px;
    display: flex;
    align-items: center;
}

.search-container {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-white);
    padding: 15px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 98;
}

.search-container.active {
    display: block;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 0 15px;
    height: 45px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0 15px;
    font-size: 1rem;
    outline: none;
}

.close-search-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-gray-dark);
}

.search-results-dropdown {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: var(--color-black);
    gap: 15px;
}

.search-result-item:hover {
    background-color: #fafafa;
}

.search-result-img {
    width: 50px;
    height: 50px;
    background-color: var(--color-gray-medium);
    border-radius: 4px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
}

.search-result-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.search-result-price {
    font-size: 0.9rem;
    color: var(--color-green);
    font-weight: bold;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        padding: 0 40px; /* Margen extra para iPads y tablets */
    }
    .product-card {
        flex: 0 0 calc(33.333% - 20px);
    }
    .carousel-btn {
        display: none; /* Ocultar botones en tablets (se usa el dedo para deslizar) */
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 35px; /* Más margen lateral para que nada choque con los bordes */
    }
    
    .section-padding {
        padding: 45px 0;
    }

    .header-content {
        height: auto;
        padding: 15px 0;
    }
    
    .hamburger-btn {
        display: flex; /* Mostrar en tablet/móvil */
    }
    
    .main-nav {
        display: none; /* Ocultar por defecto en móvil */
        width: 100%;
        flex-direction: column;
        background-color: var(--color-black);
        position: absolute;
        top: 100%;
        left: 0;
        padding: 20px 0;
        border-top: 1px solid #333;
        box-shadow: 0 10px 15px rgba(0,0,0,0.3);
        z-index: 99;
    }
    
    .main-nav.active {
        display: flex; /* Mostrar cuando tenga la clase active */
    }
    
    .main-nav a {
        padding: 15px 30px;
        font-size: 1.1rem;
        border-bottom: 1px solid #222;
        width: 100%;
        text-align: left;
    }
    
    .main-nav a:last-child {
        border-bottom: none;
    }
    
    .hero {
        height: auto;
        min-height: 400px;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .product-card {
        flex: 0 0 calc(75%); /* Más pequeño en carrusel */
        min-width: 0;
    }
    
    .carousel-btn {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columnas tipo MercadoLibre */
        gap: 10px; /* Menos espacio para no apretar el contenido */
    }
    
    .product-card .product-image-placeholder {
        height: 150px; /* Imagen más pequeña en móvil */
    }
    
    .product-card .product-info {
        padding: 10px;
    }
    
    .product-card .product-title {
        font-size: 0.85rem;
        line-height: 1.2;
        margin-bottom: 5px;
    }
    
    .product-card .product-price .current-price {
        font-size: 1.1rem;
    }
    
    .product-card .btn {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 35px;
    }
    
    .catalog-layout {
        flex-direction: column;
    }
    
    .sidebar-filters,
    .dashboard-nav {
        flex: none;
        width: 100%;
        position: static;
        margin-bottom: 30px;
    }
    
    .dashboard-layout,
    .product-detail-layout {
        flex-direction: column;
        padding: 20px;
    }
    
    .product-detail-image {
        flex: none;
        width: 100%;
        height: 300px;
    }
    
    .product-detail-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 20px; /* En pantallas muy pequeñas ajustamos un poco para no perder tanto espacio */
    }
    .hero-content h1 {
        font-size: 1.8rem;
    }
}

/* Cart Sidebar */
.cart-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}
.cart-sidebar {
    position: fixed;
    top: 0; right: -400px;
    width: 100%; max-width: 400px; height: 100%;
    background-color: var(--color-white);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
}
.cart-sidebar.active {
    right: 0;
}
.cart-header {
    padding: 20px;
    border-bottom: 1px solid var(--color-gray-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.close-cart {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-gray-dark);
}
.cart-items {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.empty-cart {
    text-align: center;
    color: var(--color-gray-dark);
    margin-top: 50px;
}
.cart-footer {
    padding: 20px;
    border-top: 1px solid var(--color-gray-medium);
    background-color: var(--color-gray-light);
}
.cart-total {
    display: flex; justify-content: space-between; align-items: center; font-size: 1.2rem; font-weight: 700; margin-bottom: 15px;
}

