/* RESET Y ESTILOS GENERALES */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    position: relative;
    transition: all 0.3s ease;
}

body.menu-open, body.cart-open {
    overflow: hidden;
}

/* HEADER Y NAVEGACIÓN */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
    order: 1;
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
}

/* BOTÓN HAMBURGUESA */
.hamburger {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    order: -1;
    z-index: 1001;
    display: none;
    transition: all 0.3s ease;
}

.hamburger:hover {
    opacity: 0.8;
}

.hamburger.active {
    transform: rotate(90deg);
}

/* MENÚ PRINCIPAL */
nav {
    width: 100%;
    order: 2;
}

nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
}

nav ul li {
    margin: 0 0.5rem;
    position: relative;
}

nav ul li a {
    color: white;
    text-decoration: none;
    padding: 0.8rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    display: block;
    font-weight: 500;
}

nav ul li a:hover {
    background-color: #34495e;
    transform: translateY(-2px);
}

/* CONTENIDO PRINCIPAL */
main {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 150px);
}

/* SECCIÓN DE PRODUCTOS */
.product-section h2 {
    margin: 1.5rem 0;
    color: #2c3e50;
    font-size: 1.5rem;
    text-align: center;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

.products-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* TARJETAS DE PRODUCTO */
.product {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.product img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    padding: 1rem;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    transition: transform 0.3s ease;
}

/* Estilos para productos surtidos */
.product[data-surtido="true"]::after {
    content: 'Surtido';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 152, 0, 0.9);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.product[data-estado="agotado"] {
    position: relative;
    opacity: 0.7;
}

.product[data-estado="agotado"]::after {
    content: 'AGOTADO';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
}

.product:hover img {
    transform: scale(1.05);
}

.product p {
    padding: 0.8rem;
    font-size: 0.95rem;
    flex-grow: 1;
    margin: 0;
    color: #333;
}

.price {
    font-weight: bold;
    color: #e74c3c;
    margin: 0.5rem 0;
    padding: 0 0.8rem;
    font-size: 1.1rem;
}

.cotizar-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.7rem;
    cursor: pointer;
    width: 100%;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    margin-top: auto;
    font-weight: bold;
}

.cotizar-btn:hover {
    background-color: #2980b9;
    letter-spacing: 0.5px;
}

.cotizar-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* CARRITO DE COMPRAS */
#cart-display {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: white;
    box-shadow: 0 0 25px rgba(0,0,0,0.2);
    padding: 1.5rem;
    z-index: 1100;
    overflow-y: auto;
    transition: all 0.4s ease;
}

#cart-display.active {
    right: 0;
}

#cart-display h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

#close-cart {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s ease;
}

#close-cart:hover {
    color: #e74c3c;
}

#cart-items {
    margin-top: 1rem;
    padding: 0;
}

.empty-cart {
    text-align: center;
    color: #7f8c8d;
    padding: 1rem 0;
    font-style: italic;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 30px;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.cart-item.surtido {
    position: relative;
    border-left: 4px solid #FFC107;
    background-color: #FFF8E1;
}

.cart-item img {
    width: 100%;
    height: 80px;
    object-fit: contain;
    border-radius: 4px;
    background: #f8f8f8;
    padding: 0.5rem;
}

.cart-item-info {
    overflow: hidden;
}

.cart-item-name {
    font-weight: bold;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item .surtido-notice {
    font-size: 0.8rem;
    color: #FF9800;
    font-style: italic;
    margin: 3px 0;
}

.cart-item-price {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.cart-item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #f8f8f8;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background: #eee;
    transform: scale(1.1);
}

.quantity {
    min-width: 20px;
    text-align: center;
}

/* Estilos para mostrar los descuentos */
.descuento-info {
    display: flex;
    gap: 10px;
    margin-top: 5px;
    font-size: 0.9rem;
}

.precio-original {
    text-decoration: line-through;
    color: #999;
}

.descuento-aplicado {
    color: #27ae60;
    font-weight: bold;
}

.cart-item-subtotal {
    font-weight: bold;
    color: #2c3e50;
}

.remove-item {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.4rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    grid-column: 3;
    grid-row: 1;
}

.remove-item:hover {
    background: #fde8e8;
    transform: rotate(90deg);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding: 1.2rem 0;
    font-weight: bold;
    font-size: 1.2rem;
    border-top: 2px solid #333;
    margin-top: 1rem;
    color: #2c3e50;
}

.surtido-global-note {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #FFF3E0;
    border-radius: 4px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #E65100;
}

#finalizar-cotizacion {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 0.9rem;
    width: 100%;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
    border-radius: 6px;
    font-weight: bold;
}

#finalizar-cotizacion:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

#finalizar-cotizacion:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ÍCONO CARRITO MÓVIL */
.mobile-cart-icon {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: #3498db;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1050;
    transition: all 0.3s ease;
}

.mobile-cart-icon:hover {
    transform: scale(1.1);
    background-color: #2980b9;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
    display: none;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

/* FORMULARIO DE PEDIDO (NO OBLIGATORIO) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 1200;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transform: translateY(20px);
    transition: all 0.3s ease;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active form {
    transform: translateY(0);
}

#cerrar-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    transition: color 0.3s ease;
}

#cerrar-modal:hover {
    color: #e74c3c;
}

.modal h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.4rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #3498db;
}

/* Campos opcionales */
form label::after {
    content: " (opcional)";
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
}

.modal label {
    display: block;
    margin: 1.2rem 0 0.5rem;
    font-weight: bold;
    color: #2c3e50;
    font-size: 0.95rem;
}

.modal input,
.modal textarea,
.modal select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
    outline: none;
}

.modal textarea {
    resize: vertical;
    min-height: 120px;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.8rem;
    gap: 1rem;
}

.form-buttons button {
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-buttons button[type="submit"] {
    background-color: #2ecc71;
    color: white;
    flex: 1;
}

.form-buttons button[type="submit"]:hover {
    background-color: #27ae60;
    transform: translateY(-2px);
}

.form-buttons button[type="button"] {
    background-color: #e74c3c;
    color: white;
}

.form-buttons button[type="button"]:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Botón para enviar sin datos */
.btn-sin-datos {
    background-color: #757575 !important;
    margin-right: 10px;
    border: none;
    color: white;
    padding: 0.9rem;
    width: auto;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    border-radius: 6px;
    font-weight: bold;
}

.btn-sin-datos:hover {
    background-color: #616161 !important;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* NOTIFICACIONES */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2ecc71;
    color: white;
    padding: 14px 28px;
    border-radius: 6px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 90%;
    text-align: center;
    font-weight: bold;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    bottom: 30px;
}

.notification.error {
    background-color: #e74c3c;
}

.notification.surtido {
    background-color: #FFC107;
    color: #000;
    border-left: 4px solid #FF9800;
}

/* FOOTER */
footer {
    text-align: center;
    padding: 1.8rem;
    background-color: #2c3e50;
    color: white;
    margin-top: 3rem;
    font-size: 0.95rem;
}

/* OVERLAY MENÚ MÓVIL */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .products-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 992px) {
    .products-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* VERSIÓN MÓVIL */
@media (max-width: 768px) {
    header {
        padding: 0.8rem;
    }
    
    h1 {
        font-size: 1.3rem;
        padding: 0.5rem 0;
    }
    
    .hamburger {
        display: block;
    }
    
    nav ul {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: #2c3e50;
        flex-direction: column;
        padding: 5rem 1rem 1rem;
        box-shadow: 5px 0 15px rgba(0,0,0,0.3);
        z-index: 1000;
        transition: all 0.4s ease-out;
    }
    
    nav ul.show {
        left: 0;
    }
    
    nav ul li {
        margin: 0.5rem 0;
    }
    
    nav ul li a {
        padding: 1rem;
        border-radius: 4px;
    }
    
    .products-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #cart-display {
        width: 95%;
    }
    
    .mobile-cart-icon {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    
    .form-buttons {
        flex-direction: column-reverse;
    }
    
    .btn-sin-datos {
        margin-right: 0;
        margin-top: 10px;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-container {
        grid-template-columns: 1fr;
    }
    
    .product img {
        height: 180px;
    }
    
    .modal form {
        padding: 1.5rem;
    }
    
    .mobile-cart-icon {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* ANIMACIONES */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-in {
    animation: slideIn 0.4s ease forwards;
}