/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Typography Variables - Unified Font System */
:root {
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Unified text colors */
    --text-color-primary: rgba(255, 255, 255, 0.9);
    --text-color-secondary: rgba(255, 255, 255, 0.8);
    --text-color-muted: rgba(255, 255, 255, 0.6);
    
    /* Unified font sizes */
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 0.9rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.1rem;
    --font-size-2xl: 1.2rem;
    --font-size-3xl: 1.3rem;
    
    /* Unified letter spacing */
    --letter-spacing-tight: 0.025em;
    --letter-spacing-normal: 0.5px;
    --letter-spacing-wide: 0.75px;
}

body {
    font-family: var(--font-family-primary);
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
    color: var(--text-color-primary);
    overflow-x: hidden;
    min-height: 100vh;
    font-weight: var(--font-weight-regular);
    letter-spacing: var(--letter-spacing-tight);
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Right Sidebar - Network Peers */
.right-sidebar {
    width: 400px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.right-sidebar.show {
    transform: translateX(0);
}

.right-sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.98);
    flex-shrink: 0;
}

.right-sidebar-header h3 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color-primary);
    margin: 0;
    font-family: var(--font-family-primary);
    letter-spacing: var(--letter-spacing-tight);
}

.right-sidebar-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.close-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.close-sidebar-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.close-sidebar-btn i {
    font-size: 0.9rem;
}

.close-sidebar-btn span {
    white-space: nowrap;
}

.right-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem;
    gap: 1rem;
}

.right-sidebar-content .search-section {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

.right-sidebar-content .validator-toggle-section {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

/* Toggle Switch Styles */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.toggle-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.8) 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 253, 244, 0.8) 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.toggle-container:hover .toggle-label {
    color: #ffffff;
    transform: translateX(2px);
}

.right-sidebar-content .peers-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 8px;
    min-height: 0;
}

/* Toggle Sidebar Button */
.toggle-sidebar-btn {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: auto;
    min-width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 30px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    z-index: 1000;
}

.toggle-sidebar-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.toggle-sidebar-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
}

.toggle-sidebar-btn i {
    transition: transform 0.3s ease;
}

.toggle-sidebar-btn:hover i {
    transform: rotate(180deg);
}

.toggle-btn-text {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.toggle-sidebar-btn:hover .toggle-btn-text {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile optimization for toggle button */
@media (max-width: 768px) {
    .toggle-sidebar-btn {
        width: 50px;
        height: 50px;
        right: 15px;
        font-size: 1.1rem;
        padding: 0;
        border-radius: 50%;
        min-width: auto;
    }
    
    .toggle-btn-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .toggle-sidebar-btn {
        width: 45px;
        height: 45px;
        right: 10px;
        font-size: 1rem;
        padding: 0;
        border-radius: 50%;
        min-width: auto;
    }
    
    .toggle-btn-text {
        display: none;
    }
}

/* App Layout */
.app-wrapper {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
}

/* Sidebar */
.sidebar {
    width: 460px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.logo-text h1 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color-primary);
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: var(--font-family-primary);
    letter-spacing: var(--letter-spacing-tight);
}

.logo-text p {
    font-size: var(--font-size-base);
    color: var(--text-color-secondary);
    margin: 0;
    font-weight: var(--font-weight-regular);
    font-family: var(--font-family-primary);
    letter-spacing: var(--letter-spacing-tight);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Connection Status */
.connection-status {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    position: relative;
    animation: pulse 2s infinite;
}

.status-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.3);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #10b981;
}

.status-dot.connected::after {
    background: rgba(16, 185, 129, 0.3);
}

.status-dot.disconnected {
    background: #ef4444;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.8) 100%);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Interactive hint for Network card */
#networkCard {
    cursor: pointer;
    position: relative;
}

#networkCard .stat-value {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

#networkCard .stat-value::after {
    content: '\f362'; /* fa-exchange-alt */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.9rem;
    opacity: 0.8;
}

#networkHint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#networkCard:hover #networkHint {
    opacity: 1;
    transform: translateY(0);
}

#networkCard:hover {
    border-color: rgba(102, 126, 234, 0.8);
    box-shadow: 0 8px 26px rgba(102, 126, 234, 0.35);
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color-primary);
    line-height: 1;
    font-family: var(--font-family-primary);
    letter-spacing: var(--letter-spacing-tight);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-color-muted);
    font-weight: var(--font-weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-normal);
    font-family: var(--font-family-primary);
}

/* Search Section */
.search-section {
    margin-bottom: 1rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.search-box i {
    position: absolute;
    left: 1rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    z-index: 1;
    flex-shrink: 0;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
    outline: none;
}

.search-box:focus-within {
    background: rgba(15, 23, 42, 0.8);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Peers List Section */
.peers-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 0;
    overflow: hidden;
    padding: 0.5rem 0;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.refresh-btn {
    width: 40px;
    height: 40px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.refresh-btn:hover {
    background: rgba(15, 23, 42, 0.8);
    color: #ffffff;
    transform: scale(1.05);
}

.peers-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    padding-right: 8px;
    padding-bottom: 1rem;
}

/* Peer Item */
.peer-item {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.7) 0%, rgba(30, 41, 59, 0.5) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 0;
    min-height: 100px;
    min-width: 0;
}

.peer-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.peer-item:hover {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.7) 100%);
    border-color: rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.peer-item.validator:hover {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(34, 197, 94, 0.2) 100%);
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.peer-item:hover::before {
    opacity: 1;
}

.peer-item.validator {
    border-color: rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.7) 0%, rgba(34, 197, 94, 0.1) 100%);
}

.peer-item.validator::before {
    background: linear-gradient(90deg, #22c55e, #16a34a);
    opacity: 1;
}

.peer-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.focus-btn, .details-btn {
    min-width: 40px;
    height: 40px;
    padding: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.focus-btn:hover, .details-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.focus-btn:active, .details-btn:active {
    transform: translateY(0);
}

.focus-btn i, .details-btn i {
    font-size: 0.9rem;
}

.focus-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.focus-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

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

.details-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.details-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

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

.peer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    min-height: 0;
    overflow: hidden;
    min-width: 0;
}

.peer-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.peer-details {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    min-height: 0;
    line-height: 1.3;
    min-width: 0;
    padding-right: 0.5rem;
}

.peer-location {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 0;
    padding: 0.15rem 0;
    min-width: 0;
    flex: 1;
}

.peer-location i {
    color: #667eea;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.peer-provider {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-height: 0;
    padding: 0.15rem 0;
    min-width: 0;
    flex: 1;
}

.peer-provider i {
    color: #764ba2;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Provider Legend */
.provider-legend {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.provider-legend h4 {
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.legend-provider {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legend-count {
    color: #667eea;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    overflow-y: auto;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.chart-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    min-height: 480px;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chart-section:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.chart-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #e8b4cb, #b4d4e8, #b8e6b8);
    opacity: 0.6;
    border-radius: 12px 12px 0 0;
}

.chart-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-color-primary);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-medium);
    text-align: center;
    position: relative;
    z-index: 2;
    letter-spacing: var(--letter-spacing-normal);
    font-family: var(--font-family-primary);
}

.chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 1rem;
    min-height: 320px;
    max-height: 380px;
    overflow: visible;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chart-container canvas {
    max-height: 260px;
    width: auto;
    height: auto;
}

#countriesChart, #providersChart {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.5rem;
}

/* Modern chart styling enhancements */
.chart-container canvas {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
}

/* 3D Chart Styles */
.chart-container canvas {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

/* Chart Legend Styles */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    max-width: 100%;
    overflow: visible;
    width: 100%;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    flex-shrink: 0;
    max-width: 120px;
    min-width: 60px;
    word-break: break-word;
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    opacity: 0.8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-label {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.legend-percentage {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
    font-size: 0.7rem;
}

/* Pastel Color Palette for Charts */
.chart-pastel-colors {
    --pastel-pink: rgba(232, 180, 203, 0.8);
    --pastel-blue: rgba(180, 212, 232, 0.8);
    --pastel-green: rgba(184, 230, 184, 0.8);
    --pastel-yellow: rgba(255, 236, 179, 0.8);
    --pastel-purple: rgba(213, 180, 232, 0.8);
    --pastel-orange: rgba(255, 204, 179, 0.8);
    --pastel-cyan: rgba(179, 229, 252, 0.8);
    --pastel-lime: rgba(220, 237, 193, 0.8);
}

/* Chart loading state */
.chart-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: chartSpin 1s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chart-container.loading::before {
    opacity: 1;
}

@keyframes chartSpin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Chart section animations */
.chart-section {
    animation: chartFadeIn 0.4s ease-out;
}

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

/* Chart section stagger animation */
.chart-section:nth-child(1) {
    animation-delay: 0.05s;
}

.chart-section:nth-child(2) {
    animation-delay: 0.1s;
}

/* Map Container */
.map-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.map-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-controls {
    display: flex;
    gap: 0.5rem;
}

.control-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.control-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.validator-links-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.validator-links-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#map {
    flex: 1;
    width: 100%;
    height: 100%;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.map-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100vh;
    min-height: 600px;
    overflow: hidden;
}

/* Ensure map container has proper dimensions */
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.close-btn:hover {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: 60vh;
}

.peer-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
}

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

.peer-detail-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    min-width: 120px;
}

.peer-detail-value {
    color: #ffffff;
    text-align: right;
    flex: 1;
    margin-left: 1rem;
    word-break: break-word;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Leaflet map styling */
.leaflet-container {
    background: #1a1a1a !important;
    border-radius: 0 0 12px 12px;
}

.leaflet-marker-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Leaflet Popup Container */
.leaflet-popup {
    background: transparent;
    border: none;
    box-shadow: none;
}

.leaflet-popup-content-wrapper {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.9) 100%);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-content {
    color: #ffffff;
    font-family: var(--font-family-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 1rem;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.85) 100%);
    border-radius: 8px;
    padding: 0.5rem;
}

.leaflet-popup-tip {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85) 0%, rgba(30, 41, 59, 0.9) 100%);
    border: 1px solid rgba(102, 126, 234, 0.4);
}

.leaflet-popup-close-button {
    color: #667eea !important;
    font-size: 1.2rem !important;
    font-weight: bold !important;
    transition: all 0.3s ease;
}

.leaflet-popup-close-button:hover {
    color: #764ba2 !important;
    transform: scale(1.1);
}

.peer-popup-info {
    min-width: 200px;
}

.peer-popup-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #667eea;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.peer-popup-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
}

.peer-popup-validator {
    color: #22c55e;
    font-weight: 600;
}

.peer-popup-country {
    color: #3b82f6;
    font-weight: 500;
}

.peer-popup-provider {
    color: #8b5cf6;
    font-weight: 500;
}

/* Hide invalid markers */
.leaflet-marker-icon[style*="display: none"] {
    display: none !important;
}

.leaflet-marker-icon[style*="visibility: hidden"] {
    visibility: hidden !important;
}

.leaflet-marker-icon[style*="opacity: 0"] {
    opacity: 0 !important;
}

/* Validator specific styling */
.validator-marker {
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.5));
}

.validator-marker::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    opacity: 0.3;
    animation: validatorPulse 2s infinite;
}

@keyframes validatorPulse {
    0% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.2); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.3; }
}

/* Hide Leaflet attribution */
.leaflet-control-attribution {
    display: none !important;
}

/* Mobile optimization for right sidebar */
@media (max-width: 768px) {
    .right-sidebar {
        width: 100%;
        max-width: 100vw;
        right: 0;
        transform: translateX(100%);
    }
    
    .right-sidebar.show {
        transform: translateX(0);
    }
    
    .right-sidebar-header {
        padding: 1rem;
    }
    
    .right-sidebar-header h3 {
        font-size: 1.1rem;
    }
    
    .right-sidebar-content {
        padding: 0.75rem;
    }
    
    .toggle-sidebar-btn {
        position: fixed;
        top: 50%;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .right-sidebar {
        width: 100%;
        max-width: 100vw;
    }
    
    .right-sidebar-header {
        padding: 0.75rem;
    }
    
    .right-sidebar-header h3 {
        font-size: 1rem;
    }
    
    .right-sidebar-content {
        padding: 0.5rem;
    }
    
    .toggle-sidebar-btn {
        width: 40px;
        height: 40px;
        right: 10px;
        font-size: 1rem;
    }
}

/* Mobile optimization for close button */
@media (max-width: 768px) {
    .close-sidebar-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }
    
    .close-sidebar-btn span {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .close-sidebar-btn {
        padding: 0.5rem 0.7rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }
    
    .close-sidebar-btn span {
        font-size: 0.75rem;
    }
    
    .close-sidebar-btn i {
        font-size: 0.8rem;
    }
}

/* Responsive design */
@media (max-width: 1200px) {
    .sidebar {
        width: 340px;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.3rem;
    }
    
    .charts-section {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .chart-section {
        padding: 1.2rem;
        min-height: 440px;
        height: auto;
    }
    
    .chart-section h3 {
        font-size: 1.1rem;
    }
    
    .chart-container {
        min-height: 280px;
        max-height: 340px;
        padding: 0.8rem;
    }
    
    .chart-container canvas {
        max-height: 240px;
    }
    
    .chart-legend {
        gap: 0.4rem;
        padding: 0.3rem;
        margin-top: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.7rem;
        padding: 0.15rem 0.3rem;
        max-width: 110px;
        min-width: 65px;
    }
    
    .legend-label {
        font-size: 0.65rem;
    }
    
    .legend-percentage {
        font-size: 0.65rem;
    }
}

@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
        height: 100vh;
        overflow: hidden;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        min-height: 300px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sidebar-header {
        padding: 1.5rem;
    }
    
    .logo-text h1 {
        font-size: 1.3rem;
    }
    
    .sidebar-content {
        padding: 1rem;
        gap: 1rem;
    }
    
    .peers-list-section {
        display: none;
    }
    
    .peers-list {
        display: none;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
        min-height: 60px;
    }
    
    .stat-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .main-content {
        flex: 1;
        height: 50vh;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .map-container {
        flex: 1;
        min-height: 300px;
        height: auto;
    }
    
    .map-header {
        padding: 1rem;
    }
    
    .map-header h2 {
        font-size: 1.1rem;
    }
    
    .control-btn {
        width: 36px;
        height: 36px;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .chart-section {
        min-height: 380px;
        height: auto;
        padding: 1.2rem;
        border-radius: 10px;
    }
    
    .chart-section h3 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
    
    .chart-container {
        min-height: 240px;
        max-height: 280px;
        padding: 0.8rem;
        border-radius: 8px;
    }
    
    .chart-container canvas {
        max-height: 200px;
    }
    
    .chart-legend {
        gap: 0.3rem;
        padding: 0.25rem;
        margin-top: 0.6rem;
    }
    
    .legend-item {
        font-size: 0.65rem;
        padding: 0.1rem 0.25rem;
        max-width: 90px;
        min-width: 55px;
    }
    
    .legend-label {
        font-size: 0.6rem;
    }
    
    .legend-percentage {
        font-size: 0.6rem;
    }
    
    .peer-item {
        padding: 1rem;
        min-height: 100px;
    }
    
    .peer-actions {
        margin-top: 0.75rem;
    }
    
    .focus-btn, .details-btn {
        min-width: 40px;
        height: 40px;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        max-height: 45vh;
        min-height: 250px;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .logo {
        gap: 0.75rem;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .logo-text h1 {
        font-size: 1.1rem;
    }
    
    .logo-text p {
        font-size: 0.8rem;
    }
    
    .sidebar-content {
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.5rem;
        min-height: 50px;
    }
    
    .stat-icon {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .connection-status {
        padding: 0.75rem;
    }
    
    .status-indicator {
        font-size: 0.8rem;
    }
    
    .search-box input {
        padding: 0.5rem 0.75rem 0.5rem 2rem;
        font-size: 0.8rem;
    }
    
    .search-box i {
        left: 0.75rem;
        font-size: 0.8rem;
    }
    
    .validator-toggle-section {
        padding: 0.75rem;
    }
    
    .toggle-container {
        padding: 0.6rem;
        gap: 0.6rem;
    }
    
    .toggle-switch {
        width: 45px;
        height: 24px;
    }
    
    .toggle-slider:before {
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(21px);
    }
    
    .toggle-label {
        font-size: 0.8rem;
    }
    
    .section-header h3 {
        font-size: 1rem;
    }
    
    .refresh-btn {
        width: 36px;
        height: 36px;
    }
    
    .peer-item {
        padding: 0.75rem;
        min-height: 90px;
    }
    
    .peer-name {
        font-size: 0.9rem;
    }
    
    .peer-details {
        font-size: 0.75rem;
    }
    
    .peer-actions {
        margin-top: 0.75rem;
    }
    
    .focus-btn, .details-btn {
        min-width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
    
    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .map-header {
        padding: 0.75rem;
    }
    
    .map-header h2 {
        font-size: 1rem;
    }
    
    .map-controls {
        gap: 0.25rem;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .charts-section {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .chart-section {
        min-height: 320px;
        height: auto;
        padding: 1rem;
        border-radius: 8px;
    }
    
    .chart-section h3 {
        font-size: 0.9rem;
        margin-bottom: 0.6rem;
    }
    
    .chart-container {
        min-height: 200px;
        max-height: 240px;
        padding: 0.6rem;
        border-radius: 6px;
    }
    
    .chart-container canvas {
        max-height: 160px;
    }
    
    .chart-legend {
        gap: 0.25rem;
        padding: 0.2rem;
        margin-top: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.6rem;
        padding: 0.08rem 0.2rem;
        max-width: 75px;
        min-width: 45px;
    }
    
    .legend-label {
        font-size: 0.55rem;
    }
    
    .legend-percentage {
        font-size: 0.55rem;
    }
    
    .legend-color {
        width: 8px;
        height: 8px;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .peer-detail-item {
        padding: 0.5rem 0;
        font-size: 0.85rem;
    }
    
    .peer-detail-label {
        font-size: 0.8rem;
    }
    
    .peer-detail-value {
        font-size: 0.85rem;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        min-height: 45px;
    }
    
    .sidebar {
        max-height: 40vh;
    }
    
    .main-content {
        height: 60vh;
    }
    
    .chart-section {
        min-height: 200px;
        height: auto;
        padding: 0.8rem;
    }
    
    .chart-container {
        min-height: 150px;
        max-height: 180px;
        padding: 0.5rem;
    }
    
    .chart-legend {
        gap: 0.2rem;
        padding: 0.15rem;
        margin-top: 0.4rem;
    }
    
    .legend-item {
        font-size: 0.55rem;
        padding: 0.05rem 0.15rem;
        max-width: 65px;
        min-width: 40px;
    }
    
    .legend-label {
        font-size: 0.5rem;
    }
    
    .legend-percentage {
        font-size: 0.5rem;
    }
    
    .legend-color {
        width: 6px;
        height: 6px;
    }
}

/* Landscape orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        max-height: 35vh;
        min-height: 200px;
    }
    
    .main-content {
        height: 65vh;
    }
    
    .stats-cards {
        grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
        gap: 0.25rem;
    }
    
    .stat-card {
        min-height: 40px;
        padding: 0.5rem;
    }
    
    .stat-value {
        font-size: 0.8rem;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    .chart-section {
        min-height: 140px;
        height: auto;
        padding: 0.8rem;
    }
    
    .chart-container {
        min-height: 80px;
        max-height: 100px;
        padding: 0.4rem;
    }
    
    .chart-legend {
        gap: 0.15rem;
        padding: 0.1rem;
        margin-top: 0.3rem;
    }
    
    .legend-item {
        font-size: 0.5rem;
        padding: 0.03rem 0.1rem;
        max-width: 50px;
        min-width: 30px;
    }
    
    .legend-label {
        font-size: 0.45rem;
    }
    
    .legend-percentage {
        font-size: 0.45rem;
    }
    
    .legend-color {
        width: 5px;
        height: 5px;
    }
}

/* Network Switching Overlay */
.network-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.network-overlay.show {
    display: flex;
}

.overlay-content {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.98) 100%);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    min-width: 320px;
    max-width: 90vw;
    color: #fff;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.overlay-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.overlay-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.overlay-phrase {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    min-height: 1.2em;
}