/* ==============================================
   MEJORAS PARA LA LISTA DE SERVICIOS AMPLIADA
   Añadir este CSS al final del archivo form.css
   o crear como form-improvements.css
   ============================================== */

/* Sobrescribir estilos para la lista de servicios */
.tcb-field-wrapper.tcb-field-checkbox_group .tcb-label {
    margin-bottom: 4px;
}

/* Nota informativa */
.tcb-field-wrapper.tcb-field-checkbox_group::after {
    content: '📋 Scroll to see all options • Select all that apply';
    display: block;
    font-size: 11px;
    color: #888;
    text-align: center;
    margin-top: -8px;
    margin-bottom: 8px;
    font-style: italic;
}

/* Contenedor optimizado con mejor grid */
.tcb-checkbox-group {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)) !important;
    gap: 6px !important;
    max-height: 380px !important;
    overflow-y: auto !important;
    padding: 12px !important;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 0.95), 
        rgba(250, 246, 242, 0.7)) !important;
    border: 1px solid rgba(164, 119, 100, 0.15) !important;
    border-radius: 10px !important;
    margin-top: 10px !important;
    position: relative !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05) !important;
}

/* Indicador de scroll */
.tcb-checkbox-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to bottom, 
        rgba(250, 246, 242, 0.95), 
        transparent);
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
}

.tcb-checkbox-group::after {
    content: '⬇ More options below';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px;
    font-size: 10px;
    text-align: center;
    color: var(--tcb-primary);
    background: linear-gradient(to top, 
        rgba(250, 246, 242, 0.98), 
        rgba(250, 246, 242, 0.8));
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
}

/* Mostrar indicadores cuando hay scroll */
.tcb-checkbox-group:not(:hover) {
    scrollbar-width: thin;
}

.tcb-checkbox-group:hover::after {
    opacity: 1;
}

/* Items más compactos */
.tcb-checkbox-item {
    display: flex !important;
    align-items: center !important;
    background: white !important;
    padding: 7px 10px !important;
    border: 1px solid rgba(164, 119, 100, 0.1) !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    min-height: 36px !important;
}

/* Estados hover y checked más visibles */
.tcb-checkbox-item:hover {
    border-color: var(--tcb-primary) !important;
    background: rgba(164, 119, 100, 0.04) !important;
    transform: translateX(3px) !important;
}

.tcb-checkbox-item:has(input:checked) {
    background: rgba(164, 119, 100, 0.1) !important;
    border-color: var(--tcb-primary) !important;
    font-weight: 500 !important;
}

/* Checkbox más pequeño */
.tcb-checkbox-box {
    width: 16px !important;
    height: 16px !important;
    margin-right: 8px !important;
}

/* Scrollbar mejorado */
.tcb-checkbox-group::-webkit-scrollbar {
    width: 5px !important;
}

.tcb-checkbox-group::-webkit-scrollbar-track {
    background: rgba(164, 119, 100, 0.05) !important;
    border-radius: 3px !important;
}

.tcb-checkbox-group::-webkit-scrollbar-thumb {
    background: rgba(164, 119, 100, 0.3) !important;
    border-radius: 3px !important;
}

.tcb-checkbox-group::-webkit-scrollbar-thumb:hover {
    background: var(--tcb-primary) !important;
}

/* =========================================
   RESPONSIVE DESIGN OPTIMIZADO
   ========================================= */

/* Desktop grande - 3 columnas */
@media (min-width: 1200px) {
    .tcb-checkbox-group {
        grid-template-columns: repeat(3, 1fr) !important;
        max-height: 420px !important;
    }
}

/* Desktop - 2-3 columnas automático */
@media (min-width: 992px) and (max-width: 1199px) {
    .tcb-checkbox-group {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
        max-height: 400px !important;
    }
}

/* Tablet - 2 columnas */
@media (min-width: 768px) and (max-width: 991px) {
    .tcb-checkbox-group {
        grid-template-columns: repeat(2, 1fr) !important;
        max-height: 380px !important;
    }
}

/* Mobile landscape - 2 columnas */
@media (min-width: 576px) and (max-width: 767px) {
    .tcb-checkbox-group {
        grid-template-columns: repeat(2, 1fr) !important;
        max-height: 350px !important;
        gap: 5px !important;
    }
    
    .tcb-checkbox-item {
        font-size: 12px !important;
        padding: 6px 8px !important;
    }
}

/* Mobile portrait - 1 columna */
@media (max-width: 575px) {
    .tcb-checkbox-group {
        grid-template-columns: 1fr !important;
        max-height: 320px !important;
        gap: 4px !important;
        padding: 8px !important;
    }
    
    .tcb-checkbox-item {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }
    
    .tcb-checkbox-box {
        width: 18px !important;
        height: 18px !important;
    }
}

/* =========================================
   AGRUPACIÓN VISUAL (OPCIONAL)
   ========================================= */

/* Si quieres agrupar visualmente las categorías */
.tcb-checkbox-item[value^="anxiety"],
.tcb-checkbox-item[value^="depression"],
.tcb-checkbox-item[value^="stress"],
.tcb-checkbox-item[value^="self"],
.tcb-checkbox-item[value^="anger"] {
    border-left: 3px solid #8B9D77 !important;
}

.tcb-checkbox-item[value^="relation"],
.tcb-checkbox-item[value^="family"],
.tcb-checkbox-item[value^="work"] {
    border-left: 3px solid #A47764 !important;
}

.tcb-checkbox-item[value^="trauma"],
.tcb-checkbox-item[value^="abuse"],
.tcb-checkbox-item[value^="domestic"],
.tcb-checkbox-item[value^="sexual"],
.tcb-checkbox-item[value^="childhood"] {
    border-left: 3px solid #5C3D33 !important;
}

/* =========================================
   ACCESIBILIDAD Y USABILIDAD
   ========================================= */

/* Focus visible para teclado */
.tcb-checkbox-item:focus-within {
    outline: 2px solid var(--tcb-primary) !important;
    outline-offset: 2px !important;
}

/* Touch-friendly en móviles */
@media (pointer: coarse) {
    .tcb-checkbox-item {
        min-height: 44px !important;
        padding: 10px 12px !important;
    }
}

/* Contador de selecciones (JavaScript necesario) */
.tcb-selection-counter {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--tcb-text);
    opacity: 0.8;
}

/* Botón "Clear all" (si lo agregas) */
.tcb-clear-all {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--tcb-primary);
    border: 1px solid var(--tcb-primary);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.tcb-clear-all:hover {
    background: var(--tcb-primary);
    color: white;
}