/* WOO-besluit Search UI Styles */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --background: #f8fafc;
    --surface: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 2rem 1rem;
    box-shadow: var(--shadow-md);
}

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

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Section */
.search-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1.125rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: var(--text-muted);
}

.quick-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat strong {
    color: var(--primary-color);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Filters Sidebar */
.filters {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.filter-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 0.2s;
}

.filter-checkbox:hover {
    color: var(--primary-color);
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.filter-checkbox span {
    font-size: 0.9rem;
}

.filter-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: auto;
}

.date-range {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.date-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

.clear-filters {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters:hover {
    background-color: #b91c1c;
}

/* Results */
.results {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.125rem;
    font-weight: 600;
}

.results-count span {
    color: var(--primary-color);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sort-btn {
    padding: 0.5rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.sort-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.sort-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Results Container */
#resultsContainer {
    padding: 1.5rem;
    min-height: 400px;
}

/* Result Card */
.result-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.result-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.result-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-ministry {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-type {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.badge-redaction {
    background-color: #fee2e2;
    color: #991b1b;
}

.result-excerpt {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.result-excerpt mark {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
}

/* Pagination */
#paginationContainer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.page-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--surface);
    margin: 2rem auto;
    border-radius: var(--radius);
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close {
    color: var(--text-muted);
    font-size: 2rem;
    font-weight: 400;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.publication-detail {
    line-height: 1.8;
}

.publication-detail h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.publication-detail p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.detail-meta {
    background-color: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.detail-meta-item {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.detail-meta-label {
    font-weight: 600;
    min-width: 150px;
    color: var(--text-primary);
}

.detail-meta-value {
    color: var(--text-secondary);
}

.redaction-box {
    background-color: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1rem 0;
}

.redaction-box h4 {
    color: #991b1b;
    margin-bottom: 0.5rem;
}

/* Statistics Tab */
.stats-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.stats-content h2 {
    font-size: 1.75rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-card-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stats-section {
    margin-bottom: 2rem;
}

.stats-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.chart-container {
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-label {
    min-width: 200px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chart-bar-fill {
    flex: 1;
    height: 24px;
    background-color: var(--primary-color);
    border-radius: 4px;
    margin: 0 1rem;
    position: relative;
}

.chart-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 60px;
    text-align: right;
}

/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 1rem;
    }

    .container {
        padding: 1rem;
    }

    .search-section {
        padding: 1rem;
    }

    .search-input {
        font-size: 1rem;
        padding: 0.75rem 2.5rem 0.75rem 1rem;
    }

    .quick-stats {
        gap: 1rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }

    .chart-label {
        min-width: 150px;
        font-size: 0.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Search Mode Toggle */
.search-mode-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
}

.search-mode-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.search-mode-label:hover {
    background: white;
}

.search-mode-label input[type="radio"] {
    cursor: pointer;
}

.search-mode-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--primary-color);
}

.search-mode-label input[type="radio"]:checked {
    accent-color: var(--primary-color);
}

/* Document Link in Results */
.result-document-link {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: #e8f4f8;
    border-left: 3px solid var(--primary-color);
    border-radius: 0.25rem;
}

.result-document-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.result-document-link a:hover {
    text-decoration: underline;
}

/* Passage Info */
.result-passage-info {
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: #f0f9ff;
    border-left: 3px solid #3b82f6;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    color: #1e40af;
    font-weight: 500;
}

/* Responsive updates */
@media (max-width: 768px) {
    .search-mode-toggle {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-mode-label {
        justify-content: center;
    }
}
