/* Network Speed Test - Custom Styles */

/* Speedometer container */
.speedometer-container {
    position: relative;
    margin: 0 auto;
    max-width: 500px;
}

.speedometer-value {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
}

/* Card hover effects */
#speedTestForm .card {
    transition: all 0.3s ease;
}

#speedTestForm .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Speed result cards */
#speedTestForm .card-body .display-6 {
    font-weight: 700;
    transition: all 0.3s ease;
}

/* Animated progress bars */
@keyframes progressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

#speedTestForm .progress-bar-animated {
    animation: progressPulse 1.5s ease-in-out infinite;
}

/* Custom progress bar colors */
#downloadProgress {
    background: linear-gradient(90deg, #198754, #20c997);
}

#uploadProgress {
    background: linear-gradient(90deg, #0d6efd, #0dcaf0);
}

#pingProgress {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

/* Button animations */
#speedTestForm .toolBtn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#speedTestForm .toolBtn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#speedTestForm .toolBtn:hover::before {
    width: 300px;
    height: 300px;
}

#speedTestForm .toolBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#speedTestForm .toolBtn:active {
    transform: translateY(0);
}

/* Status badge pulse animation */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

#statusBadge.bg-primary,
#statusBadge.bg-success {
    animation: badgePulse 2s ease-in-out infinite;
}

/* Icon animations */
@keyframes iconSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#speedTestForm .fsvg {
    transition: all 0.3s ease;
}

#speedTestForm .btn:hover .fsvg {
    transform: scale(1.1);
}

/* Chart container */
#historyChart {
    max-height: 300px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .speedometer-container {
        height: 220px !important;
    }

    #speedometerCanvas {
        width: 100% !important;
        height: auto !important;
        max-width: 400px;
    }

    .speedometer-value div:first-child {
        font-size: 2.5rem !important;
    }

    #speedTestForm .display-6 {
        font-size: 2rem;
    }

    #speedTestForm .card-body {
        padding: 1rem;
    }
}

/* Dark mode support */
[data-bs-theme="dark"] .speedometer-container canvas {
    filter: brightness(0.9);
}

[data-bs-theme="dark"] #speedTestForm .card {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] #speedTestForm .card:hover {
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .speedometer-value div:first-child {
    color: #0dcaf0 !important;
}

[data-bs-theme="dark"] .speedometer-value div:last-child {
    color: #adb5bd !important;
}

/* Smooth transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Loading spinner for IP detection */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Result cards icon colors */
#speedTestForm .card-body img.fsvg {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

#speedTestForm .card:hover img.fsvg {
    opacity: 1;
}

/* Share section fade-in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#shareSection {
    animation: fadeInUp 0.5s ease-out;
}

/* Smooth scroll for log */
#testLog {
    scroll-behavior: smooth;
}

/* Custom scrollbar for log textarea */
#testLog::-webkit-scrollbar {
    width: 8px;
}

#testLog::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#testLog::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#testLog::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-bs-theme="dark"] #testLog::-webkit-scrollbar-track {
    background: #2b3035;
}

[data-bs-theme="dark"] #testLog::-webkit-scrollbar-thumb {
    background: #555;
}

[data-bs-theme="dark"] #testLog::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Gradient text for speed values */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Pulse effect for active test */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

#startTestBtn.testing {
    animation: pulse 2s infinite;
}
