/* Speed Test Specific Styles */

/* Hero Section */
.speed-hero {
    background: var(--gradient-primary);
    padding: 20px 0 30px;
    position: relative;
    overflow: hidden;
}

.speed-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(251,245,242,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,149.3C960,160,1056,160,1152,138.7C1248,117,1344,75,1392,53.3L1440,32L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.5;
}

.speed-hero-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
}

.speed-hero-icon {
    font-size: 36px;
    margin-bottom: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.speed-hero-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.speed-hero-subtitle {
    font-size: 14px;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* Speed Test Container */
.speed-test-section {
    padding: 20px 0;
    background: var(--lighter-bg);
    min-height: 400px;
}

.speed-test-container {
    max-width: 950px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.speed-test-container.hidden {
    display: none;
}

/* Start Screen */
.start-screen-content {
    text-align: center;
    padding: 15px 10px;
}

.start-icon-wrapper {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(255, 54, 121, 0.3);
    animation: pulse 2s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-icon-wrapper:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 32px rgba(255, 54, 121, 0.4);
}

.start-icon-wrapper:active {
    transform: scale(0.95);
    box-shadow: 0 4px 16px rgba(255, 54, 121, 0.3);
}

.start-icon-wrapper i {
    font-size: 48px;
    color: white;
}

.start-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.start-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.start-test-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    margin-bottom: 10px;
}

.start-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.start-test-btn:active {
    transform: translateY(0);
}

.start-note {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 12px;
}

/* Testing Screen */
.testing-screen {
    text-align: center;
    position: relative;
}

/* Progress Popup */
.progress-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 32px 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 54, 121, 0.3);
    animation: popupFadeIn 0.3s ease;
    min-width: 200px;
}

.progress-popup-content {
    text-align: center;
    color: white;
}

.progress-popup-icon {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.progress-popup-percentage {
    font-size: 64px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(255, 54, 121, 0.5);
}

.progress-popup-label {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.test-header {
    margin-bottom: 16px;
}

.test-phase-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.test-phase-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Speed Gauge */
.speed-gauge-container {
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.speed-gauge-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.speed-gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-color);
    display: block;
    line-height: 1;
}

.gauge-unit {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 2px;
    display: block;
}

/* Progress Bar */
.test-progress-bar {
    width: 100%;
    height: 5px;
    background: var(--light-bg);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Test Stats Grid */
.test-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.test-stat-card {
    background: var(--light-bg);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.test-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    margin: 0 auto 6px;
}

.stat-label {
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Results Screen */
.results-screen {
    text-align: center;
}

.results-header {
    margin-bottom: 16px;
}

.results-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.connection-quality {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
}

.connection-quality.excellent {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success-color);
}

.connection-quality.good {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success-color);
}

.connection-quality.fair {
    background: rgba(253, 203, 110, 0.15);
    color: var(--warning-color);
}

.connection-quality.poor {
    background: rgba(255, 118, 117, 0.15);
    color: var(--danger-color);
}

/* Results Main */
.results-main {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.result-card {
    background: var(--light-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.result-card.primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
}

.result-card.primary .result-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.result-card.primary .result-label {
    color: rgba(255, 255, 255, 0.9);
}

.result-card.primary .result-value {
    color: white;
}

.result-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin: 0 auto 10px;
}

.result-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.result-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 4px;
}

.result-unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.result-value-small {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 4px;
}

.result-unit-small {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Results Secondary */
.results-secondary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.btn-test-again,
.btn-share {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-test-again {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-test-again:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-share {
    background: var(--light-bg);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-share:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* History Section */
.history-section {
    padding: 40px 0;
    background: var(--card-bg);
}

.history-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.btn-clear-history {
    padding: 10px 20px;
    background: var(--light-bg);
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-clear-history:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-2px);
}

.history-chart-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    height: 300px;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.history-item {
    background: var(--light-bg);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.history-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.history-item-date {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.history-item-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.history-stat {
    text-align: center;
}

.history-stat-label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.history-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

/* Info Section */
.speed-info-section {
    padding: 40px 0;
    background: var(--lighter-bg);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.info-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    text-align: center;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.info-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-md);
}

.info-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.info-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.speed-test-container {
    animation: fadeIn 0.5s ease;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .results-main {
        grid-template-columns: 1fr;
    }
    
    .results-secondary {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .test-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .speed-hero {
        padding: 15px 0 20px;
    }
    
    .speed-hero-title {
        font-size: 20px;
    }
    
    .speed-hero-subtitle {
        font-size: 13px;
    }
    
    .speed-test-container {
        padding: 20px 16px;
    }
    
    .start-icon-wrapper {
        width: 100px;
        height: 100px;
    }
    
    .start-icon-wrapper i {
        font-size: 40px;
    }
    
    .start-title {
        font-size: 18px;
    }
    
    .speed-gauge-wrapper {
        width: 180px;
        height: 180px;
    }
    
    .gauge-number {
        font-size: 28px;
    }
    
    .test-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .test-stat-card {
        padding: 10px;
    }
    
    .results-secondary {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .results-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-test-again,
    .btn-share {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }
    
    .history-chart-container {
        height: 250px;
        padding: 16px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .speed-hero-title {
        font-size: 18px;
    }
    
    .speed-test-container {
        padding: 16px 12px;
    }
    
    .start-icon-wrapper {
        width: 90px;
        height: 90px;
    }
    
    .start-icon-wrapper i {
        font-size: 36px;
    }
    
    .start-test-btn {
        padding: 10px 24px;
        font-size: 14px;
    }
    
    .speed-gauge-wrapper {
        width: 160px;
        height: 160px;
    }
    
    .gauge-number {
        font-size: 24px;
    }
    
    .gauge-unit {
        font-size: 11px;
    }
    
    .test-stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .results-secondary {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .result-value {
        font-size: 32px;
    }
    
    .result-value-small {
        font-size: 22px;
    }
    
    .history-chart-container {
        height: 200px;
        padding: 12px;
    }
}

