/* --- 1. CONFIGURACIÓN MAESTRA --- */
:root {
    --ios-bg: #F2F2F7;
    --ios-green: #75a86d;
    --ios-blue: #007AFF;
    --white: #FFFFFF;
    --sep: #C6C6C8;
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
    margin: 0; padding: 0; 
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Montserrat", sans-serif; 
    background: var(--ios-bg); 
    color: #000; 
    line-height: 1.4;
    padding-bottom: 140px; 
}
/* --- 2. HEADER COMPACTO (LOGO -25%) --- */
.header-container { 
    padding: 8px 15px; 
    text-align: center; 
    background: rgba(255, 255, 255, 0.8); 
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-bottom: 0.3px solid rgba(0,0,0,0.1); 
    position: sticky; top: 0; z-index: 1000; 
}

.brand-logo { 
    max-width: 105px; /* Reducción 25%[cite: 4] */
    margin-bottom: 5px; 
    display: inline-block;
}

.header-container h1 { display: none; } /* Removido para ahorrar espacio */
/* --- 3. PROGRESO Y BÚSQUEDA --- */
.progress-container { 
    width: 100%; max-width: 400px; height: 5px; 
    background: #E5E5EA; border-radius: 10px; 
    margin: 8px auto 5px; overflow: hidden; 
}

.progress-bar { 
    height: 100%; background: var(--ios-green); width: 0%; 
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1); 
}

#steps-info { 
    font-size: 9px; font-weight: 800; color: #8E8E93; 
    text-transform: uppercase; text-align: center; margin-bottom: 10px;
}

#search-container { position: relative; max-width: 420px; margin: 10px auto; }

#product-search { 
    width: 100%; padding: 8px 15px; border-radius: 10px; 
    border: none; background: #E3E3E8; font-size: 15px; outline: none;
}

.suggestions-box { 
    position: absolute; width: 100%; background: white; z-index: 2000; 
    border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
}


/* --- 4. CATEGORÍAS Y ESTRUCTURA DE FILAS (ESTRATEGIA FLEX) --- */
.category-block { 
    background: white; 
    border-radius: 20px; 
    margin-bottom: 16px; 
    border: none; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    overflow: hidden;
    width: 100%;
}

.category-block h2 { 
    background: white; 
    color: #000; 
    padding: 18px 20px; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 1.1rem; 
    font-weight: 700;
}

.category-block .arrow::after { content: '▼'; font-size: 0.7rem; color: var(--ios-green); }

/* FORZADO DE ANCHO TOTAL USANDO FLEXBOX */
.category-content, 
.container-selection { 
    display: none; 
    padding: 12px; 
    width: 100% !important;
    box-sizing: border-box;
}

.category-block.open .category-content, 
.container-selection { 
    display: flex !important; 
    flex-wrap: wrap !important; 
    flex-direction: row !important;
    justify-content: flex-start; /* Alinea al inicio pero con ancho calculado */
    gap: 10px; 
    border-top: 1px solid #F2F2F7; 
}

/* --- 5. DISEÑO DE CELDAS (CÁLCULO MATEMÁTICO DE 3 COLUMNAS) --- */
.container-item, 
.product-item { 
    background: #FFF; 
    border: 1px solid #E5E5EA; 
    border-radius: 16px; 
    padding: 12px; 
    text-align: center;
    
    /* CÁLCULO CRÍTICO: 
       (100% / 3) menos el margen del gap para que quepan 3 exactos 
    */
    flex: 0 0 calc(33.33% - 10px) !important; 
    max-width: calc(33.33% - 10px) !important;
    
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between; 
    min-height: 220px; 
    transition: 0.2s;
    box-sizing: border-box;
}

/* Ajuste de imagen para que no rompa el cuadro */
.container-item img { 
    width: 100%; 
    height: auto;
    aspect-ratio: 1/1; 
    object-fit: cover; 
    border-radius: 12px; 
    margin-bottom: 10px; 
}

/* Títulos con espaciado pro */
.product-item span, 
.container-item div[style*="font-weight:bold"] { 
    font-size: 0.8rem; 
    font-weight: 800; 
    line-height: 1.4; 
    margin: 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Corta a 2 líneas si es muy largo */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Precios y Lupa */
.product-item div[style*="color:#888"],
.container-item div[style*="color:#75a86d"] {
    font-weight: 900;
    font-size: 1rem;
    color: var(--ios-green) !important;
    margin-top: auto;
}

.view-link { 
    color: var(--ios-blue); 
    text-decoration: none; 
    font-size: 0.75rem; 
    font-weight: 700; 
    padding-top: 5px;
}
.view-link::before { content: "🔍 "; }

/* Input de selección */
.container-item input, 
.product-item input { margin-bottom: 10px; transform: scale(1.2); }

.container-item:has(input:checked), 
.product-item:has(input:checked) { 
    border: 2px solid var(--ios-green) !important; 
    background: #F0FDF4; 
}

/* --- 6. SELECTOR DE COLOR (AJUSTE PARA DRAWER) --- */
/* Ocultamos el placeholder viejo en productos para que no rompa la cuadrícula */
#color-selector-placeholder { display: none !important; }

/* Estilo que usaremos en el drawer */
.color-selector { 
    margin: 15px 0; padding: 15px; background: #FFF; 
    border-radius: 18px; border: 1px solid #E5E5EA; text-align: center;
}

.color-options { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }

.color-dot { 
    width: 38px; height: 38px; border-radius: 50%; 
    border: 3px solid white; box-shadow: 0 0 0 1px #D1D1D6; 
    cursor: pointer; transition: 0.2s;
}

.color-dot.selected { transform: scale(1.15); box-shadow: 0 0 0 2.5px var(--ios-green); }

.dot-rojo { background: #e74c3c; } .dot-azul { background: #3498db; } .dot-rosa { background: #fd79a8; }
.dot-blanco { background: #ffffff; } .dot-negro { background: #2d3436; } .dot-kraft { background: #d2b48c; }
.dot-madera-natural { background: #e3c4a8; }
/* --- 7. DISEÑO DEL CARRITO (SIDEBAR) --- */
.sidebar { background: white; padding: 25px; border-radius: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }

.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; border-bottom: 1px solid #F2F2F7; padding-bottom: 10px; }

#cart-list { list-style: none; }
#cart-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #F9F9F9; font-size: 0.9rem; }
#cart-list li b { color: var(--ios-green); margin-right: 5px; }

.total-display { font-size: 1.7rem; font-weight: 900; text-align: right; margin: 20px 0; color: var(--ios-green); border-top: 2px solid var(--ios-bg); padding-top: 15px; }

.remove-item { color: var(--ios-red); font-weight: 800; cursor: pointer; margin-left: 10px; }
/* --- 8. LAYOUT DE ESCRITORIO (AUDITADO) --- */
@media (min-width: 992px) {
    .main-content { 
        display: flex !important; 
        flex-direction: row !important; 
        gap: 40px; 
        padding: 30px; 
    }
    
    #product-container-wrapper { flex: 2.8; }
    
    .sidebar { 
        flex: 1; position: sticky; top: 80px; 
        height: fit-content; display: block !important; 
        box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    }
    
    .mobile-cart-button-fixed { display: none; }
}
/* --- 9. MÓVIL, CIERRE Y EXTRAS --- */
@media (max-width: 991px) {
    .sidebar { 
        display: none; position: fixed; bottom: 0; left: 0; width: 100%; 
        height: 78vh; background: white; z-index: 10001; padding: 45px 20px 25px; 
        border-radius: 30px 30px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,0.12); 
        overflow-y: auto; 
    }
    .sidebar.active { display: block; animation: slideUp 0.3s ease; }
    
    .close-cart-btn { 
        display: flex !important; position: absolute; top: 15px; right: 20px; 
        background: #EEE; border: none; width: 32px; height: 32px; border-radius: 50%; 
        align-items: center; justify-content: center; cursor: pointer; 
    }
    .close-cart-btn::after { content: "✕"; font-weight: 900; color: #333; }
    .sidebar::before { content: ""; display: block; width: 45px; height: 5px; background: #D1D1D6; border-radius: 10px; margin: -25px auto 25px; }
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.btn-confirm, .btn-quote { width: 100%; padding: 18px; border-radius: 16px; font-weight: 800; border: none; margin-bottom: 10px; cursor: pointer; }
.btn-confirm { background: var(--ios-blue); color: white; }
.btn-quote { background: var(--ios-green); color: white; }

.mobile-cart-button-fixed { position: fixed; bottom: 25px; left: 5%; width: 90%; background: #1C1C1E; color: white; padding: 18px; border-radius: 20px; text-align: center; font-weight: 800; z-index: 999; box-shadow: 0 12px 30px rgba(0,0,0,0.3); }

.custom-extra-container { background: #fff; border: 1.5px dashed var(--ios-green); padding: 25px; border-radius: 22px; margin-top: 30px; text-align: center; }
.highlight-item { background-color: #FEF9E7 !important; transition: background 1.5s; }
.hidden { display: none; }
/* --- 10. PALETA DE COLORES REALES (ACTUALIZADO ROSA CLARO) --- */
.dot-amarillo      { background-color: #FFECB3 !important; } /* Amarillo suave */
.dot-azul          { background-color: #A2D2FF !important; } /* Azul cielo */
.dot-rosa          { background-color: #FFD1DC !important; } /* Rosa Pastel */
.dot-verde         { background-color: #C1E1C1 !important; } /* Verde menta */
.dot-negro         { background-color: #2D2D2D !important; }
.dot-lila          { background-color: #E0BBE4 !important; } /* Lila suave */
.dot-kraft         { background-color: #D2B48C !important; }
.dot-gris          { background-color: #D3D3D3 !important; }
.dot-rojo { background-color: #E63946 !important; }
.dot-blanco        { background-color: #FFFFFF !important; border: 1px solid #ddd !important; }
.dot-madera-natural { background-color: #E3C4A8 !important; }

/* Estilo de los círculos (asegúrate de que tengan estas dimensiones) */
.color-dot {
    width: 38px !important;
    height: 38px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: inline-block !important;
    margin: 5px !important;
    border: 3px solid white !important;
    box-shadow: 0 0 0 1px #D1D1D6 !important;
    transition: 0.2s ease-in-out !important;
}

.color-dot.selected {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #75a86d !important;
}
/* Botón Hamburguesa */
.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #75a86d;
    transition: 0.3s;
}

/* Panel Lateral */
.side-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: white;
    z-index: 1100;
    transition: 0.4s ease;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.side-menu.active { left: 0; }

.menu-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.menu-header img { height: 40px; }

/* Estilos para que el texto se vea como en la imagen que quieres */
.menu-links a {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 15px 20px;
    border-bottom: 1px solid #f2f2f2;
    gap: 15px;
}

.menu-links .icon {
    font-size: 22px;
    min-width: 30px;
    text-align: center;
}

.text-group {
    display: flex;
    flex-direction: column;
}

.main-text {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.sub-text {
    font-size: 11px;
    color: #999;
}

.menu-wa .main-text {
    color: #25d366; /* Verde WhatsApp */
    font-weight: 700;
}

/* Evita que el logo se vea gigante o roto */
.menu-header img {
    max-height: 40px;
    width: auto;
    display: block;
}
/* --- Ajuste para nombres de productos largos --- */
.product-item label span, 
.container-item label div {
    display: block !important;
    white-space: normal !important; /* Permite que el texto salte de línea */
    overflow: visible !important;   /* Evita que se oculte el excedente */
    text-overflow: clip !important; /* Quita los puntos suspensivos */
    line-height: 1.2 !important;    /* Ajusta el espacio entre líneas */
    text-align: center;             /* Mantiene el texto centrado */
    margin-bottom: 5px;
    font-size: 14px;                /* Un poco más pequeño ayuda a que quepa mejor */
}

/* Ajuste específico para las tarjetas del catálogo */
.product-item, .container-item {
    height: auto !important;        /* Permite que la tarjeta crezca hacia abajo si el nombre es largo */
    min-height: 180px;              /* Mantiene una base uniforme */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
/* --- NUEVOS AJUSTES DE MINIATURAS Y LUPA --- */

/* Contenedor para mantener el tamaño siempre igual y centrado */
.thumb-wrapper {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px auto;
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
}

.product-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

/* Estilo para el vector de ausencia (Placeholder) */
.product-thumb.is-placeholder {
    object-fit: contain;
    padding: 12px;
    opacity: 0.3; /* Efecto sutil */
    background: #ebebeb;
}

/* Ajuste de la Lupa (desaparece el texto, queda el icono) */
.view-link { 
    display: inline-block;
    text-decoration: none;
    font-size: 0 !important; /* Oculta el texto "(ver)" */
    margin-left: 5px;
    vertical-align: middle;
}

.view-link::before { 
    content: "🔍"; 
    font-size: 14px; /* Tamaño del icono visible */
    visibility: visible;
}

/* Ajuste de precio para que resalte bajo el nombre */
.product-price {
    color: var(--ios-green) !important;
    font-weight: 800;
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Asegurar que la tarjeta crezca si es necesario */
.product-item {
    height: auto !important;
    padding-bottom: 15px !important;
}