/* Root Variables */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #f8f9fa;
    --accent-color: #0066cc;
    --text-color: #333;
    --border-color: #dee2e6;
    --hover-color: #e9ecef;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.logo-section h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.logo-section h2 {
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.9;
}

.nav-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.search-box {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    min-width: 200px;
    font-size: 0.9rem;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown select {
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    background-color: white;
    color: var(--text-color);
    font-size: 0.9rem;
    min-width: 150px;
}

.header-action-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    text-decoration: none;
}

.header-action-btn:hover {
    background-color: var(--primary-color);
}

.header-small-link {
    color: white;
    font-size: 0.85rem;
    text-decoration: underline;
}

/* Enhanced Filters Section */
.enhanced-filters {
    background-color: #f8f9fa;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid #dee2e6;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
    max-width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.25rem;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
    color: #495057;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-select:hover {
    border-color: #adb5bd;
}

.filter-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Enhanced Charts */
.charts-grid.extended {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    grid-template-rows: auto;
}

/* Proposal Cards */
.proposals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.proposal-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 0.75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.proposal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    border-color: var(--primary-color);
}

.proposal-header {
    margin-bottom: 1rem;
}

.proposal-id-badge {
    background: linear-gradient(45deg, #9c27b0, #7b1fa2);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.proposal-type-badge {
    background: #f3e5f5;
    color: #7b1fa2;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-left: 0.5rem;
    margin-bottom: 0.5rem;
}

.proposal-year {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.proposal-title {
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0.5rem 0;
}

.proposal-content {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.proposal-description {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-right: 3px solid var(--primary-color);
}

.proposal-details {
    margin-bottom: 1rem;
}

.proposal-detail {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.proposal-detail strong {
    color: var(--primary-color);
    font-weight: 600;
}

.proposal-author,
.proposal-institution,
.proposal-source,
.proposal-category {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

.proposal-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.proposal-details-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.proposal-details-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
}

/* Network Loading Progress */
.network-loading-progress {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin: 1rem;
}

.progress-bar {
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    height: 8px;
    margin: 1rem 0;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), #4caf50);
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Document Card Enhancement */
.document-proposal-count {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
    display: inline-block;
    text-align: right;
    direction: rtl;
}

/* Enhanced text handling for RTL languages */
.document-card * {
    unicode-bidi: plaintext;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better text wrapping for Hebrew/Arabic content */
.document-title,
.document-author,
.document-institution,
.document-main-category,
.document-secondary-category {
    word-break: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

/* Enhanced hover effects for clickable cards */
.document-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
}

.document-card:hover .document-title {
    color: var(--primary-color);
}

/* Chart error styling */
.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-size: 1rem;
    font-weight: 500;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .proposal-card {
        margin: 0.5rem;
        padding: 1rem;
        min-height: 250px;
    }
    
    .proposal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .proposal-details-btn {
        width: 100%;
        text-align: center;
    }
}

/* Network Analysis */
.network-container {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.network-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.network-stat {
    text-align: center;
    padding: 1rem;
    background: var(--secondary-color);
    border-radius: 6px;
}

.network-stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.network-stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Impact Visualization */
.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.impact-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.impact-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.impact-list {
    list-style: none;
    padding: 0;
}

.impact-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: var(--secondary-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.impact-count {
    float: left;
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Statistics Section - Updated for mobile compactness */
.statistics-section {
    background-color: var(--secondary-color);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-right: 4px solid var(--accent-color);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Dashboard Section */
.dashboard-section {
    padding: 3rem 0;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
    overflow-x: hidden;
}

/* Mobile-specific chart carousel styles */
.charts-carousel-container {
    position: relative;
    overflow: hidden;
    display: none; /* Hidden by default, shown on mobile */
}

.charts-carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    align-items: stretch;
    touch-action: pan-y pinch-zoom;
}

.chart-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(44, 90, 160, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 10;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-carousel-btn:hover {
    background: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.chart-carousel-btn:disabled {
    background: rgba(0,0,0,0.3);
    cursor: not-allowed;
    transform: translateY(-50%) scale(0.9);
}

.chart-carousel-btn.prev {
    left: 10px;
}

.chart-carousel-btn.next {
    right: 10px;
}

.chart-carousel-info {
    text-align: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.swipe-hint {
    display: none;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(108, 117, 125, 0.1);
    border-radius: 4px;
}

.chart-container {
    position: relative;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 1rem;
    padding-right: 2rem; /* Make room for clear filter button */
}

.chart-wrapper {
    position: relative; /* Added for positioning clear filter buttons */
    width: 100%;
    height: 300px; /* Default height, can be overridden */
    margin: 0 auto;
    cursor: pointer;
}

.chart-info-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(44, 90, 160, 0.9);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    display: none;
    z-index: 10;
}

/* Document Carousel */
.carousel-section {
    background-color: var(--secondary-color);
    padding: 3rem 0;
}

.carousel-container {
    position: relative;
    overflow: hidden;
    margin-top: 2rem;
    padding: 0;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.carousel-track {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    padding: 1rem;
    scroll-snap-type: x mandatory;
    justify-content: flex-start;
    align-items: flex-start;
}

.document-card {
    flex: 0 0 280px;
    min-width: 280px;
    max-width: 280px;
    width: 280px;
    height: auto;
    min-height: 350px;
    scroll-snap-align: start;
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.document-card:first-child {
    margin-right: 0;
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.document-card-header {
    flex: 0 0 auto;
}

.document-card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    overflow: visible;
    gap: 0.6rem;
    justify-content: space-evenly;
}

.document-card-footer {
    flex: 0 0 auto;
    margin-top: auto;
    text-align: center;
    direction: ltr;
    padding: 0.2rem 0.4rem 0.2rem;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.document-year {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    display: inline-block;
    margin-bottom: 0.5rem;
    float: right;
    clear: both;
}

.year-title-separator {
    border: none;
    height: 1px;
    background-color: #e0e0e0;
    margin: 0.4rem 0;
    clear: both;
}

.document-title {
    font-size: clamp(0.9rem, 4vw, 1.05rem);
    font-weight: bold;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: underline;
    line-height: 1.4;
    height: auto;
    max-height: 4.2em;
    text-align: right;
    direction: rtl;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.document-author {
    color: #666;
    font-size: clamp(0.85rem, 3.5vw, 0.9rem);
    margin-bottom: 0.6rem;
    line-height: 1.4;
    text-align: right;
    direction: rtl;
    height: auto;
    max-height: 2.8em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.document-institution {
    color: var(--accent-color);
    font-size: clamp(0.85rem, 3.5vw, 0.9rem);
    margin-bottom: 0.6rem;
    line-height: 1.4;
    text-align: right;
    direction: rtl;
    height: auto;
    max-height: 2.8em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.document-main-category,
.document-secondary-category {
    font-size: clamp(0.8rem, 3vw, 0.85rem);
    color: #777;
    margin-bottom: 0.5rem;
    text-align: right;
    direction: rtl;
    line-height: 1.4;
    height: auto;
    max-height: 2.8em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.document-secondary-category {
    color: #666;
}

.field-label {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.75rem;
}

.document-link {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 0.3rem 0.6rem;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: background-color 0.3s;
    margin-left: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.document-link:hover {
    background-color: var(--primary-color);
}

.carousel-controls {
    text-align: center;
    margin-top: 1.5rem;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
    transition: all 0.3s ease;
    z-index: 10;
}

.carousel-btn:hover {
    background-color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(44, 90, 160, 0.4);
}

.carousel-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: translateY(-50%);
    box-shadow: none;
}

.carousel-btn:disabled:hover {
    transform: translateY(-50%);
    background-color: #ccc;
    box-shadow: none;
}

.carousel-btn.prev {
    right: 10px;
}

.carousel-btn.next {
    left: 10px;
}

.carousel-info {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

footer a {
    color: #cce7ff;
    text-decoration: underline;
}

/* Loading Spinner Styles */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #1B5299;
    animation: spin 1s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-message {
    display: inline-block;
    vertical-align: middle;
}

.status-loading {
    color: #1B5299;
}

/* Network Status Styles */
.network-status {
    margin: 10px 0;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

.status-loading {
    background-color: #e3f2fd;
    border: 1px solid #1B5299;
}

.status-error {
    background-color: #ffebee;
    border: 1px solid #c62828;
    color: #c62828;
}

.status-success {
    background-color: #e8f5e9;
    border: 1px solid #2e7d32;
    color: #2e7d32;
}

.status-warning {
    background-color: #fff3e0;
    border: 1px solid #ef6c00;
    color: #ef6c00;
}

/* Detail Modal Styles */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    box-sizing: border-box;
}

.detail-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.detail-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

.close-btn {
    background: #666;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

.close-btn:hover {
    background: #555;
}

.documents-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.document-summary {
    background: var(--secondary-color);
    padding: 1rem;
    border-radius: 6px;
    border-right: 3px solid var(--accent-color);
}

.document-summary-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.document-summary-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.document-summary-link {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 0.3rem 0.8rem;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Network Graph Styles */
#proposalNetworkChart {
    background: #fafafa;
}

.network-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.network-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Network Map Section Styles */
.network-map-section {
    padding: 2rem 0;
    background-color: var(--secondary-color);
}

.network-controls {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.network-controls h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
}

.control-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.control-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
}

.generate-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.generate-btn:hover {
    background: var(--primary-color);
}

.network-map-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#networkMapVis {
    width: 100%;
    height: 70vh;
    min-height: 500px;
    border: none;
    position: relative;
}

.network-status {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.status-info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status-success {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.status-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.status-warning {
    background-color: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffcc02;
}

.network-instructions {
    background-color: #e3f2fd;
    border-right: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin-top: 1.5rem;
    border-radius: 4px;
}

.network-instructions h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.network-instructions ul {
    list-style-type: disc;
    margin-right: 1.5rem;
    line-height: 1.6;
}

.network-instructions li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.network-zoom-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.zoom-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.zoom-btn:hover {
    color: var(--accent-color);
}

/* Floating Return Home Button */
.return-home-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.return-home-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(44, 90, 160, 0.4);
}

.return-home-btn::before {
    content: "🏠";
    font-size: 16px;
}

/* Research Modal Styles */
.research-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}

.research-modal-content {
    background: white;
    padding: 0;
    border-radius: 16px;
    max-height: 95vh;
    overflow-y: auto;
    width: 100%;
    max-width: 1200px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    direction: rtl;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.research-modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 2rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.research-modal-title {
    font-size: 0.75rem;
    line-height: 1.1;
    margin: 0;
    padding-right: 2rem;
    font-weight: 600;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.research-close-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

.research-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.document-details-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.document-details-btn:hover {
    background: var(--primary-color);
}

/* Modal Section Styles */
.modal-section {
    margin-bottom: 2.5rem;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.modal-section-basic {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-right: 5px solid var(--accent-color);
}

.modal-section-subject {
    background: linear-gradient(145deg, #f1f8e9, #dcedc8);
    border-right: 5px solid #8bc34a;
}

.modal-section-problems {
    background: linear-gradient(145deg, #fff3e0, #ffe0b2);
    border-right: 5px solid #ff9800;
}

.modal-section-proposals {
    background: linear-gradient(145deg, #e8f5e8, #c8e6c9);
    border-right: 5px solid #4caf50;
}

.modal-section-vision {
    background: linear-gradient(145deg, #fff8e1, #ffecb3);
    border-right: 5px solid #ffc107;
}

.modal-section-specific {
    background: linear-gradient(145deg, #f3e5f5, #e1bee7);
    border-right: 5px solid #9c27b0;
}

.modal-section-summary {
    background: linear-gradient(145deg, #e3f2fd, #bbdefb);
    border-right: 5px solid #2196f3;
}

.modal-section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.modal-section-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-section-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    line-height: 1.7;
    font-size: 1rem;
    color: #444;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.modal-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.modal-info-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.modal-info-label {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-info-value {
    color: #444;
    font-size: 1rem;
    line-height: 1.4;
}

.modal-authors-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.modal-author-badge {
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(44, 90, 160, 0.3);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-controls label {
    font-size: 0.9rem;
    color: var(--text-color);
}

#sortOrder {
    min-width: 180px;
}

/* Last Updated Date */
#lastUpdatedDate {
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #555;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .nav-controls {
        justify-content: center;
    }

    .search-box {
        min-width: 150px;
    }

    /* Statistics Section - Compact mobile version */
    .statistics-section {
        padding: 0.75rem 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-top: 0.25rem;
    }
    
    .stat-card {
        padding: 0.5rem;
        border-radius: 4px;
        min-height: auto;
    }
    
    .stat-number {
        font-size: 1.25rem;
        margin-bottom: 0.15rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
        margin-top: 0.1rem;
        line-height: 1.2;
    }

    /* Document Carousel - Fixed centering with proper boundaries */
    .carousel-container {
        position: relative;
        overflow: hidden !important;
        padding: 0;
        margin: 2rem 0 0 0;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        /* Add subtle background to define carousel area */
        background: linear-gradient(90deg, rgba(248,249,250,0.5) 0%, rgba(248,249,250,0.8) 5%, rgba(248,249,250,0.8) 95%, rgba(248,249,250,0.5) 100%);
        border-radius: 8px;
    }
    
    .carousel-track {
        display: flex !important;
        flex-direction: row;
        gap: 2rem;
        padding: 1.5rem 1.5rem 1.5rem 2rem !important;
        scroll-snap-type: x mandatory;
        justify-content: flex-start;
        align-items: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Ensure proper scrolling without edge cropping */
        scroll-padding-left: 2rem;
        scroll-behavior: smooth;
        /* Show scrollbar briefly to indicate scrollability */
        scrollbar-width: thin;
        scrollbar-color: var(--primary-color) transparent;
    }
    
    /* Custom scrollbar for webkit browsers */
    .carousel-track::-webkit-scrollbar {
        height: 4px;
    }
    
    .carousel-track::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.1);
        border-radius: 2px;
    }
    
    .carousel-track::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    .document-card {
        flex: 0 0 75vw !important;
        min-width: 75vw !important;
        max-width: 75vw !important;
        width: 75vw !important;
        height: auto;
        min-height: 350px;
        scroll-snap-align: start;
        margin: 0;
        border-radius: 12px;
        overflow: hidden;
        background: #fff;
        box-shadow: 0 4px 16px rgba(0,0,0,0.15);
        border: 2px solid #e9ecef;
        display: flex;
        flex-direction: column;
        transition: all 0.3s ease;
        /* Use asymmetric padding - less on left to move text closer to edge */
        padding: 0.75rem 0.75rem 0.5rem 0.5rem;
    }
    
    /* Improve mobile text sizing within carousel cards */
    .document-card .document-title {
        font-size: 0.95rem !important;
        line-height: 1.3 !important;
        -webkit-line-clamp: 2 !important;
        max-height: 2.6em !important;
    }
    
    .document-card .document-author,
    .document-card .document-institution {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
        -webkit-line-clamp: 1 !important;
        max-height: 1.2em !important;
    }
    
    .document-card .document-main-category,
    .document-card .document-secondary-category {
        font-size: 0.8rem !important;
        line-height: 1.2 !important;
        -webkit-line-clamp: 1 !important;
        max-height: 1.2em !important;
    }

    .document-card:first-child {
        margin-right: 0;
        /* Increase right padding significantly for RTL text in first card */
        padding-right: 1rem !important;
    }
    
    /* Enhanced mobile card interaction */
    .document-card:hover,
    .document-card:active {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0,0,0,0.2);
        border-color: var(--primary-color);
    }
    
    /* Simplified mobile card styling */
    .document-card .document-card-footer {
        margin-top: auto !important;
        padding: 0.75rem !important;
    }
    
    .document-card .document-card-footer > div {
        display: flex !important;
        gap: 0.5rem !important;
        align-items: stretch !important;
        justify-content: center !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-wrap: nowrap !important;
        box-sizing: border-box !important;
        height: 38px !important;
    }
    
    .document-card .document-link,
    .document-card .document-details-btn {
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        padding: 0 0.75rem !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        white-space: nowrap !important;
        flex: 1 !important;
        text-align: center !important;
        box-sizing: border-box !important;
        text-decoration: none !important;
        border: none !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        /* Ensure perfect vertical alignment */
        visibility: visible !important;
        opacity: 1 !important;
        vertical-align: top !important;
        margin: 0 !important;
    }
    
    .document-card .document-link {
        background-color: var(--accent-color) !important;
        color: white !important;
    }
    
    .document-card .document-link:hover {
        background-color: var(--primary-color) !important;
        transform: translateY(-1px) !important;
    }
    
    .document-card .document-details-btn {
        background-color: var(--primary-color) !important;
        color: white !important;
    }
    
    .document-card .document-details-btn:hover {
        background-color: var(--accent-color) !important;
        transform: translateY(-1px) !important;
    }

    /* Dashboard Charts - Carousel Implementation */
    .charts-grid {
        display: none !important; /* Hide grid on mobile */
    }
    
    .charts-carousel-container {
        display: block !important; /* Show carousel on mobile */
        padding: 1rem;
        margin: 1rem 0;
    }
    
    .charts-carousel-track {
        position: relative;
        overflow: hidden;
    }
    
    .charts-carousel-track .chart-container {
        display: none; /* Hide all by default */
        width: 100%;
        margin: 0;
        padding: 1rem;
    }
    
    .charts-carousel-track .chart-container:first-child {
        display: block; /* Show first by default */
    }
    
    .chart-wrapper {
        height: 250px;
    }
    
    .swipe-hint {
        display: block;
        text-align: center;
        color: #666;
        font-size: 0.8rem;
        margin-top: 0.5rem;
    }
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-group {
        margin-bottom: 1rem;
    }

    /* Enhanced Filters - Hide on Mobile */
    .enhanced-filters {
        display: none !important;
    }

    .enhanced-filters h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        text-align: center;
    }

    .filter-label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .filter-select {
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px; /* Better touch target */
    }

    /* Header Mobile Optimizations */
    .header-content {
        gap: 1rem;
        padding: 0.5rem 0;
    }

    .logo-section h1 {
        font-size: 1.4rem;
        margin-bottom: 0.25rem;
        line-height: 1.3;
    }

    .logo-section h2 {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    .nav-controls {
        gap: 0.75rem;
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        width: 100%;
        min-width: unset;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .dropdown {
        width: 100%;
    }

    .dropdown select {
        width: 100%;
        padding: 0.75rem;
        min-height: 44px;
        font-size: 0.9rem;
    }

    .header-action-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .header-small-link {
        font-size: 0.8rem;
        padding: 0.5rem;
        display: block;
        text-align: center;
    }
    

    
    /* Proposal filters mobile optimization */
    .proposal-filters-container {
        padding: 0 10px !important;
        margin-bottom: 15px !important;
        text-align: center;
    }
    
    .proposal-filters-container .filter-group {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.3rem !important;
        margin: 0 auto !important;
        max-width: 250px !important;
    }
    
    .proposal-filters-container .filter-label {
        font-size: 0.9rem !important;
        margin: 0 !important;
        font-weight: 600 !important;
    }
    
    .proposal-filters-container .filter-select {
        max-width: 220px !important;
        width: 100% !important;
        font-size: 0.9rem !important;
        padding: 0.5rem !important;
        text-align: center;
    }

    /* Mobile Modal Optimizations */
    .research-modal {
        padding: 0.25rem;
        align-items: flex-start;
        padding-top: 2vh;
    }
    
    .research-modal-content {
        width: 98vw;
        max-width: 98vw;
        height: 96vh;
        max-height: 96vh;
        margin: 0 auto;
        padding: 0.5rem;
        overflow-y: auto;
        border-radius: 8px;
    }
    
    .research-modal-header {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
        position: relative;
        background: white;
        z-index: 1;
        border-bottom: 1px solid #eee;
    }
    
    .research-modal-title {
        font-size: 0.55rem;
        line-height: 1.0;
        margin: 0;
        padding-right: 2rem;
        font-weight: 500;
        word-wrap: break-word;
        overflow-wrap: break-word;
        position: relative;
    }
    
    .research-close-btn {
        top: 0.5rem;
        right: 0.5rem;
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }
    
    .modal-info-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .modal-info-item {
        padding: 0.5rem;
        border-radius: 4px;
    }
    
    .modal-info-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
        font-weight: 600;
    }
    
    .modal-info-value {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .modal-section {
        margin-bottom: 1rem;
    }
    
    .modal-section-title {
        font-size: 0.9rem;
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .modal-section-content {
        padding: 0.5rem;
        font-size: 0.85rem;
        line-height: 1.4;
    }
    

}
@media (max-width: 480px) {
    .chart-container {
        min-width: 98vw;
        max-width: 98vw;
        width: 98vw;
        margin: 0 1vw;
    }
    
    /* Keep carousel cards properly sized with boundaries */
    .document-card {
        flex: 0 0 78vw !important;
        min-width: 78vw !important;
        max-width: 78vw !important;
        width: 78vw !important;
        height: auto;
        min-height: 380px;
        margin: 0 !important;
        /* Use asymmetric padding - less on left to move text closer to edge */
        padding: 0.75rem 0.75rem 0.5rem 0.5rem !important;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.hidden { display: none; }
.flex { display: flex; }
.grid { display: grid; }

/* Styles for Clear Chart Filter Button */
.clear-chart-filter-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.clear-chart-filter-btn:hover {
    background-color: #e9ecef;
    color: #495057;
}

/* Reset Filters Button */
#resetFilters {
    width: 100%;
    padding: 0.5rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#resetFilters:hover {
    background-color: #5a6268;
}

/* Loading State for Filters */
.filter-select:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

/* Filter Group with Loading State */
.filter-group.loading {
    position: relative;
}

.filter-group.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure chart containers can position this button correctly.
   The JS attempts to set position:relative on the parent of the canvas if it's static.
   This class is a fallback or explicit styling for the .chart-container or .chart-wrapper. */
.chart-container, .chart-wrapper {
    position: relative;
}

/* Network Map Filter and Node Count Indicators */
.filter-status-indicator {
    border-left: 4px solid #2196f3;
    background: linear-gradient(90deg, #e3f2fd 0%, #f3f9ff 100%);
    font-weight: 500;
}

.filter-status-indicator strong {
    color: #1976d2;
}

.node-count-display {
    background: linear-gradient(90deg, #f5f5f5 0%, #fafafa 100%);
    border: 1px solid #e0e0e0;
    color: #424242;
    font-weight: 500;
}

.node-count-display strong {
    color: #1976d2;
    font-weight: 600;
}

/* Hover effects for better interactivity */
.filter-status-indicator:hover {
    background: linear-gradient(90deg, #d1e7fd 0%, #e8f4ff 100%);
    transition: background 0.2s ease;
}

.node-count-display:hover {
    background: linear-gradient(90deg, #eeeeee 0%, #f8f8f8 100%);
    transition: background 0.2s ease;
}

/* Loading time notice */
.loading-time-notice {
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.loading-time-notice:hover {
    color: #495057;
    transition: color 0.2s ease;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .filter-status-indicator,
    .node-count-display {
        font-size: 0.8em;
        padding: 6px;
        margin: 8px 0;
    }
    
    .filter-status-indicator {
        border-left-width: 3px;
    }
    
    .loading-time-notice {
        font-size: 0.8em;
        margin: 6px 0;
    }

    /* Network Map Mobile Optimizations */
    .network-map-section {
        padding: 1rem 0;
    }

    .network-controls {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .network-controls h3 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .map-type-toggle {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem !important;
    }

    .map-toggle-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
        margin-right: 0 !important;
    }

    #networkMapVis,
    #proposalConnectionsMapVis {
        height: 60vh !important;
        min-height: 400px !important;
    }

    .network-zoom-controls {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .zoom-btn {
        font-size: 1.2rem;
        padding: 0.5rem;
        min-width: 44px;
        min-height: 44px;
        background-color: var(--primary-color);
        color: white;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .zoom-btn:hover {
        background-color: var(--accent-color);
    }

    .network-instructions {
        padding: 1rem;
        margin-top: 1rem;
    }

    .network-instructions h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .network-instructions li {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }

    .target-area-filter {
        margin: 0.75rem 0 !important;
        padding: 0.75rem !important;
    }

    .target-area-filter label {
        font-size: 0.85rem !important;
    }

    .target-area-filter select {
        font-size: 0.85rem !important;
        padding: 0.5rem !important;
    }

    .node-count-display,
    #researcherNodeCountDisplay {
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
        margin: 0.5rem 0 !important;
    }

    .network-loading-progress {
        padding: 1rem;
        margin: 1rem 0;
    }

    .generate-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .loading-time-notice {
        font-size: 0.8rem;
        margin: 0.5rem 0;
        padding: 0.5rem;
        text-align: center;
    }

    #proposalMapGlossary {
        padding: 1rem !important;
        margin-top: 1rem !important;
    }

    #proposalMapGlossary h4 {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    #proposalMapGlossary li {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
        line-height: 1.4;
    }

    #proposalMapGlossary p {
        font-size: 0.8rem;
        margin-top: 0.75rem;
    }
}

@media (max-width: 480px) {
    .network-controls {
        padding: 0.75rem;
    }

    .map-type-toggle {
        gap: 0.75rem;
    }

    .map-toggle-btn {
        padding: 1rem;
        font-size: 0.85rem;
    }

    #networkMapVis,
    #proposalConnectionsMapVis {
        height: 50vh !important;
        min-height: 350px !important;
    }

    .zoom-btn {
        font-size: 1rem;
        min-width: 40px;
        min-height: 40px;
        padding: 0.4rem;
    }

    .network-instructions {
        padding: 0.75rem;
    }

    .network-instructions li {
        font-size: 0.8rem;
    }

    .controls-grid {
        gap: 0.5rem;
    }

    .control-input,
    .control-label {
        font-size: 0.85rem;
    }

    /* Make touch targets larger for better mobile usability */
    .control-input {
        padding: 0.75rem;
        min-height: 44px;
    }

    .network-status {
        padding: 0.6rem;
        font-size: 0.85rem;
    }

    .return-home-btn {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 12px;
    }

    /* Research Modal Mobile Optimizations */
    .research-modal {
        padding: 0.5rem;
    }

    .research-modal-content {
        max-height: 98vh;
        margin: 0;
        border-radius: 12px;
    }

    .research-modal-header {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .research-modal-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .research-close-btn {
        position: static;
        margin-top: 0.5rem;
        min-width: 44px;
        min-height: 44px;
    }

    .modal-section {
        padding: 1rem;
    }

    .modal-section-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .modal-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .modal-info-item {
        padding: 0.75rem;
    }

    .modal-info-label {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }

    .modal-info-value {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .modal-authors-list {
        gap: 0.5rem;
    }

    .modal-author-badge {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .document-details-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
        margin-top: 1rem;
    }
}

/* Network tooltip width limiting for proposal network */
.vis-tooltip {
    max-width: 350px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    padding: 10px !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border: 1px solid #ddd !important;
}

/* Mobile responsive tooltip */
@media (max-width: 768px) {
    .vis-tooltip {
        max-width: 280px !important;
        font-size: 12px !important;
        padding: 8px !important;
    }
}

@media (max-width: 480px) {
    .vis-tooltip {
        max-width: 250px !important;
        font-size: 11px !important;
        padding: 6px !important;
    }
}