/* Speed Test Hero Styles */
.speedtest-hero {
    position: relative;
    overflow: hidden;
    min-height: 600px;
    padding: 0;
    background: linear-gradient(135deg, #0a0a2e 0%, #16163a 50%, #1a1a4a 100%);
    background-size: cover;
    background-position: center center;
}

.speedtest-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(217, 30, 43, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 70%);
    pointer-events: none;
}

/* Speed Graph Canvas */
.speedtest-graph-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.speedtest-hero.testing .speedtest-graph-canvas,
.speedtest-hero.completed .speedtest-graph-canvas {
    opacity: 1;
}

.speedtest-hero-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    transition: all 0.5s ease;
}

.speedtest-hero.completed .speedtest-hero-overlay {
    background-color: #0003;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.speedtest-hero .hero-layout {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    height: 100%;
    padding: 3rem 0;
}

/* Initial State */
.speedtest-hero .hero-initial {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    align-items: center;
    justify-content: center;
    transform: translateY(0);
    opacity: 1;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.speedtest-hero.testing .hero-initial,
.speedtest-hero.completed .hero-initial {
    transform: translateY(-50px);
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

.speedtest-hero .hero-title {
    color: #fff;
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.speedtest-hero .hero-subtitle {
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    margin: 0.5rem 0 1.5rem;
    font-size: 1.35rem;
    font-weight: 500;
}

.speedtest-hero .hero-note {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    max-width: 600px;
    margin: 1.5rem auto 0;
    font-size: 1rem;
    line-height: 1.6;
}

.speedtest-hero .hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 2.5rem;
    min-width: 200px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #ff3344 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.125rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(217, 30, 43, 0.4);
}

.speedtest-hero .hero-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(217, 30, 43, 0.5);
}

.speedtest-hero .hero-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Testing State */
.speedtest-hero .hero-testing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    position: absolute;
    width: 100%;
    height: 100%;
    inset: 0;
}

.speedtest-hero.testing .hero-testing {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Gauge Styles */
.speedtest-gauge {
    position: relative;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gauge-svg {
    display: none;
}


.gauge-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    color: #fff;
}

.gauge-value .speed-value {
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    display: inline-block;
    text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gauge-value .speed-unit {
    font-size: 2rem;
    font-weight: 600;
    opacity: 0.8;
    display: inline-block;
    vertical-align: baseline;
}

.gauge-label {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Phase Indicator */
.test-phase {
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    width: 100%;
    padding: 1rem 0;
    z-index: 10;
}

.phase-indicator {
    position: relative;
    display: flex;
    gap: 2rem;
    justify-content: center;
    min-height: 60px;
}

.phase-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.phase-icon.ping {
    position: absolute;
    left: 40%;
    transform: translateX(-50%);
}

.phase-icon.download {
    /* Centered naturally by flex */
}

.phase-icon.upload {
    position: absolute;
    right: 40%;
    transform: translateX(50%);
}

.phase-icon svg {
    width: 28px;
    height: 28px;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.phase-icon span {
    font-size: 0.875rem;
    font-weight: 600;
}

.phase-icon.active {
    color: #fff;
}

.phase-icon.active svg {
    animation: pulse 1s ease-in-out infinite;
}

.phase-icon.completed {
    color: #22c55e;
}

.phase-icon .phase-value {
    font-size: 1.125rem;
    font-weight: 700;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: phaseValueFadeIn 0.4s ease-out;
}

@keyframes phaseValueFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* Results State */
.speedtest-hero .hero-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    position: absolute;
    width: 100%;
}

.speedtest-hero.completed .hero-results {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    position: relative;
}

.results-main-layout {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
    width: 100%;
    max-width: 1000px;
}

.rating-score {
    text-align: center;
    flex-shrink: 0;
}

.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3);
    margin: 0 auto 1rem;
}

.score-circle.grade-a {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.3);
}

.score-circle.grade-b {
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    box-shadow: 0 8px 30px rgba(132, 204, 22, 0.3);
}

.score-circle.grade-c {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 8px 30px rgba(251, 191, 36, 0.3);
}

.score-circle.grade-d {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 8px 30px rgba(249, 115, 22, 0.3);
}

.score-circle.grade-f {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.3);
}

.score-value {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.score-label {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    opacity: 0.9;
}

.results-right-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    width: 100%;
}

.result-card {
    background: #000a;
    backdrop-filter: blur(10px);
    border: 1px solid #fff2;
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    background: #000c;
    transform: translateY(-2px);
}

.result-card .result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

.result-card.download .result-icon {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.result-card.upload .result-icon {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.result-card.ping .result-icon {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.result-card.jitter .result-icon {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.result-card .result-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-card .result-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.result-card .result-value small,
.result-card .result-unit {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.7;
}

/* Activity Rating Details */
.rating-details {
    display: flex;
    flex-direction: row;
    gap: 4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.rating-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rating-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.rating-card-icon svg {
    width: 100%;
    height: 100%;
    color: rgba(255, 255, 255, 0.9);
}

.rating-card-grade {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rating-card-grade.grade-a {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.rating-card-grade.grade-b {
    background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%);
    box-shadow: 0 4px 15px rgba(132, 204, 22, 0.3);
}

.rating-card-grade.grade-c {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.rating-card-grade.grade-d {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
}

.rating-card-grade.grade-f {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.results-info {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.results-info .result-ip {
    margin: 0;
    font-size: 1rem;
}

.results-info .result-ip strong {
    color: #fff;
    font-weight: 700;
}

.results-info .result-provider {
    margin: 0.25rem 0 0;
    font-size: 0.9rem;
    opacity: 0.7;
}


/* Gauge Animation */
@keyframes gaugeGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(217, 30, 43, 0.3));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(217, 30, 43, 0.5));
    }
}

.speedtest-hero.testing .gauge-svg {
    animation: gaugeGlow 2s ease-in-out infinite;
}

/* Speed color classes for gauge */
.gauge-fill.speed-slow {
    stroke: #ef4444;
}

.gauge-fill.speed-medium {
    stroke: #f59e0b;
}

.gauge-fill.speed-fast {
    stroke: #22c55e;
}

.gauge-fill.speed-ultra {
    stroke: #3b82f6;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .results-main-layout {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }

    .results-right-section {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 500px;
        margin: 0 auto;
    }

    .rating-details {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .speedtest-hero {
        min-height: 550px;
    }

    .speedtest-hero .hero-title {
        font-size: 2.25rem;
    }

    .speedtest-hero .hero-subtitle {
        font-size: 1.125rem;
    }

    .gauge-value .speed-value {
        font-size: 5rem;
    }

    .gauge-value .speed-unit {
        font-size: 1.5rem;
    }

    .gauge-label {
        font-size: 1rem;
    }

    .phase-indicator {
        gap: 1.25rem;
        min-height: 50px;
    }

    .phase-icon.ping {
        left: 10%;
    }

    .phase-icon.upload {
        right: 10%;
    }

    .result-card {
        padding: 1rem 0.75rem;
    }

    .result-card .result-value {
        font-size: 1.35rem;
    }

    .result-card .result-icon {
        width: 40px;
        height: 40px;
    }

    .score-circle {
        width: 120px;
        height: 120px;
    }

    .score-value {
        font-size: 3rem;
    }

    .rating-card-grade {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .rating-card-icon {
        width: 28px;
        height: 28px;
    }

    .rating-card {
        padding: 0.75rem;
        min-width: 70px;
    }
}

@media (max-width: 480px) {
    .speedtest-hero .hero-layout {
        padding: 2rem 0;
    }

    .speedtest-hero .hero-title {
        font-size: 1.875rem;
    }

    .gauge-value .speed-value {
        font-size: 4rem;
    }

    .gauge-value .speed-unit {
        font-size: 1.25rem;
    }

    .gauge-label {
        font-size: 0.875rem;
        bottom: -50px;
    }

    .results-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .result-card {
        padding: 0.75rem 0.5rem;
    }

    .result-card .result-value {
        font-size: 1.25rem;
    }

    .result-card .result-label {
        font-size: 0.7rem;
    }

    .phase-icon svg {
        width: 24px;
        height: 24px;
    }

    .phase-icon span {
        font-size: 0.75rem;
    }

    .phase-icon .phase-value {
        font-size: 0.9375rem;
        min-width: 24px;
        min-height: 24px;
    }

    .score-circle {
        width: 100px;
        height: 100px;
    }

    .score-value {
        font-size: 2.5rem;
    }

    .score-label {
        font-size: 0.875rem;
    }

    .rating-card-grade {
        width: 36px;
        height: 36px;
        font-size: 1.125rem;
    }

    .rating-card-icon {
        width: 24px;
        height: 24px;
    }

    .rating-card {
        padding: 0.625rem;
        min-width: 60px;
        gap: 0.5rem;
    }
}