/* ===== PÁGINA DE BÚSQUEDA PREDICTIVA ===== */

.search-header {
    background: #00364b;
    padding: 16px 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.search-header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.search-back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-3px);
}

.search-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

/* ===== HERO DE BÚSQUEDA ===== */
.search-hero {
    background: linear-gradient(135deg, #10b981 0%, #00364b 100%);
    padding: 40px 5% 50px;
}

.search-hero-content {
    max-width: 1200px;
    margin: 0 auto;
}

.search-box-wrapper {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 50px;
    padding: 4px 4px 4px 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: box-shadow 0.3s ease;
}

.search-box:focus-within {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}

.search-box-icon {
    color: #999;
    font-size: 1.1rem;
}

.search-input {
    flex: 1;
    border: none;
    padding: 16px 16px;
    font-size: 1.1rem;
    font-weight: 500;
    outline: none;
    background: transparent;
    color: #1f1f1f;
    min-width: 0;
}

.search-input::placeholder {
    color: #aaa;
    font-weight: 400;
}

.search-clear-btn {
    display: none;
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-clear-btn.visible {
    display: block;
}

.search-clear-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.08);
}

/* ===== SUGERENCIAS ===== */
.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    z-index: 50;
}

.search-suggestions.active {
    display: block;
}

.search-suggestions::-webkit-scrollbar {
    width: 6px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: #10b981;
    border-radius: 3px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: #1f1f1f;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f8f9fa;
}

.suggestion-item .suggestion-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 32px;
    text-align: center;
}

.suggestion-item .suggestion-text {
    flex: 1;
}

.suggestion-item .suggestion-text strong {
    color: #00364b;
}

.suggestion-item .suggestion-text .suggestion-sub {
    display: block;
    font-size: 0.8rem;
    color: #888;
    font-weight: 400;
}

.suggestion-item .suggestion-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 12px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== STATS Y FILTROS ===== */
.search-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

#search-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 500;
}

.search-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 24px;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: "Quicksand", sans-serif;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: #fff;
    color: #00364b;
    border-color: #fff;
}

.filter-btn-reset {
    border-color: rgba(231, 76, 60, 0.4);
    background: rgba(231, 76, 60, 0.15);
}

.filter-btn-reset:hover {
    background: rgba(231, 76, 60, 0.25);
    border-color: rgba(231, 76, 60, 0.6);
}

/* ===== RESULTADOS ===== */
.search-results {
    padding: 40px 5% 60px;
    background: #f8f9fa;
    min-height: 400px;
}

.search-results-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

/* Estado de carga */
.loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: #888;
}

.loading-state .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(16, 185, 129, 0.15);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Estado vacío */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #00364b;
    margin-bottom: 8px;
}

.empty-state p {
    color: #888;
    font-size: 1rem;
}

/* ===== ANIMACIONES ===== */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .search-header-content {
        flex-wrap: wrap;
        gap: 12px;
    }

    .search-title {
        font-size: 1.2rem;
        flex-basis: 100%;
        order: 2;
    }

    .search-back-link {
        font-size: 0.85rem;
        padding: 6px 14px;
        order: 1;
    }

    .search-hero {
        padding: 30px 4% 35px;
    }

    .search-box {
        padding: 2px 2px 2px 16px;
    }

    .search-input {
        padding: 14px 12px;
        font-size: 1rem;
    }

    .search-stats {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-filters {
        justify-content: center;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 6px 14px;
    }

    .search-results-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .search-suggestions {
        max-height: 250px;
    }

    .suggestion-item {
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .search-results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 12px 10px;
    }

    .search-title {
        font-size: 1rem;
    }

    .search-stats #search-count {
        font-size: 0.85rem;
        text-align: center;
    }
}

/* ===== HIGHLIGHT EN BÚSQUEDA ===== */
.highlight {
    background: #fde047;
    color: #00364b;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

/* ===== CARD EN BÚSQUEDA ===== */
.search-results-grid .card {
    animation: fadeUp 0.4s ease both;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.search-results-grid .card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
}

.search-results-grid .card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #f0f0f0;
}

.search-results-grid .card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.search-results-grid .card:hover .card-img {
    transform: scale(1.05);
}

.search-results-grid .card-body {
    padding: 1.2rem;
}

.search-results-grid .card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #00364b;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.search-results-grid .card-text {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== ESTADO DE CARGA EN BÚSQUEDA ===== */
.search-results-grid .loading-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: #888;
}

.search-results-grid .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(16, 185, 129, 0.15);
    border-top-color: #10b981;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}