/**
 * Nombre: faq-mejorado.css
 * Proposito: Estilos para sistema de FAQ mejorado con tabs, busqueda y ordenamiento
 * Fecha: 2025-10-23
 */

/* ========================================
   CONTENEDOR PRINCIPAL FAQ
   ======================================== */
.faq-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    position: relative;
    overflow: hidden;
}

.faq-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
    opacity: 0.3;
    pointer-events: none;
    z-index: 0;
}

.faq-section .section-container {
    position: relative;
    z-index: 10;
}

.faq-section .section-title,
.faq-section .section-subtitle {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   CONTROLES SUPERIORES (Busqueda + Ordenamiento)
   ======================================== */
.faq-controles-superiores {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

/* Busqueda */
.faq-busqueda-wrapper {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.faq-busqueda-input {
    width: 100%;
    padding: 14px 50px 14px 50px;
    border: 2px solid #e8ecf1;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.faq-busqueda-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.faq-busqueda-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 18px;
    pointer-events: none;
}

.faq-busqueda-clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #95a5a6;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    display: none;
    transition: color 0.3s ease;
}

.faq-busqueda-clear:hover {
    color: #e74c3c;
}

.faq-busqueda-clear.visible {
    display: block;
}

/* Ordenamiento */
.faq-ordenamiento-wrapper {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%);
    border-radius: 12px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
    min-width: 250px;
}

.faq-ordenamiento-wrapper:hover {
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.15);
}

.faq-ordenamiento-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.faq-ordenamiento-icon i {
    font-size: 18px;
    color: #fff;
}

.faq-ordenamiento-select {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23667eea"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 18px;
    padding-right: 25px;
}

/* ========================================
   TABS DE CATEGORIAS
   ======================================== */
.faq-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.faq-tab {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #7f8c8d;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.faq-tab:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.faq-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.faq-tab i {
    font-size: 16px;
}

/* ========================================
   CONTADOR DE RESULTADOS
   ======================================== */
.faq-contador {
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 10px;
    margin: 15px 0;
    text-align: center;
    font-size: 14px;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 10;
}

.faq-contador i {
    margin-right: 8px;
}

/* ========================================
   CONTENEDOR DE PREGUNTAS
   ======================================== */
.faq-contenedor-dinamico {
    position: relative;
    z-index: 10;
    margin: 20px 0;
}

.faq-item-dinamico {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    z-index: 10;
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.faq-item-dinamico:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.faq-pregunta-btn {
    width: 100%;
    background: transparent;
    border: none;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.faq-pregunta-btn:hover {
    background: rgba(102, 126, 234, 0.05);
}

.faq-pregunta-texto {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
    padding-right: 20px;
    position: relative;
    z-index: 1;
}

.faq-toggle-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.faq-item-dinamico.active .faq-toggle-icon {
    transform: rotate(45deg);
}

.faq-respuesta-contenedor {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    position: relative;
    z-index: 1;
}

.faq-item-dinamico.active .faq-respuesta-contenedor {
    max-height: 500px;
}

.faq-respuesta-texto {
    padding: 0 24px 24px 24px;
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 20px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.faq-categoria-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.faq-categoria-badge.acceso {
    background: rgba(46, 204, 113, 0.2);
    color: #27ae60;
}

.faq-categoria-badge.documentos {
    background: rgba(52, 152, 219, 0.2);
    color: #2980b9;
}

.faq-categoria-badge.funciones {
    background: rgba(155, 89, 182, 0.2);
    color: #8e44ad;
}

.faq-categoria-badge.tecnico {
    background: rgba(231, 76, 60, 0.2);
    color: #c0392b;
}

/* ========================================
   MENSAJE SIN RESULTADOS
   ======================================== */
.faq-sin-resultados {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin: 20px 0;
    display: none;
    position: relative;
    z-index: 10;
}

.faq-sin-resultados.visible {
    display: block;
}

.faq-sin-resultados i {
    font-size: 64px;
    color: #667eea;
    margin-bottom: 20px;
    opacity: 0.5;
}

.faq-sin-resultados h3 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 10px;
}

.faq-sin-resultados p {
    color: #7f8c8d;
    font-size: 16px;
}

/* ========================================
   BOTON EXPANDIR/COLAPSAR
   ======================================== */
.faq-expandir-container {
    text-align: center;
    margin: 30px 0;
    position: relative;
    z-index: 10;
}

.faq-btn-expandir {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 10;
}

.faq-btn-expandir:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.faq-btn-expandir:active {
    transform: translateY(0);
}

.faq-btn-expandir i {
    font-size: 16px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .faq-controles-superiores {
        flex-direction: column;
        padding: 16px;
    }
    
    .faq-busqueda-wrapper,
    .faq-ordenamiento-wrapper {
        min-width: 100%;
    }
    
    .faq-tabs {
        flex-direction: column;
    }
    
    .faq-tab {
        min-width: 100%;
    }
    
    .faq-pregunta-btn {
        padding: 16px;
    }
    
    .faq-pregunta-texto {
        font-size: 14px;
    }
    
    .faq-respuesta-texto {
        padding: 0 16px 16px 16px;
        font-size: 14px;
    }
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.faq-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin: 20px 0;
    position: relative;
    z-index: 10;
}

.faq-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.faq-loading p {
    margin-top: 15px;
    color: #667eea;
    font-weight: 600;
}

/* ========================================
   HIGHLIGHT DE BUSQUEDA
   ======================================== */
.faq-highlight {
    background: linear-gradient(135deg, #fff59d 0%, #ffeb3b 100%);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
}
