/**
 * Google Programmable Search Engine - Estilos personalizados
 * 
 * Estilos para mejorar la apariencia y UX del buscador de Google PSE
 * 
 * @package ABC
 * @since 1.0.0
 */

/* ==========================================================================
   Contenedor principal de búsqueda
   ========================================================================== */

.google-search-results-container {
    margin: 20px 0;
    min-height: 300px;
    font-family: "Theinhardt" !important;
}

/* ==========================================================================
   Información de búsqueda
   ========================================================================== */

.search-query-info {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.search-query-info h2 {
    color: #333;
    font-size: 1.5em;
    margin-bottom: 10px;
    font-weight: 400;
}

.search-term {
    color: #0076bc;
    font-weight: 600;
}

.search-stats {
    color: #666;
    font-size: 0.9em;
    margin-top: 5px;
}

.results-count {
    font-weight: 500;
}

/* ==========================================================================
   Indicador de carga
   ========================================================================== */

.search-loading {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0076bc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-loading p {
    color: #666;
    margin: 0;
    font-size: 1.1em;
}

/* ==========================================================================
   Mensaje de error
   ========================================================================== */

.search-error {
    text-align: center;
    padding: 30px 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    margin: 20px 0;
}

.search-error p {
    color: #856404;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.retry-search-btn {
    background: #0076bc;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.retry-search-btn:hover {
    background: #005a94;
}

/* ==========================================================================
   Resultados de Google PSE - Mejoras
   ========================================================================== */

.search-results-wrapper {
    margin-top: 20px;
}

/* Mejorar apariencia de resultados individuales */
.abc-search-result {
    margin-bottom: 25px !important;
    padding: 15px 0 !important;
    border-bottom: 1px solid #eee !important;
}

.abc-search-result:last-child {
    border-bottom: none !important;
}

/* Títulos de resultados */
.abc-result-title {
    font-size: 1.2em !important;
    line-height: 1.3 !important;
    margin-bottom: 8px !important;
}

.abc-result-title a {
    color: #1a0dab !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.abc-result-title a:hover {
    color: #0076bc !important;
    text-decoration: underline !important;
}

.abc-result-title a:visited {
    color: #609 !important;
}

/* Snippets de resultados */
.abc-result-snippet {
    color: #545454 !important;
    line-height: 1.4 !important;
    font-size: 0.95em !important;
}

/* Destacado de términos de búsqueda */
.search-highlight {
    background-color: #fff3cd;
    color: #856404;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* ==========================================================================
   Formulario de búsqueda
   ========================================================================== */

.custom-google-search .gsc-search-box {
    margin-bottom: 0 !important;
}

.custom-google-search .gsc-input-box {
    border: none !important;
    border-radius: 0px !important;
    overflow: hidden !important;
}

.custom-google-search .gsc-input {
    background: transparent !important;
    border: none !important;
    padding: 8px 20px !important;
    font-size: 16px !important;
    outline: none !important;
}

.custom-google-search input.gsc-input {
    height: 28px !important;
}

.custom-google-search button.gsc-search-button {
    background: #0076bc !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 20px !important;
    min-width: 80px !important;
    height: 36px;
}

.custom-google-search button.gsc-search-button:hover {
    background: #005a94 !important;
}

/* ==========================================================================
   Paginación
   ========================================================================== */

.gsc-cursor-box {
    margin: 30px 0 !important;
    text-align: center !important;
}

.gsc-cursor-page {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    color: #0076bc !important;
    padding: 8px 12px !important;
    margin: 0 3px !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.2s ease !important;
}

.gsc-cursor-page:hover {
    background: #0076bc !important;
    color: white !important;
    text-decoration: none !important;
}

.gsc-cursor-current-page {
    background: #0076bc !important;
    color: white !important;
    border-color: #0076bc !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .search-query-info h2 {
        font-size: 1.3em;
    }
    
    .search-loading {
        padding: 30px 15px;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
    }
    
    .abc-search-result {
        padding: 12px 0 !important;
    }
    
    .abc-result-title {
        font-size: 1.1em !important;
    }
    
    .abc-result-snippet {
        font-size: 0.9em !important;
    }
}

@media (max-width: 480px) {
    .search-query-info {
        margin-bottom: 15px;
    }
    
    .search-query-info h2 {
        font-size: 1.2em;
        line-height: 1.3;
    }
    
    .custom-google-search .gsc-input {
        font-size: 14px !important;
        padding: 10px 15px !important;
    }
}

/* ==========================================================================
   Estados de accesibilidad
   ========================================================================== */

.abc-search-result:focus-within {
    outline: 2px solid #0076bc;
    outline-offset: 2px;
    border-radius: 4px;
}

.retry-search-btn:focus {
    outline: 2px solid #0076bc;
    outline-offset: 2px;
}

/* Mejorar contraste para usuarios con problemas de visión */
@media (prefers-contrast: high) {
    .search-highlight {
        background-color: #000;
        color: #fff;
    }
    
    .abc-result-title a {
        color: #0000EE !important;
    }
    
    .abc-result-title a:visited {
        color: #551A8B !important;
    }
}

/* ==========================================================================
   Animaciones de entrada
   ========================================================================== */

.search-results-wrapper {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/** ==========================================================================
   Ajustes específicos para Google PSE
   ========================================================================== */
.gs-result .gs-title *, .gs-spelling a {
    color: #0076bc !important;
}

.gs-result .gs-image, .gs-result .gs-promotion-image {
    display: inline-block;
    padding-right: 6px;
    border: none !important;
}