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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.network-change-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: white;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: #2c3e50;
}

h1 a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.2s ease;
}

h1 a:hover {
    color: #007bff;
    text-decoration: underline;
}

.attribution {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.attribution a {
    color: #007bff;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

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

.stat-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-card p {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.stat-card small {
    color: #999;
    font-size: 12px;
}

.controls {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.time-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.time-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.time-btn:hover {
    background: #f8f9fa;
}

.time-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.network-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.network-selector label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.network-selector select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    min-width: 150px;
}

.network-selector select:hover {
    border-color: #999;
}

.network-selector select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

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

.auto-refresh-label {
    font-size: 14px;
    color: #666;
}

.refresh-status {
    font-size: 12px;
    color: #999;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #007bff;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.info {
    font-size: 14px;
    color: #666;
}

.charts {
    display: grid;
    gap: 30px;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chart-container h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #2c3e50;
}

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

.chart-header h2 {
    margin: 0;
}

.speed-test-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-test-btn:hover {
    background-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.speed-test-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.speed-test-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.speed-test-btn.running {
    background-color: #ffc107;
    color: #212529;
}

.speed-test-btn.running::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #212529;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

canvas {
    max-height: 300px;
}

@media (max-width: 768px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-buttons {
        justify-content: center;
    }
    
    .controls-right {
        flex-direction: column;
        gap: 10px;
    }
    
    .info {
        text-align: center;
    }
}