/* ========================================
   SMART SEARCH — Página de búsqueda inteligente
   Glassmorphism + resultados inline
======================================== */

/* Contenedor principal de búsqueda */
.smart-search-hero {
    padding: 40px 0 20px;
    text-align: center;
}

.smart-search-hero .page-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    margin-bottom: 8px;
}

.smart-search-hero .page-subtitle {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

/* Input principal — hero-style */
.smart-search-box {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

.smart-search-input {
    width: 100%;
    padding: 22px 180px 22px 56px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(212, 175, 55, 0.2);
    border-radius: 60px;
    color: #fff;
    font-size: 1.15rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.smart-search-input::placeholder {
    color: #a1a1aa;
}

.smart-search-input:focus {
    border-color: rgba(212, 175, 55, 0.5);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(212, 175, 55, 0.08);
}

.smart-search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(212, 175, 55, 0.5);
    font-size: 1.1rem;
    pointer-events: none;
}

.smart-search-ai-btn {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: 6px;
    padding: 0 20px;
    background: linear-gradient(135deg, rgba(180, 150, 40, 0.25), rgba(212, 175, 55, 0.15));
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 50px;
    color: #D4AF37;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.smart-search-ai-btn:hover {
    background: rgba(212, 175, 55, 0.22);
    border-color: rgba(212, 175, 55, 0.5);
}

.smart-search-ai-btn i {
    font-size: 0.85rem;
}

/* ========================================
   PANEL FLOTANTE DE RESULTADOS INLINE
======================================== */
.smart-search-preview {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: rgba(12, 12, 12, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    z-index: 500;
    overflow: hidden;
    display: none;
    max-height: 480px;
    overflow-y: auto;
}

.smart-search-preview.active {
    display: block;
}

/* Scrollbar personalizado */
.smart-search-preview::-webkit-scrollbar {
    width: 5px;
}
.smart-search-preview::-webkit-scrollbar-track {
    background: transparent;
}
.smart-search-preview::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.2);
    border-radius: 10px;
}

/* Respuesta IA */
.sp-ia-response {
    padding: 16px 20px;
    background: rgba(212, 175, 55, 0.06);
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.sp-ia-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D4AF37;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sp-ia-text {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    flex: 1;
}

.sp-ia-label {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #D4AF37;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

/* Sección de categoría en preview */
.sp-section-label {
    padding: 8px 20px 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Item de resultado preview */
.sp-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sp-item:hover {
    background: rgba(212, 175, 55, 0.08);
    color: #fff;
}

.sp-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Colores por tipo */
.sp-item-icon.tipo-video     { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.sp-item-icon.tipo-pdf       { background: rgba(192, 57, 43, 0.15); color: #c0392b; }
.sp-item-icon.tipo-imagen    { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.sp-item-icon.tipo-documento { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.sp-item-icon.tipo-audio     { background: rgba(26, 188, 156, 0.15); color: #1abc9c; }
.sp-item-icon.tipo-wiki      { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.sp-item-icon.tipo-tecnica   { background: rgba(241, 196, 15, 0.15); color: #f1c40f; }
.sp-item-icon.tipo-termino   { background: rgba(149, 165, 166, 0.15); color: #95a5a6; }
.sp-item-icon.tipo-biblioteca { background: rgba(212, 175, 55, 0.15); color: #D4AF37; }

.sp-item-info {
    flex: 1;
    min-width: 0;
}

.sp-item-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sp-item-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 3px;
}

.sp-item-badge {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
}

.sp-item-badge.badge-categoria {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

.sp-item-badge.badge-tipo {
    background: rgba(59, 130, 246, 0.18);
    color: #93bbfd;
}

.sp-item-desc {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Footer del preview */
.sp-footer {
    padding: 10px 20px;
    text-align: center;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
}

.sp-footer a {
    font-size: 0.78rem;
    font-weight: 600;
    color: #D4AF37;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.2s;
}

.sp-footer a:hover {
    opacity: 0.8;
}

/* Loading */
.sp-loading {
    padding: 24px;
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
}

.sp-loading i {
    color: #D4AF37;
    margin-right: 8px;
}

/* Sin resultados */
.sp-empty {
    padding: 30px 20px;
    text-align: center;
    color: rgba(255,255,255,0.4);
}

.sp-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 10px;
    opacity: 0.3;
}

.sp-empty .sp-empty-hint {
    font-size: 0.78rem;
    margin-top: 8px;
    color: rgba(212, 175, 55, 0.5);
}

/* ========================================
   FILTROS — Chips horizontales
======================================== */
.smart-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 720px;
    margin: 20px auto 0;
}

.filter-chip {
    padding: 9px 18px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    text-transform: capitalize;
}

.filter-chip:hover {
    border-color: rgba(212, 175, 55, 0.35);
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.filter-chip:hover i { color: rgba(212, 175, 55, 0.8); }

.filter-chip.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: rgba(255, 215, 0, 0.45);
    color: #fff;
    font-weight: 600;
}

.filter-chip.active i { color: #D4AF37; }

.filter-chip i {
    margin-right: 5px;
    font-size: 0.72rem;
    transition: color 0.3s ease;
}

/* ========================================
   GRID DE RESULTADOS COMPLETOS
======================================== */
.smart-results-section {
    margin-top: 40px;
}

.smart-results-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
}

.smart-results-count {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.8rem;
    letter-spacing: 0.3px;
}

.smart-results-count strong {
    color: rgba(212, 175, 55, 0.75);
}

.smart-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tarjeta de resultado — glassmorphism premium */
.smart-result-card {
    background: rgba(20, 20, 20, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-bottom: 2px solid color-mix(in srgb, var(--cat-color, #D4AF37) 40%, transparent);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
}

.smart-result-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--cat-color, #D4AF37) 35%, transparent);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5),
                0 0 20px color-mix(in srgb, var(--cat-color, #D4AF37) 10%, transparent);
}

/* Micro-interacción: hover de tarjeta → borde del botón brilla */
.smart-result-card:hover .btn-outline-gold {
    border-color: rgba(212, 175, 55, 0.6);
    color: #FFD700;
}

.smart-result-card:hover .btn-outline-ficha {
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Zona de previsualización */
.src-preview {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(15, 15, 15, 0.6);
}

.src-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.src-preview-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
}

/* Colores de icono gigante por tipo */
.src-preview-icon.tipo-video { color: #e74c3c; }
.src-preview-icon.tipo-pdf { color: #c0392b; }
.src-preview-icon.tipo-imagen { color: #9b59b6; }
.src-preview-icon.tipo-documento { color: #3498db; }
.src-preview-icon.tipo-audio { color: #1abc9c; }
.src-preview-icon.tipo-wiki { color: #2ecc71; }
.src-preview-icon.tipo-tecnica { color: #f1c40f; }
.src-preview-icon.tipo-termino { color: #95a5a6; }
.src-preview-icon.tipo-biblioteca { color: #D4AF37; }

.smart-result-card a {
    text-decoration: none;
    color: inherit;
}

.src-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: rgba(25, 25, 25, 0.85);
    background-image: linear-gradient(
        to top,
        color-mix(in srgb, var(--cat-color, #D4AF37) 8%, transparent),
        transparent
    );
}

.src-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.src-type-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Badge de fuente — cristal esmerilado premium con glow dorado */
.src-fuente-badge {
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    background: rgba(10, 10, 10, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.3);
    color: #FFD700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.src-fuente-badge.fb-documento { color: #93bbfd; text-shadow: 0 0 8px rgba(147, 187, 253, 0.4); }
.src-fuente-badge.fb-biblioteca { color: #FFD700; text-shadow: 0 0 8px rgba(255, 215, 0, 0.4); }
.src-fuente-badge.fb-wiki { color: #6ee7b7; text-shadow: 0 0 8px rgba(110, 231, 183, 0.4); }
.src-fuente-badge.fb-tecnica { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }
.src-fuente-badge.fb-termino { color: #e4e4e7; text-shadow: 0 0 8px rgba(228, 228, 231, 0.3); }

.src-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.src-desc {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
}

.src-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.src-tag {
    font-size: 0.72rem;
    padding: 4px 12px;
    border-radius: 9999px;
    background: rgba(212, 175, 55, 0.1);
    color: rgba(212, 175, 55, 0.7);
    font-weight: 500;
    border: 1px solid rgba(212, 175, 55, 0.08);
}

.src-footer {
    padding: 12px 20px;
    border-top: 1px solid color-mix(in srgb, var(--cat-color, #D4AF37) 10%, transparent);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.src-category {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.35);
}

.src-category i {
    color: var(--cat-color, #D4AF37);
    margin-right: 4px;
}

/* Botón "Ver" — Bootstrap btn extendido con variante dorada */
.btn-outline-gold {
    font-size: 0.72rem;
    font-weight: 600;
    color: #D4AF37;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 16px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 50px;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-outline-gold:hover,
.btn-outline-gold:focus {
    background: #D4AF37;
    color: #111;
    border-color: #D4AF37;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
    transform: translateY(-1px);
}

.btn-outline-gold i {
    font-size: 0.62rem;
    transition: transform 0.3s ease;
}

.btn-outline-gold:hover i {
    transform: translateX(2px);
}

/* Botón "Ficha" — variante secundaria outline blanco */
.btn-outline-ficha {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    background: transparent;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-outline-ficha:hover,
.btn-outline-ficha:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.src-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ========================================
   RESPUESTA IA — Panel completo
======================================== */
.smart-ia-panel {
    background: rgba(212, 175, 55, 0.04);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    display: none;
}

.smart-ia-panel.active {
    display: block;
}

.smart-ia-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.smart-ia-header i {
    color: #D4AF37;
    font-size: 1.2rem;
}

.smart-ia-header span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #D4AF37;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.smart-ia-body {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.7;
}

/* ========================================
   PAGINACIÓN
======================================== */
.smart-pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    padding-bottom: 40px;
}

.smart-pagination button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.smart-pagination button:hover {
    border-color: rgba(212, 175, 55, 0.3);
    color: #fff;
}

.smart-pagination button.active {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.4);
    color: #D4AF37;
    font-weight: 600;
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 768px) {
    .smart-search-hero .page-title {
        font-size: 1.8rem;
    }

    .smart-search-input {
        padding: 16px 70px 16px 44px;
        font-size: 1.05rem;
    }

    .src-preview {
        aspect-ratio: 21 / 9;
    }

    .smart-search-ai-btn span {
        display: none;
    }

    .smart-results-grid {
        grid-template-columns: 1fr;
    }

    .smart-search-preview {
        max-height: 360px;
    }
}

@media (max-width: 480px) {
    .smart-filters {
        gap: 6px;
    }

    .filter-chip {
        padding: 5px 12px;
        font-size: 0.72rem;
    }

    .btn-outline-gold, .btn-outline-ficha {
        padding: 5px 10px;
        font-size: 0.68rem;
    }

    .src-footer-actions { gap: 6px; }
}
