/* Citizen Interface - DKG Green Palette */

:root {
    /* Palette DKG originale */
    --primary-color: #4a9d3c; /* Verde vines */
    --primary-light: #6abe5c;
    --primary-dark: #3a7d2c;
    --secondary-color: #0f172a; /* Deep teal accent */
    --secondary-light: #1f354a;
    --secondary-dark: #0b1626;
    --accent-color: #ffd700; /* Oro Daft Punk */
    --accent-light: #ffe44d;
    --accent-dark: #ccac00;
    --light-color: #f8fafc;
    --dark-color: #0f172a;
    --text-color: #334155;
    --text-light: #64748b;
    --text-primary: #334155;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-dark: #f1f5f9;
    --bg-secondary: #ffffff;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Search Section */
.search-section {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    padding: 4rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    box-shadow: 0 2px 4px rgba(74, 157, 60, 0.15);
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(74, 157, 60, 0.15);
}

.search-icon {
    color: var(--primary-color);
    font-size: 1.25rem;
}

#searchInput {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.05rem;
    padding: 0.25rem;
    font-family: var(--font-body);
    color: var(--text-color);
}

#searchInput::placeholder {
    color: var(--text-light);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 157, 60, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 0.5rem;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-1px);
}

/* Search Options */
.search-options {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding: 1rem 0;
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.search-options label:hover {
    color: var(--primary-color);
}

.search-options input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.search-options select {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

.search-options select:hover {
    border-color: var(--primary-color);
}

/* Autocomplete */
.autocomplete-results {
    position: relative;
    background: white;
    border: 1px solid var(--primary-light);
    border-radius: 10px;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.autocomplete-results.show {
    display: block;
}

.autocomplete-item {
    padding: 0.875rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

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

.autocomplete-item:hover {
    background: var(--primary-color);
    color: white;
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2.5rem;
}

.stat-card {
    background: white;
    border: 2px solid var(--primary-color);
    padding: 2rem 1.5rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 157, 60, 0.2);
    border-color: var(--primary-dark);
}

.stat-card .stat-number {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Results Section */
.results-section {
    min-height: 500px;
    padding: 3rem 0;
    background: #fafbfc;
}

.search-results {
    display: grid;
    gap: 1.25rem;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(74, 157, 60, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    border-left: 4px solid var(--primary-color);
    position: relative;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(74, 157, 60, 0.15);
    border-color: var(--primary-color);
}

.result-card .result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.result-card h3 {
    color: var(--secondary-color);
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
    flex: 1;
}

.result-card:hover h3 {
    color: var(--primary-dark);
}

.result-card .relevance-score {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: var(--dark-color);
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.result-card .result-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.result-card .result-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-card .result-meta i {
    color: var(--primary-color);
}

.result-card .description {
    color: var(--text-color);
    line-height: 1.7;
    margin-top: 0.875rem;
    font-size: 0.95rem;
}

/* Process Details */
.process-details {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 2px 4px rgba(74, 157, 60, 0.1);
    border: 2px solid var(--primary-color);
}

.process-details .back-button {
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.process-details .back-button:hover {
    background: var(--primary-color);
    color: white;
}

.process-details h2 {
    color: var(--secondary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.75rem;
    margin-bottom: 2rem;
    font-size: 1.75rem;
}

.process-details .section {
    margin-top: 2.5rem;
}

.process-details .section h3 {
    color: var(--secondary-color);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.25rem;
}

.process-details .section h3 i {
    color: var(--primary-color);
}

.contributions-grid,
.fallacies-grid,
.participants-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.contribution-card,
.fallacy-card,
.participant-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 1.25rem;
    border-left: 3px solid var(--primary-color);
    transition: all 0.2s;
}

.contribution-card:hover,
.fallacy-card:hover,
.participant-card:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(74, 157, 60, 0.1);
}

.fallacy-card {
    border-left-color: var(--error-color);
}

.participant-card {
    border-left-color: var(--success-color);
}

/* Download Section */
.download-section {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    padding: 4rem 0;
    margin-top: 3rem;
    text-align: center;
    border-top: 2px solid var(--primary-color);
}

.download-section h2 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.download-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.help-text {
    margin-top: 1.5rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 0.8s linear infinite;
}

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

/* Footer */
footer {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(34, 62, 40, 0.92) 55%, rgba(74, 157, 60, 0.9) 100%);
    color: white;
    padding: 2.5rem 0;
    text-align: center;
    margin-top: 0;
    box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.22);
}

footer p {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--accent-light);
}

/* Graph Visualization */
#graphViz {
    width: 100%;
    height: 500px;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    margin-top: 1rem;
    background: white;
}

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

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    color: var(--primary-color);
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .search-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

    .download-options {
        flex-direction: column;
        max-width: 300px;
        margin: 2rem auto 0;
    }

    .btn-secondary {
        width: 100%;
        margin: 0.25rem 0;
    }

    .result-card .result-header {
        flex-direction: column;
    }

    .result-card .relevance-score {
        align-self: flex-start;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: var(--primary-color);
    color: white;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-content {
    background-color: var(--bg-secondary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
}

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

.resource-property {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-dark);
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
}

.resource-property-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.resource-property-value {
    color: var(--text-primary);
    word-wrap: break-word;
}

.resource-uri-link {
    color: var(--accent-color);
    text-decoration: underline;
    cursor: pointer;
}

.resource-uri-link:hover {
    color: var(--primary-color);
}

.clickable-contribution {
    cursor: pointer;
    transition: background 0.3s ease;
}

.clickable-contribution:hover {
    background: var(--bg-dark);
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination-btn:hover {
    background: var(--primary-light);
    color: white;
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}

.pagination-ellipsis {
    padding: 0.5rem;
    color: var(--text-light);
}
