/* =========================================
   1. NAVEGACIÓN Y HEADER (ESCRITORIO)
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5%;
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}

.logo img {
    max-height: 65px; /* Tamaño controlado y elegante para el logo */
    width: auto;
    display: block;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 40px; /* Espacio limpio entre el carrito y los enlaces */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: #333333;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-links a.active, 
.nav-links a:hover {
    color: #fb6e1e;
}

.cart-icon {
    font-size: 1.3rem;
    color: #fb6e1e;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.cart-icon:hover {
    transform: scale(1.1);
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #fb6e1e;
    color: #ffffff;
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-weight: 700;
}

/* =========================================
   2. ESTRUCTURA PRINCIPAL DEL CATÁLOGO
========================================= */
.catalog-main {
    padding: 120px 8% 80px 8%;
    min-height: 80vh;
    background-color: #fdf7f0; /* Fondo crema característico */
}

.catalog-title {
    text-align: center;
    font-size: 2.8rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 50px;
}

.catalog-container {
    display: flex;
    gap: 40px;
    max-width: 1300px;
    margin: 0 auto;
}

/* =========================================
   3. SIDEBAR DE CATEGORÍAS
========================================= */
.catalog-sidebar {
    width: 260px;
    background: #ffffff;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    height: fit-content;
    border: 1px solid #f0f0f0;
    position: sticky;
    top: 100px; /* Para que baje junto con el scroll */
}

.catalog-sidebar h3 {
    margin-bottom: 20px;
    color: #fb6e1e;
    font-size: 1.3rem;
    font-weight: 700;
}

#category-filters {
    list-style: none;
}

#category-filters li {
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #333333;
    margin-bottom: 5px;
}

#category-filters li:hover, 
#category-filters li.active {
    background-color: #fb6e1e;
    color: #ffffff;
    transform: translateX(5px);
}

/* =========================================
   GRID Y TARJETAS DE PRODUCTOS (REFINADO)
========================================= */
.products-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 35px;
}

.product-card {
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.06);
    border: none; /* Elimina cualquier borde por defecto */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    box-shadow: 0 15px 35px rgba(251, 110, 30, 0.15);
    transform: translateY(-5px);
}

.product-img {
    width: 100%;
    height: 220px;
    background-color: #f5f5f5;
    position: relative;
    overflow: hidden;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.product-card:hover .product-img img {
    transform: scale(1.08);
}

.product-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-info h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.product-info p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.price {
    font-weight: 800;
    color: #fb6e1e;
    font-size: 1.3rem;
}

/* FIX: Botón sin bordes feos y con estilo de píldora */
.btn-add {
    background-color: #fb6e1e;
    color: #ffffff;
    border: none !important; /* Fuerza a quitar bordes del navegador */
    outline: none;
    padding: 10px 22px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(251, 110, 30, 0.3); /* Sombra naranja elegante */
    transition: all 0.3s ease;
}

.btn-add:hover {
    background-color: #e05c12;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 110, 30, 0.4);
}

/* =========================================
   5. CARRITO LATERAL (OFF-CANVAS)
========================================= */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -5px 0 30px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open {
    right: 0;
}

.cart-header {
    padding: 25px;
    background: #fb6e1e;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.cart-header button {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.cart-header button:hover {
    transform: rotate(90deg);
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.cart-item {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.cart-item h5 {
    font-size: 1rem;
    color: #1a1a1a;
    margin-bottom: 5px;
}

.cart-item-details {
    font-size: 0.85rem;
    color: #888888;
    margin-bottom: 10px;
}

.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.remove-item {
    color: #e74c3c;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1rem;
    transition: color 0.3s ease;
}

.remove-item:hover {
    color: #c0392b;
}

.cart-footer {
    padding: 25px;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: 20px;
}

.w-100 { width: 100%; }
.mt-2 { margin-top: 15px; }

/* =========================================
   6. MODALES Y FORMULARIOS
========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.modal-header {
    padding: 20px 25px;
    background: #fdf7f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    color: #1a1a1a;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #666666;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
}

/* Formularios Elegantes */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333333;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dddddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #333333;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: #fb6e1e;
    box-shadow: 0 0 0 3px rgba(251, 110, 30, 0.15);
}

/* Opciones de personalización */
.option-group {
    margin-bottom: 20px;
}

.option-group h5 {
    margin-bottom: 12px;
    color: #fb6e1e;
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 5px;
}

.radio-label, 
.checkbox-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #444444;
}

.radio-label input, 
.checkbox-label input {
    margin-right: 12px;
    accent-color: #fb6e1e;
    transform: scale(1.2);
}

/* =========================================
   7. RESPONSIVE DESIGN
========================================= */
@media (max-width: 900px) {
    .catalog-container {
        flex-direction: column;
    }
    
    .catalog-sidebar {
        width: 100%;
        position: relative;
        top: 0;
    }

    #category-filters {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 10px;
    }

    #category-filters li {
        white-space: nowrap;
    }

    .nav-links {
        display: none; /* Idealmente aquí iría un menú hamburguesa */
    }
}

@media (max-width: 500px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* =========================================
   REPARAR NAVEGACIÓN EN MÓVIL (CATÁLOGO)
========================================= */
@media (max-width: 768px) {
    /* 1. Mostrar la barra de navegación fija desde el inicio */
    .navbar {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 10px 4% !important;
        background-color: #ffffff !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        box-shadow: 0 4px 15px rgba(0,0,0,0.08);
        z-index: 1000;
    }

    /* 2. Reducir el tamaño del logo para que encaje bien */
    .logo img {
        max-height: 45px !important;
        width: auto;
    }

    /* 3. Agrupar la navegación y el carrito a la derecha de forma horizontal */
    .header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 15px !important;
        margin-left: auto;
    }

    /* 4. Forzar que los enlaces de texto vuelvan a mostrarse en fila compacta */
    .nav-links {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .nav-links a {
        font-size: 0.75rem !important; /* Texto pequeño adaptado a celulares */
        font-weight: 600 !important;
        color: #333333 !important;
        text-decoration: none;
        white-space: nowrap;
    }

    .nav-links a.active, 
    .nav-links a:hover {
        color: #fb6e1e !important;
    }

    /* 5. Estilo del icono del carrito al lado de los enlaces */
    .cart-icon {
        font-size: 1.2rem !important;
        color: #fb6e1e !important;
        display: flex !important;
        align-items: center;
        position: relative;
    }

    #cart-count {
        top: -6px !important;
        right: -8px !important;
        font-size: 0.65rem !important;
        width: 16px !important;
        height: 16px !important;
    }

    /* 6. Empujar el contenido principal hacia abajo para que la barra fija no lo tape */
    .catalog-main {
        padding-top: 90px !important;
    }
}