/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.status-notice {
    background: rgba(72, 187, 120, 0.2);
    border: 1px solid rgba(72, 187, 120, 0.4);
    border-radius: 5px;
    padding: 10px 20px;
    margin-top: 20px;
    font-size: 14px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    color: #48bb78;
}

/* Search Section */
.search-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#searchInput {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #48bb78;
    color: white;
}

.btn-secondary:hover {
    background: #38a169;
}

.btn-secondary:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Filters */
.filters {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.filter-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: white;
}

.filter-group input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background: white;
}

.filter-group span {
    margin: 0 10px;
    color: #718096;
}

/* Sources */
.sources-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.sources-controls {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-small:hover {
    background: #f7fafc;
    border-color: #667eea;
    color: #667eea;
}

.sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.sources-grid::-webkit-scrollbar {
    width: 8px;
}

.sources-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.sources-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.sources-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.source-item {
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 5px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.source-item:hover {
    background: #edf2f7;
}

.source-item.active {
    background: #e6fffa;
    color: #319795;
}

.source-item input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.source-category {
    margin-bottom: 20px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    padding: 5px 10px;
    background: #f7fafc;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

/* Results */
.results-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.results-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

#resultsCount {
    font-weight: 500;
    color: #718096;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

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

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    margin: 20px auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    font-size: 14px;
    color: #718096;
    margin-top: 10px;
}

/* Results Grid */
.results-grid {
    display: grid;
    gap: 20px;
}

.result-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
    background: #fafafa;
}

.result-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.result-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 5px;
}

.result-source {
    font-size: 14px;
    color: #718096;
    margin-bottom: 5px;
}

.result-id {
    font-size: 12px;
    color: #a0aec0;
    font-family: monospace;
    margin-bottom: 10px;
}

.result-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background: #edf2f7;
    color: #4a5568;
}

.result-type.pdf { background: #fef3c7; color: #92400e; }
.result-type.docx { background: #dbeafe; color: #1e40af; }
.result-type.web { background: #e0e7ff; color: #4338ca; }

.result-content {
    margin: 15px 0;
}

.result-excerpt {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 10px;
    padding: 10px;
    background: #f7fafc;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.result-keyword {
    display: inline-block;
    background: #f0e6ff;
    color: #6b46c1;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 13px;
    margin-right: 5px;
}

.result-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #718096;
    margin-top: 10px;
}

.result-date {
    display: flex;
    align-items: center;
    gap: 5px;
}

.result-link-preview {
    font-size: 12px;
    color: #a0aec0;
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
    display: inline-block;
}

.result-link {
    display: inline-block;
    margin-top: 15px;
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.result-link:hover {
    color: #5a67d8;
    text-decoration: underline;
}

.result-notice {
    font-size: 12px;
    color: #f56565;
    font-style: italic;
    margin-top: 5px;
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Estilos para relevância dos resultados */
.result-relevance {
    margin-top: 5px;
}

.relevance-score {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.relevance-score.high-relevance {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.relevance-score.medium-relevance {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.relevance-score.low-relevance {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Estilos para cards por relevância */
.result-card.high-relevance {
    border-left: 4px solid #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.result-card.medium-relevance {
    border-left: 4px solid #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.result-card.low-relevance {
    border-left: 4px solid #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.result-link.google-search {
    background: #4285f4;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.result-link.google-search:hover {
    background: #357ae8;
    transform: translateY(-1px);
    text-decoration: none;
}

.copy-btn {
    background: #718096;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.copy-btn:hover {
    background: #4a5568;
    transform: translateY(-1px);
}

.download-btn {
    background: #ed8936;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.download-btn:hover {
    background: #dd6b20;
    transform: translateY(-1px);
}

.search-tip {
    font-size: 13px;
    color: #718096;
    margin-top: 15px;
    padding: 10px;
    background: #f7fafc;
    border-radius: 5px;
    border-left: 3px solid #4299e1;
}

/* Paginação */
.pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-numbers {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-ellipsis {
    color: #718096;
    font-weight: bold;
    padding: 0 5px;
}

.pagination button {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.current-page {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border-radius: 5px;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.page-info {
    text-align: center;
    color: #718096;
    font-size: 14px;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.page-jump span {
    color: #4a5568;
    font-weight: 500;
}

.page-input {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    width: 80px;
    text-align: center;
}

.page-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.pagination .page-numbers {
    display: flex;
    gap: 5px;
}

.pagination .page-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.pagination .page-number:hover {
    background: #f7fafc;
}

.pagination .page-number.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination .page-info {
    font-size: 14px;
    color: #718096;
}

/* Responsividade */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sources-grid {
        grid-template-columns: 1fr;
    }
}
