/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --download-color: #10b981;
    --upload-color: #3b82f6;
    --ping-color: #f59e0b;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-color);
}

.logo {
    font-size: 2.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    padding: 3rem 0;
}

.test-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: start;
}

/* Test Info */
.test-info {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
}

.test-info h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.test-info p {
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.info-box {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.info-box h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-box h3 i {
    color: var(--primary-color);
}

.info-box ul {
    list-style: none;
    padding-left: 0;
}

.info-box ul li {
    padding: 0.5rem 0;
    color: var(--text-light);
    line-height: 1.6;
}

.info-box ul li strong {
    color: var(--text-color);
}

/* Test Interface */
.test-interface {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.test-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text-color);
    font-weight: 600;
}

.test-status i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.test-status.running i {
    animation: spin 1s linear infinite;
    color: var(--warning-color);
}

.test-status.completed i {
    color: var(--success-color);
}

.btn {
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: inherit;
}

.btn-large {
    padding: 18px 50px;
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* Progress */
.test-progress {
    margin: 2rem 0;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 15px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

.progress-text {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Live Stats */
.live-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.download {
    background: var(--download-color);
}

.stat-icon.upload {
    background: var(--upload-color);
}

.stat-icon.ping {
    background: var(--ping-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.3rem;
}

.stat-unit {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Test Results */
.test-results {
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}

.test-results h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.result-card.download-card {
    border-top: 4px solid var(--download-color);
}

.result-card.upload-card {
    border-top: 4px solid var(--upload-color);
}

.result-card.ping-card {
    border-top: 4px solid var(--ping-color);
}

.result-card.latency-card {
    border-top: 4px solid var(--warning-color);
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.download-card .result-icon {
    color: var(--download-color);
}

.upload-card .result-icon {
    color: var(--upload-color);
}

.ping-card .result-icon {
    color: var(--ping-color);
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.3rem;
}

.result-unit {
    font-size: 1rem;
    color: var(--text-light);
}

.grade-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
}

.grade-card .result-icon,
.grade-card .result-label,
.grade-card .result-value,
.grade-card .result-unit {
    color: white;
}

.result-grade {
    font-size: 4rem;
    font-weight: bold;
    margin: 0.5rem 0;
}

.result-description {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-top: 0.5rem;
}

/* Chart */
.test-chart {
    margin: 2rem 0;
    background: var(--bg-light);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.test-chart canvas {
    max-width: 100%;
    height: auto;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 968px) {
    .test-wrapper {
        grid-template-columns: 1fr;
    }

    .live-stats {
        grid-template-columns: 1fr;
    }

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

    .grade-card {
        grid-column: 1;
    }
}

@media (max-width: 600px) {
    .logo {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .test-info,
    .test-interface {
        padding: 1.5rem;
    }
}
