/* ================================
   CODETUDE SPEED TEST - STYLES
   ================================ */

.codetude-speed-test {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    padding: 20px;
}

/* Header */
.speed-test-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
}

.speed-test-header h1 {
    margin: 0 0 10px 0;
    font-size: 36px;
    font-weight: 700;
}

.speed-test-header p {
    margin: 0;
    font-size: 18px;
    opacity: 0.95;
}

/* Main Container */
.speed-test-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Cards */
.speed-test-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.speed-test-card h2 {
    margin: 0 0 20px 0;
    font-size: 22px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Speedometer */
.speedometer-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 30px auto;
}

.speedometer-gauge {
    width: 100%;
    height: 100%;
    border-radius: 30%;
    background: conic-gradient(from -90deg, #ad0000 0deg, #ffb100 60deg, #ffe200 120deg, #85ff00 180deg, #1e8577 240deg);
    position: relative;
    box-shadow: 0 8px 2px rgba(0,0,0,0.15);
}

.speedometer-gauge::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: white;
    border-radius: 50%;
}

.speedometer-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
}

.speedometer-value {
    font-size: 80px;
    font-weight: 700;
    color: #000;
    margin: 0;
}

.speedometer-unit {
    font-size: 18px;
    color: #666;
    margin: 5px 0 0 0;
}

.speedometer-needle {
    position: absolute;
    bottom: 50%;
    left: 50%;
    width: 4px;
    height: 45%;
    background: linear-gradient(to top, #333, #667eea);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 1s ease-out;
    border-radius: 2px 2px 0 0;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.speedometer-needle::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: #333;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Test Button */
.start-test-btn {
    background: #171e43;
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px #ff0000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 30px auto;
    width: fit-content;
}

.start-test-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.start-test-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.start-test-btn .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.stat-item {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-unit {
    font-size: 16px;
    color: #999;
    margin-left: 4px;
}

/* IP Info */
.ip-info-grid {
    display: grid;
    gap: 15px;
}

.ip-info-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.ip-info-icon {
    width: 40px;
    height: 40px;
    background: #171e43;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.ip-info-icon svg {
    stroke: white;
}

.ip-info-content {
    flex: 1;
}

.ip-info-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.ip-info-value {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.ip-info-value.large {
    font-size: 20px;
    color: #b71b1b;
}

/* Test Status */
.test-status {
    text-align: center;
    padding: 15px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 10px;
    margin-bottom: 20px;
    color: #1976d2;
    font-weight: 600;
}

.test-status.testing {
    background: #fff3e0;
    border-color: #ffb74d;
    color: #f57c00;
}

.test-status.complete {
    background: #e8f5e9;
    border-color: #81c784;
    color: #388e3c;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* History */
.test-history {
    margin-top: 30px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
}

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

.history-speeds {
    display: flex;
    gap: 20px;
}

.history-speed {
    font-size: 14px;
}

.history-speed strong {
    color: #667eea;
}

/* Full Width Card */
.speed-test-full-card {
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 968px) {
    .speed-test-container {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .speedometer-container {
        width: 250px;
        height: 250px;
    }
    
    .speedometer-value {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .speed-test-header h1 {
        font-size: 28px;
    }
    
    .speedometer-container {
        width: 200px;
        height: 200px;
    }
    
    .speedometer-value {
        font-size: 28px;
    }
    
    .start-test-btn {
        width: 100%;
    }
}

/* Loading Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
    } 
    40% { 
        transform: scale(1);
    }
}

/* Quality Badge */
.quality-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
}

.quality-excellent {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.quality-good {
    background: #e3f2fd;
/*     color: #1565c0; */
    border: 1px solid #64b5f6;
	margin-left: 10px;
}

.quality-fair {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffb74d;
}

.quality-poor {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #e57373;
}