/* --- Base y Variables --- */
:root {
    --primary-color: #ff5722;
    --secondary-color: #007bff;
    --text-dark: #333333;
    --text-light: #6c757d;
    --background-light: #f4f7f9;
    --border-color: #e9ecef;
    --success-color: #28a745;
    --danger-color: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background-light);
    overflow-x: hidden; 
}

a {
    text-decoration: none;
    color: var(--secondary-color);
    transition: color 0.3s;
    cursor: pointer;
}

a:hover {
    color: #0056b3;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Botones --- */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-transform: uppercase;
}
.btn-primary {
    background-color: var(--primary-color); 
    color: white;
}
.btn-primary:hover {
    background-color: #e64a19;
    transform: translateY(-1px);
}
.btn-secondary {
    background-color: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--border-color);
}
.btn-primary.small, .btn-secondary.small {
    padding: 8px 15px;
    font-size: 0.9rem;
}
.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

/* --- HEADER MEJORADO --- */
.main-header {
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.2); 
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 10px 15px;
    align-items: center;
}

.logo {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    color: var(--text-dark);
}
.logo img {
    height: 35px;
    margin-right: 10px;
}
.logo span {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color); 
}

.search-bar {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    width: 100%;
}
.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--primary-color); 
    border-right: none;
    border-radius: 5px 0 0 5px;
    outline: none;
    font-size: 1rem;
}
.search-bar button {
    background-color: var(--secondary-color); 
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}
.search-bar button:hover {
    background-color: #0056b3;
}

/* CARRITO SIEMPRE VISIBLE EN MÓVIL */
.header-icons {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-icons a {
    font-size: 0.9rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    font-weight: 600;
}
.header-icons i {
    font-size: 1.5rem; 
    margin-right: 5px;
    color: var(--primary-color); 
}
.cart-icon {
    position: relative;
    display: flex !important;
    align-items: center;
    cursor: pointer;
}
.cart-count {
    background-color: var(--secondary-color); 
    position: absolute;
    top: -5px;
    right: -10px;
    color: white;
    border-radius: 50%;
    padding: 3px 7px;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

/* Botón hamburguesa */
.menu-toggle {
    grid-column: 4;
    grid-row: 1;
    display: block;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-dark);
    cursor: pointer;
    padding: 5px;
}

/* Navegación */
.main-nav {
    background-color: #f8f8f8;
    border-top: 1px solid var(--border-color);
}
.nav-list {
    list-style: none;
    display: none;
    padding: 0;
    margin: 0;
}
.nav-list.active {
    display: flex;
    flex-direction: column;
}

.nav-list li a {
    display: block;
    padding: 12px 15px;
    color: var(--text-dark);
    font-weight: 600;
    transition: all 0.3s;
}
.nav-list li a:hover {
    background-color: var(--border-color);
    color: var(--primary-color);
}

.highlight {
    color: var(--primary-color) !important;
    font-weight: 700 !important;
}

.mobile-only {
    display: none;
}

.hide-mobile-text {
    display: none;
}

/* Submenu */
.has-submenu {
    position: relative;
}

.submenu {
    list-style: none;
    padding-left: 20px;
    background-color: #f2f2f2;
    margin: 5px 0;
}
.submenu a {
    font-weight: 400 !important;
    padding: 8px 15px !important;
}

/* --- Hero y Trust Bar --- */
.hero-slider {
    background-color: #fce4d4; 
    padding: 60px 20px; 
    text-align: center;
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 15px;
}
.hero-content p {
    font-size: 1.2rem;
    color: var(--text-dark);
    margin-bottom: 30px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
.hero-buttons a {
    margin: 10px;
}

.trust-bar {
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
}
.trust-grid {
    display: flex;
    justify-content: space-around;
    text-align: center;
    flex-wrap: wrap;
}
.trust-grid div {
    font-weight: 600;
    color: var(--text-dark);
    margin: 10px;
    font-size: 0.95rem;
}
.trust-grid i {
    color: var(--secondary-color);
    margin-right: 5px;
}

/* --- Productos --- */
.productos-seccion {
    padding: 60px 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}
.productos-seccion h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 20px;
    grid-column: 1 / -1; 
}
.productos-seccion h2 i {
    color: var(--primary-color);
    margin-right: 10px;
}

.sidebar {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border-top: 3px solid var(--primary-color);
}
.filter-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}
.filter-group:last-of-type {
    border-bottom: none;
}
.filter-group h4 {
    margin-bottom: 10px;
    font-weight: 700;
    color: var(--primary-color);
}
.filter-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.products-wrapper {
    width: 100%;
}
.product-list {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.product-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s;
    position: relative;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 87, 34, 0.2);
}
.product-card img {
    width: 100%;
    height: 180px;
    object-fit: contain; 
    padding: 15px;
    background-color: #fcfcfc;
    cursor: pointer;
}

.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.product-category {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 5px;
}
.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
    min-height: 45px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-rating {
    margin-bottom: 10px;
}
.product-rating .fas {
    color: #ffc107;
}
.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 10px 0;
}
.product-price.price-offer {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
}
.original-price {
    text-decoration: line-through;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 400;
}

.add-to-cart-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 10px;
    border: none;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0 15px 15px;
}
.add-to-cart-btn:hover:not(:disabled) {
    background-color: #0056b3;
}
.add-to-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--danger-color);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
}

/* --- Footer --- */
.main-footer {
    background-color: var(--text-dark);
    color: white;
    padding: 40px 20px 20px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-col h4 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 700;
}
.footer-col ul {
    list-style: none;
}
.footer-col ul li {
    margin-bottom: 10px;
}
.footer-col a {
    color: #ccc;
    transition: color 0.3s;
}
.footer-col a:hover {
    color: var(--secondary-color);
}
.footer-bottom {
    text-align: center;
    padding-top: 20px;
}
.footer-bottom p {
    font-size: 0.8rem;
    color: #ccc;
}
.social-icons {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.social-icons a {
    font-size: 1.5rem;
    color: white;
}

/* --- Modales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
}
.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    position: relative;
    max-width: 90%;
    width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}
.modal-content.large-modal {
    width: 700px;
}
.modal-content h3 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.cart-modal {
    width: 400px;
}
.cart-items-container {
    max-height: 350px;
    overflow-y: auto;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}
.cart-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
}
.cart-item-info {
    flex: 1;
}
.cart-item-info h4 {
    font-size: 0.9rem;
    margin: 0;
}
.cart-item-info p {
    font-size: 0.8rem;
    color: var(--text-light);
}
.cart-summary {
    border-top: 2px solid var(--primary-color);
    padding-top: 15px;
    margin-top: 15px;
}
.cart-total-line {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}
.cart-total-line.final {
    font-size: 1.3rem;
    color: var(--primary-color);
}
.empty-cart-message {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.checkout-final-total {
    display: flex;
    justify-content: space-between;
    background-color: var(--background-light);
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
}
.checkout-final-total span {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

.image-modal {
    display: none; 
    position: fixed;
    z-index: 4000; 
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); 
}
.image-modal.active {
    display: flex;
    align-items: center; 
    justify-content: center;
}
.image-modal .modal-content-img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
}
#caption {
    text-align: center;
    color: #ccc;
    padding: 10px;
    font-size: 1.2rem;
}
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    cursor: pointer;
    z-index: 4010;
}

/* Flotantes */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 32px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1500;
    transition: transform 0.3s;
}
.whatsapp-float:hover {
    transform: scale(1.1);
}

.chatbot-pill {
    position: fixed;
    bottom: 90px;
    right: 20px;
    background-color: var(--secondary-color);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    text-align: center;
    line-height: 60px;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    cursor: pointer;
    transition: all 0.3s;
}
.chatbot-pill.hidden {
    display: none;
}

/* CHATBOT MEJORADO */
.chatbot-window {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 350px;
    height: 450px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    z-index: 1600;
    transform: scale(0);
    transform-origin: bottom right;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}
.chatbot-window.active {
    transform: scale(1);
    visibility: visible;
    opacity: 1;
}
#chatbot-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#close-chatbot {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}
#chatbot-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: var(--background-light);
}
.message {
    padding: 10px 12px;
    border-radius: 15px;
    margin-bottom: 12px;
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.user-message {
    background-color: var(--secondary-color);
    color: white;
    margin-left: auto;
    text-align: right;
}
.bot-message {
    background-color: white;
    color: var(--text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.bot-message a {
    color: var(--secondary-color);
    font-weight: 600;
    text-decoration: underline;
}
#chatbot-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--border-color);
    background: white;
    gap: 5px;
}
#chatbot-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
}
#send-chatbot-message {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}
#send-chatbot-message:hover {
    background-color: #e64a19;
}

.notification-float {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 3000;
}
.notification-float.show {
    opacity: 1;
    visibility: visible;
}

/* RESPONSIVE - MÓVIL */
@media (max-width: 767px) {
    .hero-content h1 {
        font-size: 1.8rem;
    }
    .hero-content p {
        font-size: 1rem;
    }
    .hero-buttons a {
        font-size: 0.85rem;
        padding: 8px 15px;
    }
    
    .productos-seccion {
        grid-template-columns: 1fr;
        padding: 20px 10px;
    }
    .sidebar {
        order: -1;
    }
    .product-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .product-card img {
        height: 140px;
    }
    .product-name {
        font-size: 0.95rem;
        min-height: 40px;
    }
    .product-price {
        font-size: 1.3rem;
    }
    .add-to-cart-btn {
        padding: 8px;
        font-size: 0.85rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    .cart-modal {
        width: 95%;
    }
    
    .chatbot-window {
        width: 90%;
        max-width: 350px;
        right: 5%;
        bottom: 160px;
    }
}

/* DESKTOP */
@media (min-width: 768px) {
    .header-top {
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto;
        padding: 15px 20px;
    }
    
    .logo {
        grid-column: 1;
        grid-row: 1;
    }
    .logo img {
        height: 45px;
    }
    .logo span {
        font-size: 1.5rem;
    }
    
    .search-bar {
        grid-column: 2;
        grid-row: 1;
        max-width: 600px;
        margin: 0 20px;
    }
    
    .header-icons {
        grid-column: 3;
        grid-row: 1;
        gap: 20px;
    }
    
    .hide-mobile-text {
        display: inline;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .nav-list {
        display: flex !important;
        flex-direction: row;
        justify-content: center;
    }
    
    .productos-seccion {
        grid-template-columns: 280px 1fr;
    }
    
    .product-list {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .has-submenu .submenu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 200px;
        background-color: #fff;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        z-index: 1010;
        padding: 5px 0;
        border-radius: 0 0 5px 5px;
        border-top: 2px solid var(--primary-color);
    }
    .has-submenu:hover .submenu {
        display: block;
    }
    .submenu {
        padding-left: 0;
        background-color: transparent;
        margin: 0;
    }
    .submenu li a {
        padding: 10px 15px !important;
    }
}