/**
 * Research Focus Heatmap Styles
 * Styles for the research focus evolution visualization page
 */

.research-focus-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.research-focus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content {
    flex: 1;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.edit-filters-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color, #3498db);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.edit-filters-btn:hover {
    background: var(--primary-hover, #2980b9);
    transform: translateY(-1px);
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
}

.toggle-info-btn {
    padding: 0.5rem 1rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.toggle-info-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.info-section {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease-out;
}

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

.heatmap-description {
    margin: 0;
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Filter Modal Styles */
.filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    /* Remove backdrop-filter blur to avoid seeing heatmap behind modal */
}

.filter-modal-content {
    position: relative;
    background: var(--card-background, #ffffff);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
    /* Ensure modal is fully opaque */
    opacity: 1;
}

/* Dark theme specific modal background */
[data-theme="dark"] .filter-modal-content {
    background: #1f2937;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.filter-modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.filter-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.filter-modal-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

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

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-help {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 1rem 0;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-group input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.filter-group input:focus {
    outline: none;
    border-color: var(--primary-color, #3498db);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.topic-selection-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--background);
}

.topic-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.topic-checkbox:hover {
    background: var(--border-color);
}

.topic-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.topic-count {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.filter-modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--background);
}

.btn-primary,
.btn-secondary {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-color, #3498db);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover, #2980b9);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
}


.legend-color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
}

.heatmap-viz-container {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    min-height: 500px;
    margin-bottom: 2rem;
}

/* Color Intensity Legend */
.color-intensity-legend {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

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

.legend-items {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.legend-color-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

#heatmap {
    width: 100%;
    min-height: 500px;
}

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

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

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

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

.back-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1rem 0;
}

.back-links a {
    padding: 0.5rem 1rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
}

.back-links a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .research-focus-container {
        padding: 1rem;
    }

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

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .edit-filters-btn,
    .toggle-info-btn {
        flex: 1;
        justify-content: center;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-subtitle {
        font-size: 0.9rem;
    }

    .heatmap-viz-container {
        padding: 1rem;
    }

    .color-intensity-legend {
        flex-direction: column;
        align-items: flex-start;
    }

    .legend-items {
        width: 100%;
        justify-content: space-between;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .back-links {
        flex-direction: column;
    }

    .back-links a {
        width: 100%;
        text-align: center;
    }

    /* Modal responsive styles */
    .filter-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .topic-selection-grid {
        grid-template-columns: 1fr;
    }

    .filter-modal-footer {
        flex-direction: column-reverse;
    }

    .filter-modal-footer button {
        width: 100%;
    }
}
