:root {
    --primary-color: #3498db;
    --secondary-color: #2ecc71;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

header h1 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.speedtest-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.test-area {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.test-group {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 15px;
    margin: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.test-group h3 {
    color: #7f8c8d;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.test-result {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--dark-color);
}

.unit {
    font-size: 1rem;
    color: #7f8c8d;
    margin-left: 5px;
}

.progress-container {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    margin: 20px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.test-info {
    margin: 20px 0;
    text-align: center;
}

.test-info p {
    margin: 5px 0;
    color: #7f8c8d;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.results-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-top: 20px;
}

.results-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.result-label {
    display: block;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.result-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--dark-color);
}

.share-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.share-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: #f8f9fa;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: translateY(-3px);
}

.share-btn[data-network="facebook"] {
    background: #3b5998;
}

.share-btn[data-network="twitter"] {
    background: #1da1f2;
}

.share-btn[data-network="linkedin"] {
    background: #0077b5;
}

#copy-link {
    background: #7f8c8d;
}

footer {
    text-align: center;
    padding: 20px;
    background: var(--dark-color);
    color: white;
    margin-top: auto;
}

.hidden {
    display: none;
}

/* Ping animation */
.ping-test.active .test-result {
    animation: pulse 1.5s infinite;
}

/* Download animation */
.download-test.active .test-result {
    animation: pulse 0.8s infinite;
}

/* Upload animation */
.upload-test.active .test-result {
    animation: pulse 0.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Speedometer styles */
.speedometer-container {
    flex: 1;
    min-width: 200px;
    text-align: center;
    padding: 15px;
    margin: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.speedometer-container h3 {
    color: #7f8c8d;
    margin-bottom: 15px;
    font-size: 1rem;
}

.speedometer {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto;
}

.dial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        #e74c3c 0% 20%,
        #f39c12 20% 50%,
        #2ecc71 50% 100%
    );
    position: relative;
    overflow: hidden;
}

.dial::before {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    background: white;
    border-radius: 50%;
    top: 10%;
    left: 10%;
}

.needle {
    position: absolute;
    width: 3px;
    height: 45%;
    background: #95a5a6;
    left: 50%;
    top: 50%;
    transform-origin: bottom center;
    transform: rotate(-90deg);
    transition: transform 0.3s ease, background-color 0.3s ease;
    z-index: 10;
}

.speed-display {
    position: absolute;
    top: 60%;
    left: 0;
    right: 0;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark-color);
    z-index: 5;
}

.speedometer .unit {
    position: absolute;
    top: 75%;
    left: 0;
    right: 0;
    font-size: 0.9rem;
    color: #7f8c8d;
    z-index: 5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .test-area {
        flex-direction: column;
    }
    
    .test-group {
        min-width: 100%;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .speedometer {
        width: 120px;
        height: 120px;
    }
    
    .speed-display {
        font-size: 1.2rem;
    }
}