/* ===== CSS Variables ===== */
:root {
    /* Dark Theme Colors (default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-elevated: #22222e;
    --bg-hover: #2a2a38;

    /* Text Colors */
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;

    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    /* Category Colors */
    --cat-natural: #f59e0b;
    --cat-aircraft: #3b82f6;
    --cat-missile: #ef4444;
    --cat-civil: #8b5cf6;
    --cat-security: #ec4899;
    --cat-maritime: #06b6d4;
    --cat-infrastructure: #f97316;

    /* Borders */
    --border-color: #2a2a38;
    --border-subtle: #1e1e28;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

    /* Spacing */
    --header-height: 60px;
    --sidebar-width: 400px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-elevated: #ffffff;
    --bg-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

/* Light theme map adjustments */
[data-theme="light"] .leaflet-control-zoom a {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

[data-theme="light"] .leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .leaflet-popup-content-wrapper,
[data-theme="light"] .leaflet-popup-tip {
    background: #ffffff;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
}

input::placeholder {
    color: var(--text-muted);
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Threat Level Indicator */
.threat-level {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 70px;
}

.threat-level:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.threat-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.threat-value {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Threat Level Colors */
.threat-level[data-level="1"] {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.15);
}
.threat-level[data-level="1"] .threat-value {
    color: #ef4444;
}

.threat-level[data-level="2"] {
    border-color: #ea580c;
    background: rgba(234, 88, 12, 0.15);
}
.threat-level[data-level="2"] .threat-value {
    color: #f97316;
}

.threat-level[data-level="3"] {
    border-color: #ca8a04;
    background: rgba(202, 138, 4, 0.15);
}
.threat-level[data-level="3"] .threat-value {
    color: #eab308;
}

.threat-level[data-level="4"] {
    border-color: #0284c7;
    background: rgba(2, 132, 199, 0.15);
}
.threat-level[data-level="4"] .threat-value {
    color: #0ea5e9;
}

.threat-level[data-level="5"] {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.15);
}
.threat-level[data-level="5"] .threat-value {
    color: #10b981;
}

/* Threat Level Tooltip/Modal */
.threat-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.threat-level:hover .threat-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.threat-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.threat-tooltip-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.threat-tooltip-source {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.threat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.8rem;
}

.threat-item-label {
    color: var(--text-secondary);
    flex: 1;
}

.threat-item-prob {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: right;
}

.threat-status-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.threat-description {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.threat-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.threat-threats-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* Search */
.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.search-clear:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.search-clear svg {
    width: 14px;
    height: 14px;
}

.search-clear.hidden {
    display: none;
}

/* Live Indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-full);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.live-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-success);
    letter-spacing: 0.05em;
}

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

/* ===== Main Content ===== */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== Map Container ===== */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
}

/* Dark map tiles */
.leaflet-container {
    background: var(--bg-primary);
    font-family: inherit;
}

/* Leaflet Controls - Dark Mode */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    transition: all var(--transition-fast);
}

.leaflet-control-zoom a:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

.leaflet-control-zoom-in {
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    border-top: none !important;
}

.leaflet-control-attribution {
    background: rgba(10, 10, 15, 0.8) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

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

.leaflet-popup-content {
    margin: 12px 16px;
    font-size: 0.9rem;
}

/* Custom Marker Styles */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
    color: white;
    transition: transform var(--transition-fast);
}

.custom-marker svg {
    width: 18px;
    height: 18px;
    stroke: white;
    flex-shrink: 0;
}

.custom-marker:hover {
    transform: scale(1.2);
}

.custom-marker.natural-disaster { background: var(--cat-natural); }
.custom-marker.aircraft { background: var(--cat-aircraft); }
.custom-marker.missile { background: var(--cat-missile); }
.custom-marker.civil-unrest { background: var(--cat-civil); }
.custom-marker.security { background: var(--cat-security); }
.custom-marker.maritime { background: var(--cat-maritime); }
.custom-marker.infrastructure { background: var(--cat-infrastructure); }

.custom-marker.highlight {
    animation: marker-pulse 1s ease-in-out infinite;
    z-index: 1000 !important;
}

@keyframes marker-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    50% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0); }
}

/* Marker Cluster */
.marker-cluster {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 50%;
}

.marker-cluster div {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    border-radius: 50%;
    margin: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-cluster-small {
    background: rgba(59, 130, 246, 0.3);
}

.marker-cluster-small div {
    width: 30px;
    height: 30px;
}

.marker-cluster-medium {
    background: rgba(139, 92, 246, 0.3);
}

.marker-cluster-medium div {
    width: 40px;
    height: 40px;
    background: var(--accent-secondary);
}

.marker-cluster-large {
    background: rgba(239, 68, 68, 0.3);
}

.marker-cluster-large div {
    width: 50px;
    height: 50px;
    background: var(--accent-danger);
}

/* Category Filters */
.category-filters {
    position: absolute;
    top: 16px;
    left: 60px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    z-index: 999;
    max-width: calc(100% - 80px);
}

.filter-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.filter-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.filter-btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
}

.filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.filter-btn[data-category="natural-disaster"].active { background: var(--cat-natural); border-color: var(--cat-natural); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }
.filter-btn[data-category="aircraft"].active { background: var(--cat-aircraft); border-color: var(--cat-aircraft); box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); }
.filter-btn[data-category="missile"].active { background: var(--cat-missile); border-color: var(--cat-missile); box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
.filter-btn[data-category="civil-unrest"].active { background: var(--cat-civil); border-color: var(--cat-civil); box-shadow: 0 0 12px rgba(139, 92, 246, 0.4); }
.filter-btn[data-category="security"].active { background: var(--cat-security); border-color: var(--cat-security); box-shadow: 0 0 12px rgba(236, 72, 153, 0.4); }
.filter-btn[data-category="maritime"].active { background: var(--cat-maritime); border-color: var(--cat-maritime); box-shadow: 0 0 12px rgba(6, 182, 212, 0.4); }
.filter-btn[data-category="infrastructure"].active { background: var(--cat-infrastructure); border-color: var(--cat-infrastructure); box-shadow: 0 0 12px rgba(249, 115, 22, 0.4); }

.filter-btn i {
    font-size: 16px;
}

.filter-label {
    display: none;
}

/* ===== Feed Sidebar ===== */
.feed-sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    transition: width var(--transition-normal), min-width var(--transition-normal);
    overflow: hidden;
    flex-shrink: 0;
}

.feed-sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
}

.feed-sidebar.collapsed .feed-header,
.feed-sidebar.collapsed .accounts-toggle,
.feed-sidebar.collapsed .accounts-panel,
.feed-sidebar.collapsed .feed-content {
    opacity: 0;
    pointer-events: none;
}

/* Expand button that appears when collapsed */
.expand-feed-btn {
    display: none;
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    color: white;
    align-items: center;
    justify-content: center;
    z-index: 200;
    box-shadow: -4px 0 20px rgba(59, 130, 246, 0.3);
    transition: all var(--transition-fast);
    cursor: pointer;
    flex-direction: column;
    gap: 8px;
}

.expand-feed-btn::after {
    content: 'Feed';
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.expand-feed-btn:hover {
    width: 52px;
    box-shadow: -6px 0 25px rgba(59, 130, 246, 0.5);
}

.expand-feed-btn svg {
    width: 22px;
    height: 22px;
}

.expand-feed-btn.visible {
    display: flex;
}

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

.feed-title {
    font-size: 1rem;
    font-weight: 600;
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-btn,
.toggle-feed-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.refresh-btn:hover,
.toggle-feed-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.refresh-btn svg,
.toggle-feed-btn svg {
    width: 18px;
    height: 18px;
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

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

/* Accounts Toggle & Panel */
.accounts-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.accounts-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.accounts-toggle svg {
    width: 16px;
    height: 16px;
}

.accounts-toggle .chevron {
    margin-left: auto;
    transition: transform var(--transition-fast);
}

.accounts-toggle.expanded .chevron {
    transform: rotate(180deg);
}

.accounts-panel {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    max-height: 250px;
    overflow-y: auto;
    transition: all var(--transition-normal);
}

.accounts-panel.hidden {
    max-height: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

.accounts-list {
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.account-item .account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-hover);
}

.account-item .account-handle {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.account-item .account-toggle {
    width: 40px;
    height: 22px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    position: relative;
    transition: background var(--transition-fast);
}

.account-item .account-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.account-item .account-toggle.active {
    background: var(--accent-primary);
}

.account-item .account-toggle.active::after {
    left: 20px;
    background: white;
}

.account-item .remove-account {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.account-item .remove-account:hover {
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.1);
}

.account-item .remove-account svg {
    width: 14px;
    height: 14px;
}

.add-account {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
}

.account-input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.account-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.add-account-btn {
    padding: 0 16px;
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
    transition: all var(--transition-fast);
}

.add-account-btn:hover {
    background: #2563eb;
}

/* Feed Content */
.feed-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.feed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 20px;
    color: var(--text-muted);
}

.feed-loading.hidden {
    display: none;
}

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

.feed-items {
    display: flex;
    flex-direction: column;
}

/* Feed Item / Tweet Card */
.feed-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.feed-item:hover {
    background: var(--bg-tertiary);
}

.feed-item.highlight {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-primary);
}

.feed-item-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.feed-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-hover);
    flex-shrink: 0;
    object-fit: cover;
}

.feed-user-info {
    flex: 1;
    min-width: 0;
}

.feed-user-name {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.95rem;
}

.feed-user-verified {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

.feed-user-handle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.feed-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.feed-link {
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.feed-link:hover {
    color: var(--accent-primary);
}

.external-link-icon {
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.feed-link:hover .external-link-icon {
    opacity: 1;
}

.feed-content-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 12px;
    word-wrap: break-word;
}

.feed-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.feed-category-tag.natural-disaster { background: rgba(245, 158, 11, 0.2); color: var(--cat-natural); }
.feed-category-tag.aircraft { background: rgba(59, 130, 246, 0.2); color: var(--cat-aircraft); }
.feed-category-tag.missile { background: rgba(239, 68, 68, 0.2); color: var(--cat-missile); }
.feed-category-tag.civil-unrest { background: rgba(139, 92, 246, 0.2); color: var(--cat-civil); }
.feed-category-tag.security { background: rgba(236, 72, 153, 0.2); color: var(--cat-security); }
.feed-category-tag.maritime { background: rgba(6, 182, 212, 0.2); color: var(--cat-maritime); }
.feed-category-tag.infrastructure { background: rgba(249, 115, 22, 0.2); color: var(--cat-infrastructure); }

.feed-location {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.feed-location svg {
    width: 14px;
    height: 14px;
}

.feed-stats {
    display: flex;
    align-items: center;
    gap: 20px;
}

.feed-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.feed-stat:hover {
    color: var(--text-secondary);
}

.feed-stat svg {
    width: 16px;
    height: 16px;
}

/* ===== Mobile Feed Toggle ===== */
.mobile-feed-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--accent-primary);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform var(--transition-fast);
}

.mobile-feed-toggle:hover {
    transform: scale(1.05);
}

.mobile-feed-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--accent-danger);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-badge:empty,
.notification-badge[data-count="0"] {
    display: none;
}

/* ===== Popup Content ===== */
.popup-content {
    min-width: 200px;
}

.popup-category {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.popup-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.popup-location {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.popup-source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.popup-source img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .category-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .filter-btn {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .feed-sidebar {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }

    .logo-text {
        display: none;
    }

    .header-center {
        margin: 0 12px;
    }

    .event-count {
        display: none;
    }

    .main-content {
        position: relative;
    }

    .map-container {
        width: 100%;
    }

    .feed-sidebar {
        position: fixed;
        top: var(--header-height);
        right: 0;
        bottom: 0;
        width: 100% !important;
        max-width: 400px;
        transform: translateX(100%);
        z-index: 500;
        box-shadow: var(--shadow-lg);
    }

    .feed-sidebar.collapsed {
        transform: translateX(100%);
        width: 100% !important;
    }

    .feed-sidebar.visible {
        transform: translateX(0);
    }

    .toggle-feed-btn,
    .expand-feed-btn {
        display: none !important;
    }

    .mobile-feed-toggle {
        display: flex;
    }

    .category-filters {
        top: auto;
        bottom: 90px;
        left: 12px;
        right: 12px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header {
        height: 52px;
    }

    :root {
        --header-height: 52px;
    }

    .search-input {
        height: 36px;
        font-size: 0.85rem;
    }

    .live-indicator {
        padding: 4px 8px;
    }

    .live-text {
        display: none;
    }

    .feed-item {
        padding: 14px 16px;
    }

    .feed-avatar {
        width: 38px;
        height: 38px;
    }
}

/* ===== Map Controls (right side) ===== */
.map-controls {
    position: absolute;
    top: 80px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 999;
}

.map-control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.map-control-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

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

.map-control-btn svg,
.map-control-btn i {
    width: 20px;
    height: 20px;
}

.map-control-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--text-secondary);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.map-control-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== Time Slider ===== */
.time-slider-container {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-width: calc(100% - 32px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    z-index: 999;
}

.time-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.time-slider-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.time-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    cursor: pointer;
}

.time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.time-slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.time-slider-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.time-slider-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-slider-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.time-current {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Flight Markers ===== */
.flight-marker {
    background: transparent;
    border: none;
}

.flight-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.flight-popup {
    font-size: 0.85rem;
    line-height: 1.5;
}

/* ===== Keyword Highlights ===== */
.keyword-highlight {
    background: rgba(245, 158, 11, 0.3);
    color: #f59e0b;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* Keywords Panel */
.keywords-help {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.4;
}

.keywords-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.keyword-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 12px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: #f59e0b;
}

.keyword-text {
    font-weight: 500;
}

.remove-keyword {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.remove-keyword:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.remove-keyword svg {
    width: 12px;
    height: 12px;
}

/* ===== Tweet Images ===== */
.feed-media {
    margin: 10px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.feed-media img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.feed-media img:hover {
    transform: scale(1.02);
}

.feed-media-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.feed-media-grid img {
    aspect-ratio: 16/9;
}

/* ===== Priority/Alert Indicators ===== */
.feed-item.high-priority {
    border-left: 3px solid var(--accent-danger);
    background: rgba(239, 68, 68, 0.05);
}

.feed-item.keyword-match {
    border-left: 3px solid var(--accent-warning);
    background: rgba(245, 158, 11, 0.05);
}

/* RSS Source badge */
.rss-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    color: #10b981;
    margin-left: 8px;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.theme-toggle .theme-icon-light,
.theme-toggle .theme-icon-dark {
    width: 18px;
    height: 18px;
    position: absolute;
    transition: all var(--transition-fast);
}

/* Dark mode (default): show sun icon */
.theme-toggle .theme-icon-light {
    opacity: 1;
    transform: scale(1);
}

.theme-toggle .theme-icon-dark {
    opacity: 0;
    transform: scale(0.5);
}

/* Light mode: show moon icon */
[data-theme="light"] .theme-toggle .theme-icon-light {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="light"] .theme-toggle .theme-icon-dark {
    opacity: 1;
    transform: scale(1);
}

/* ===== Last Updated ===== */
.last-updated {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===== Engagement Filter ===== */
.engagement-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.engagement-filter .filter-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.engagement-select {
    flex: 1;
    height: 28px;
    padding: 0 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
}

.engagement-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* ===== Export & Action Buttons ===== */
.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.action-btn svg,
.action-btn i {
    width: 18px;
    height: 18px;
}

/* ===== Copy Button in Feed Items ===== */
.feed-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.copy-btn,
.share-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.copy-btn:hover,
.share-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.copy-btn.copied {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.copy-btn svg,
.share-btn svg {
    width: 12px;
    height: 12px;
}

/* ===== Export Modal ===== */
.export-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
}

.export-modal.visible {
    opacity: 1;
    visibility: visible;
}

.export-modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.export-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-option:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.export-option svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.export-option-info {
    flex: 1;
}

.export-option-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.export-option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.export-modal-close {
    width: 100%;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

/* ===== Duplicate Badge ===== */
.duplicate-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(107, 114, 128, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-left: 8px;
}

/* ===== Utilities ===== */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== Mobile adjustments for new features ===== */
@media (max-width: 768px) {
    .map-controls {
        top: auto;
        bottom: 140px;
        right: 10px;
    }

    .time-slider-container {
        bottom: 16px;
        width: calc(100% - 24px);
        padding: 10px 12px;
    }

    .threat-level {
        display: none;
    }
}
