/* Estilos para o sistema de busca avançada */

#advanced-search-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#advanced-search-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.search-input-group,
.search-category-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-input-group label,
.search-category-group label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#search-keyword,
#search-category {
    padding: 12px 16px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #ffffff;
}

#search-keyword:focus,
#search-category:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Botão de busca sem estilos específicos para herdar do tema */
#search-submit {
    align-self: flex-start;
    cursor: pointer;
    transition: all 0.3s ease;
}

#search-submit:hover {
    transform: translateY(-1px);
}

#search-loading {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #6c757d;
    font-style: italic;
}

#search-results,
#search-results-container #search-results {
    margin-top: 20px;
}

.search-result-item {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.search-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #007bff;
}

.search-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.search-result-title {
    font-size: 20px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 15px;
    line-height: 1.3;
}

.search-result-title a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.search-result-title a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.search-contexts {
    margin-top: 15px;
}

.search-context-item {
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    padding: 15px 20px;
    margin-bottom: 15px;
    border-radius: 0 6px 6px 0;
    line-height: 1.6;
    font-size: 15px;
    color: #495057;
    position: relative;
}

.context-text {
    white-space: pre-line; /* Preserva quebras de linha */
    word-wrap: break-word;
    line-height: 1.6;
}

.search-context-item::before {
    content: '"';
    position: absolute;
    top: 10px;
    left: 8px;
    font-size: 20px;
    color: #007bff;
    font-weight: bold;
}

.search-context-item::after {
    content: '"';
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 20px;
    color: #007bff;
    font-weight: bold;
}

/* Destaque da palavra-chave - apenas fundo amarelo forte e negrito */
.search-highlight {
    background: #ffeb3b;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 3px;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 18px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.results-count {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #d4edda;
    color: #155724;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid #c3e6cb;
}

/* Estilos específicos para a página de resultados */
.search-results-page {
    padding: 20px 0;
}

.search-results-page h1 {
    margin-bottom: 30px;
    color: #212529;
    font-size: 28px;
    font-weight: 700;
}

.no-search-params {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.no-search-params p {
    margin-bottom: 15px;
    color: #6c757d;
    font-size: 16px;
}

.no-search-params a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

.no-search-params a:hover {
    text-decoration: underline;
}

/* Sidebar na página de resultados */
.sidebar {
    padding: 20px 0;
}

.sidebar .widget {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 20px;
}

.sidebar .widget h3 {
    margin-bottom: 15px;
    color: #212529;
    font-size: 18px;
    font-weight: 600;
}

/* Formulário na sidebar - usar padrão do tema */
.sidebar #advanced-search-form {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.sidebar .search-input-group,
.sidebar .search-category-group {
    margin-bottom: 15px;
}

.sidebar .search-input-group label,
.sidebar .search-category-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.sidebar .search-input-group input,
.sidebar .search-category-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
    min-width: 0; /* Permite que o elemento encolha */
}

/* Estilo específico para o select (dropdown) */
.sidebar .search-category-group select {
    padding-right: 30px; /* Espaço para a seta */
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    appearance: none; /* Remove a seta padrão do navegador */
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Garantir que o texto não seja cortado */
.sidebar .search-category-group {
    margin-bottom: 15px;
    min-width: 0; /* Permite que o container encolha */
}

.sidebar .search-category-group select option {
    padding: 5px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .search-input-group input:focus,
.sidebar .search-category-group select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.25);
}

/* Botão de busca na sidebar - herdar do tema */
.sidebar #search-submit {
    margin-top: 10px;
}

/* Link para ler post completo */
.context-link {
    margin-top: 10px;
    text-align: right;
}

.read-more-link {
    color: #007cba;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.read-more-link:hover {
    color: #005a87;
    text-decoration: underline;
}

/* Responsividade */
@media (max-width: 768px) {
    #advanced-search-container {
        margin: 10px;
        padding: 15px;
    }
    
    #advanced-search-form {
        padding: 15px;
    }
    
    .search-result-item {
        padding: 20px;
    }
    
    .search-result-title {
        font-size: 18px;
    }
    
    .search-context-item {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .search-results-page h1 {
        font-size: 24px;
    }
}

/* Animações de entrada */
.search-result-item {
    animation: slideInUp 0.5s ease-out;
}

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

/* Loading spinner */
#search-loading {
    position: relative;
}

#search-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

