/* ============================================================
   WC CATEGORY DISPLAY - CSS LIMPIO Y OPTIMIZADO (v1.3)
   ============================================================ */

/* 1. CONTENEDOR PRINCIPAL (BOTONES SUPERIORES) */
.wc-category-container {
    width: 100%;
    background-color: #000000; /* Fondo negro solicitado */
    padding: 5px 0;
}

.wc-category-wrapper {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    gap: 5px;
    padding: 5px 5px;
    scrollbar-width: thin;
    scrollbar-color: #cc0054 #000000;
}

.wc-category-wrapper::-webkit-scrollbar {
    height: 6px;
}

.wc-category-wrapper::-webkit-scrollbar-thumb {
    background-color: #cc0054;
    border-radius: 10px;
}

/* 2. BOTONES DE CATEGORÍA (ESTADO BASE) */
.wc-category-button {
    flex: 0 0 auto;
    padding: 10px 20px;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Versión móvil */
@media (max-width: 600px) {
    .wc-category-button {
        padding:8px 6px;
        font-size: 11px;
        border-radius: 24px;
        white-space: normal; /* Permite que el texto haga wrap si es necesario */
    }
}

.wc-category-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.2);
}

/* 3. MODAL - ESTRUCTURA Y ANIMACIÓN */
.wc-category-modal {
    display: none; /* Controlado por JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.75);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.wc-category-modal.active {
    display: flex;
}

.wc-category-modal-content {
    position: relative;
    background-color: #ffffff !important;
    border-radius: 15px;
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    animation: wcCatSlideUp 0.3s ease-out;
}

@keyframes wcCatSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 4. MODAL - CABECERA DINÁMICA */
.wc-category-modal-header {
    padding: 20px;
    text-align: center;
    /* El color de fondo se inyecta dinámicamente vía PHP/JS */
}

.wc-category-modal-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    /* El color de texto se inyecta dinámicamente */
}

.wc-category-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #ffffff;
    background: rgba(0,0,0,0.2);
    font-size: 28px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.wc-category-modal-close:hover {
    background: rgba(0,0,0,0.4);
}

/* 5. MODAL - CUERPO Y GRID DE SUBCATEGORÍAS */
.wc-category-modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.wc-cat-subcat-list.wc-grid-buttons {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    gap: 15px !important;
    list-style: none !important;
    padding: 10px 0 !important;
    margin: 20px 0 0 0 !important;
}

.wc-cat-subcat-list.wc-grid-buttons li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 6. BOTONES DE SUBCATEGORÍA (DINÁMICOS) */
a.wc-subcat-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    height: 75px !important;
    padding: 10px 15px !important;
    background-color: #ffffff !important;
    border: 1px solid #eeeeee !important;
    border-radius: 12px !important;
    
    /* Color dinámico pasado por JS */
    color: var(--cat-color) !important;
    
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    line-height: 1.2 !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.04) !important;
}

a.wc-subcat-button:hover {
    /* Inversión de colores usando variables JS */
    background-color: var(--cat-color) !important;
    color: var(--cat-text-color) !important;
    border-color: var(--cat-color) !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 15px rgba(0,0,0,0.1) !important;
}

/* 7. RESPONSIVE */
@media (max-width: 768px) {
    .wc-category-wrapper {
        justify-content: flex-start;
        padding: 5px 10px;
    }
    
    .wc-cat-name-desktop { display: none; }
    .wc-cat-name-mobile { display: inline; }

    .wc-cat-subcat-list.wc-grid-buttons {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    a.wc-subcat-button {
        height: 65px !important;
        font-size: 13px !important;
    }
}

@media (min-width: 769px) {
    .wc-cat-name-mobile { display: none; }
    .wc-cat-name-desktop { display: inline; }
}

/* Bloqueo de scroll cuando el modal está abierto */
body.wc-category-modal-open {
    overflow: hidden !important;
}