:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #0f4c75;
    --text-primary: #eaeaea;
    --text-secondary: #a8a8a8;
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --border-color: #2a2a2a;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --error-color: #f44336;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Layout Container */
.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 200px;
    max-width: 600px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    padding-right: 15px;
    overflow-y: auto;
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-resizer {
    position: fixed;
    top: 60px;
    right: auto;
    left: 280px;
    width: 5px;
    height: calc(100vh - 60px);
    cursor: ew-resize;
    background: transparent;
    z-index: 101;
    transition: left 0.05s ease;
}

.sidebar-resizer:hover {
    background: var(--accent-color);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

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

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
}

/* Filter Form */
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

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

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

.filter-group input[type="text"],
.filter-group input[type="date"],
.filter-group select {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(15, 76, 117, 0.2);
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-inputs span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.filter-scroll {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    background-color: var(--primary-color);
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.checkbox-item label {
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--text-primary);
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0d3e61;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

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

/* Navigation */
.navbar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 150;
    width: 100%;
}

/* Main Wrapper */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

.main-wrapper.with-sidebar {
    margin-left: 280px;
    transition: margin-left 0.05s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none !important; /* Hide by default on desktop */
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    font-size: 1.5rem;
    position: relative;
    z-index: 160; /* Above navbar and sidebar */
}

.mobile-menu-toggle:hover {
    color: var(--accent-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Home Page Styles */
.hero {
    text-align: center;
    padding: 60px 0;
    border-bottom: 1px solid var(--border-color);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.stats-row {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

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

/* Gallery */
.gallery-section {
    margin: 60px 0;
}

.gallery-section h2 {
    font-size: 1.75rem;
    margin-bottom: 30px;
}

.gallery-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background-color: var(--bg-secondary);
}

.gallery-track {
    display: flex;
    transition: transform 0.3s ease;
}

.gallery-item {
    min-width: 100%;
    position: relative;
    height: 400px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    padding: 30px;
    color: white;
}

.gallery-caption h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.gallery-caption p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0,0,0,0.7);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
}

.gallery-nav:hover {
    background-color: rgba(0,0,0,0.9);
}

.gallery-prev {
    left: 10px;
}

.gallery-next {
    right: 10px;
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.article-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.article-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--primary-color);
}

.article-content {
    padding: 20px;
}

.article-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.article-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.article-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 15px;
}

.article-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Search Results */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-result {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

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

.result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.result-meta {
    display: flex;
    gap: 15px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.result-body {
    margin: 15px 0;
    line-height: 1.6;
}

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

.result-image {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
}

/* Charts */
.chart-container {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid var(--border-color);
}

#timelineChart,
#networkChart {
    width: 100%;
    height: 500px;
}

#topicTreemap {
    width: 100%;
    height: 600px;
}

#mapView {
    height: 600px;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 20px;
}

/* Controls */
.timeline-controls,
.network-controls {
    display: flex;
    gap: 30px;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.control-group input[type="number"],
.control-group select {
    padding: 6px 12px;
    background-color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination button {
    padding: 8px 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

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

.pagination button.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Footer */
.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px;
    text-align: center;
}

.footer-content {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Mobile Sidebar Toggle Button (FAB) */
.mobile-sidebar-toggle {
    display: none !important; /* Hidden by default on desktop */
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 140;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.mobile-sidebar-toggle:hover {
    background-color: var(--accent-hover);
    transform: scale(1.1);
}

.mobile-sidebar-toggle:active {
    transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .main-wrapper.with-sidebar {
        margin-left: 0;
    }

    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .stats-row {
        flex-direction: column;
        gap: 30px;
    }

    /* Mobile navigation */
    .mobile-menu-toggle {
        display: block !important; /* Show on mobile */
    }

    /* Mobile sidebar FAB button */
    .mobile-sidebar-toggle {
        display: block !important; /* Show on mobile */
    }

    .nav-menu {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background-color: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        gap: 0;
        z-index: 140;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-item {
        border-bottom: 1px solid var(--border-color);
    }

    .nav-link {
        display: block;
        padding: 15px 20px;
        font-size: 1rem;
    }

    .main-content {
        padding: 20px;
    }

    .timeline-controls,
    .network-controls {
        flex-direction: column;
        align-items: stretch;
    }

    /* Sidebar slide-in panel on mobile - hidden by default */
    .sidebar {
        width: 85%;
        max-width: 350px;
        left: -100%;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 130; /* Above content, below navbar */
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-toggle {
        display: block !important; /* Show toggle button on mobile */
    }

    .sidebar-resizer {
        display: none;
    }

    .main-wrapper.with-sidebar {
        margin-left: 0;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 129;
    }

    .sidebar-overlay.active {
        display: block;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Tooltips */
.tooltip {
    position: absolute;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--shadow);
}

/* D3 Specific Styles */
.axis text {
    fill: var(--text-secondary);
}

.axis path,
.axis line {
    stroke: var(--border-color);
}

.grid line {
    stroke: var(--border-color);
    stroke-opacity: 0.3;
}

.line {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 2;
}

.area {
    fill: var(--accent-color);
    fill-opacity: 0.2;
}

.dot {
    fill: var(--accent-color);
    stroke: white;
    stroke-width: 2;
}

.moving-avg-line {
    fill: none;
    stroke: var(--warning-color);
    stroke-width: 2;
    stroke-dasharray: 5,5;
}

/* Treemap Styles */
.node {
    cursor: pointer;
}

.node rect {
    fill-opacity: 0.8;
    stroke: var(--border-color);
    stroke-width: 1;
}

.node text {
    font-size: 0.75rem;
    fill: white;
}

/* Network Styles */
.links line {
    stroke: var(--border-color);
    stroke-opacity: 0.6;
}

.nodes circle {
    stroke: var(--bg-primary);
    stroke-width: 2;
    cursor: pointer;
}

.nodes text {
    font-size: 0.75rem;
    fill: var(--text-primary);
    pointer-events: none;
}

/* Map Marker Clusters */
.marker-cluster {
    background-color: var(--accent-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    font-weight: bold;
    border: 3px solid var(--bg-primary);
}

.marker-cluster-small {
    width: 40px;
    height: 40px;
    line-height: 40px;
}

.marker-cluster-medium {
    width: 50px;
    height: 50px;
    line-height: 50px;
}

.marker-cluster-large {
    width: 60px;
    height: 60px;
    line-height: 60px;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.leaflet-popup-content {
    margin: 15px;
}

.leaflet-popup-tip {
    background-color: var(--bg-secondary);
}

.popup-content h3 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.popup-articles {
    max-height: 200px;
    overflow-y: auto;
}

.popup-article {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.popup-article:last-child {
    border-bottom: none;
}

.popup-article a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.875rem;
}

.popup-article a:hover {
    text-decoration: underline;
}

/* Article Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.5rem;
    line-height: 1.4;
    flex: 1;
    margin-right: 20px;
}

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

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

.modal-body {
    padding: 20px;
}

.modal-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.modal-meta span {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: capitalize;
}

.modal-meta span:first-child::before {
    content: "📅 ";
}

.modal-meta span:last-child::before {
    content: "📰 ";
}

#modalContent {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 20px;
}

#modalContent p {
    margin-bottom: 16px;
}

#modalImages {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 15px 15px 10px;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .image-modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .image-modal-body img {
        max-width: 100%;
        max-height: 70vh;
    }
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.image-modal-content {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.image-modal-header {
    display: flex;
    justify-content: flex-end;
    padding: 15px 20px 10px;
    border-bottom: 1px solid var(--border-color);
}

.image-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow: auto;
}

.image-modal-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.image-modal-actions {
    display: flex;
    justify-content: center;
    padding-top: 10px;
}

.image-modal-actions .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Make result images clickable */
.result-image {
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.result-image:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Image Gallery Modal Styles */
.image-gallery-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.image-gallery-content {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.image-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.image-counter {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
}

.image-gallery-body {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-primary);
    min-height: 400px;
}

.image-gallery-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.image-gallery-body .gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 10;
    border-radius: 4px;
}

.image-gallery-body .gallery-nav:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.9);
}

.image-gallery-body .gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.image-gallery-body .gallery-prev {
    left: 20px;
}

.image-gallery-body .gallery-next {
    right: 20px;
}

.image-gallery-actions {
    display: flex;
    justify-content: center;
    padding: 15px 20px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.image-gallery-actions .btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Mobile responsiveness for image gallery */
@media (max-width: 768px) {
    .image-gallery-content {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .image-gallery-body {
        min-height: 300px;
        padding: 10px;
    }
    
    .image-gallery-body img {
        max-height: 60vh;
    }
    
    .image-gallery-body .gallery-nav {
        font-size: 1.5rem;
        padding: 10px 15px;
    }
    
    .image-gallery-body .gallery-prev {
        left: 10px;
    }
    
    .image-gallery-body .gallery-next {
        right: 10px;
    }
    
    .image-gallery-header {
        padding: 10px 15px;
    }
    
    .image-gallery-actions {
        padding: 10px 15px;
    }
}

/* Semantic Search Styles */
.search-mode-selector {
    margin-top: 8px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.radio-option:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.radio-option input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--accent-color);
}

.radio-option .radio-label {
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.radio-option small {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: block;
    margin-top: 2px;
}

/* Similarity threshold slider */
.filter-group input[type="range"] {
    width: 100%;
    margin: 8px 0;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
}

.filter-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.filter-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Search result score displays */
.similarity-score {
    color: var(--accent-color);
    font-weight: 500;
    background: rgba(15, 76, 117, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.hybrid-score {
    color: var(--warning-color);
    font-weight: 500;
    background: rgba(255, 152, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Search mode indicators in results */
.result-meta span[title*="semantic"],
.result-meta span[title*="keyword"],
.result-meta span[title*="Semantic"] {
    cursor: help;
}

/* Responsive adjustments for semantic search */
@media (max-width: 768px) {
    .radio-group {
        gap: 8px;
    }
    
    .radio-option {
        padding: 6px;
    }
    
    .radio-option small {
        font-size: 0.75rem;
    }
}

/* Knowledge Graph Styles */
.graph-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.graph-controls {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-width: 300px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.entity-type-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    margin-bottom: 0;
}

.checkbox-option input[type="checkbox"] {
    margin: 0;
}

.entity-person { color: #FF6B6B; font-size: 16px; }
.entity-org { color: #4ECDC4; font-size: 16px; }
.entity-location { color: #45B7D1; font-size: 16px; }
.entity-event { color: #96CEB4; font-size: 16px; }

.control-group select,
.control-group input[type="range"] {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-primary);
}

.control-group input[type="range"] {
    padding: 0;
}

#maxNodesValue {
    display: inline-block;
    margin-left: 8px;
    color: var(--accent-color);
    font-weight: 500;
}

.path-finder {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-width: 300px;
}

.path-finder h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.path-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.path-inputs input {
    flex: 1;
    min-width: 150px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    color: var(--text-primary);
}

.path-inputs span {
    color: var(--text-secondary);
    font-weight: bold;
}

.path-results {
    max-height: 200px;
    overflow-y: auto;
}

.path-result {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 4px;
}

.path-result h5 {
    margin-bottom: 8px;
    color: var(--accent-color);
}

.path-nodes {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.path-node {
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.path-arrow {
    color: var(--text-secondary);
}

.graph-stats {
    display: flex;
    gap: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-item span:last-child {
    font-size: 18px;
    font-weight: bold;
    color: var(--accent-color);
}

/* Graph Visualization */
.graph-visualization {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#knowledgeGraph {
    background: var(--bg-primary);
    cursor: grab;
}

#knowledgeGraph:active {
    cursor: grabbing;
}

.graph-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text-primary);
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.error-message {
    text-align: center;
    padding: 20px;
}

.error-message h3 {
    margin-bottom: 15px;
    color: var(--error-color);
}

/* Graph Elements */
.node {
    cursor: pointer;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.node:hover {
    stroke-width: 3;
    filter: brightness(1.2);
}

.node.selected {
    stroke: var(--accent-color);
    stroke-width: 4;
}

.node.highlighted {
    filter: brightness(1.3);
    stroke-width: 3;
}

.link {
    stroke: #999;
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
}

.link.highlighted {
    stroke-opacity: 1;
    stroke-width: 3px;
}

.link-label {
    font-size: 10px;
    fill: var(--text-secondary);
    pointer-events: none;
    opacity: 0.7;
}

.node-label {
    font-size: 12px;
    font-weight: 500;
    fill: var(--text-primary);
    text-anchor: middle;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Entity Details Panel */
.entity-details-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.entity-details-panel.active {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

.panel-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.close-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.panel-content {
    padding: 20px;
}

.entity-info {
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.info-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-item .value {
    color: var(--text-primary);
}

.entity-connections,
.entity-articles {
    margin-bottom: 20px;
}

.entity-connections h4,
.entity-articles h4 {
    margin-bottom: 15px;
    color: var(--accent-color);
}

.connection-group {
    margin-bottom: 15px;
}

.connection-group h5 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.connection-list {
    max-height: 150px;
    overflow-y: auto;
}

.connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-primary);
    border-radius: 4px;
    margin-bottom: 4px;
}

.connection-entity {
    font-size: 13px;
    color: var(--text-primary);
}

.connection-confidence {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--accent-color);
    padding: 2px 6px;
    border-radius: 10px;
}

/* Graph Legend */
.graph-legend {
    position: absolute;
    top: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    font-size: 12px;
    z-index: 5;
}

.graph-legend h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.legend-items {
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.rel-line {
    display: inline-block;
    width: 20px;
    height: 2px;
    margin-right: 8px;
}

.rel-line.diplomatic { background: #3498DB; }
.rel-line.leadership { background: #E74C3C; }
.rel-line.military { background: #E67E22; }
.rel-line.economic { background: #27AE60; }

/* Knowledge Graph Mobile Styles */
@media (max-width: 768px) {
    .graph-container {
        flex-direction: column;
    }
    
    .graph-controls,
    .path-finder {
        min-width: auto;
    }
    
    .path-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .path-inputs input {
        min-width: auto;
        width: 100%;
    }
    
    .graph-stats {
        justify-content: space-around;
    }
    
    .entity-details-panel {
        width: 100%;
        right: -100%;
    }
    
    .graph-legend {
        position: relative;
        margin-bottom: 20px;
    }
    
    #knowledgeGraph {
        height: 400px;
    }
}
