/* ==========================================
   SPEED TEST - STYLESHEET
   Design inspirado no Speedtest.net
   ========================================== */

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121218;
    --bg-card: rgba(26, 26, 46, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;
    --accent-cyan: #00d4ff;
    --accent-purple: #7b2cbf;
    --accent-pink: #ff006e;
    --accent-green: #00ff88;
    --border-color: rgba(255, 255, 255, 0.1);
    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.5);
    --glow-purple: 0 0 20px rgba(123, 44, 191, 0.5);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Background gradient effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(123, 44, 191, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Speedometer Container */
.speedometer-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speedometer {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.2));
}

.gauge-bg {
    opacity: 0.5;
}

.gauge-fill {
    transition: stroke-dashoffset 0.1s ease-out;
}

.pointer-group {
    transition: transform 0.1s ease-out;
    transform-origin: 150px 170px;
}

.pointer {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.8));
}

.scale-marks text {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

/* Speed Display */
.speed-display {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.speed-value {
    display: block;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.speed-unit {
    display: block;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.25rem;
}

/* Status */
.status {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 1rem;
    min-height: 1.5rem;
    transition: color 0.3s ease;
}

.status.testing {
    color: var(--accent-cyan);
}

.status.complete {
    color: var(--accent-green);
}

/* Start Button */
.start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--glow-purple);
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.start-btn:hover::before {
    left: 100%;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--glow-cyan), var(--glow-purple);
}

.start-btn:active {
    transform: scale(0.98);
}

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

.start-btn:disabled:hover::before {
    left: -100%;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.start-btn.testing .btn-icon svg {
    animation: spin 1s linear infinite;
}

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

/* Pulse animation for idle state */
.start-btn:not(:disabled) {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: var(--glow-purple); }
    50% { box-shadow: var(--glow-cyan), var(--glow-purple); }
}

.start-btn:disabled {
    animation: none;
}

/* Results Container */
.results-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    pointer-events: none;
}

.results-container.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Result Card */
.result-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.result-card.active {
    border-color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

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

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

.result-icon.download {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-green);
}

.result-icon.upload {
    background: rgba(123, 44, 191, 0.1);
    color: var(--accent-purple);
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

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

/* User Info */
.user-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.info-label {
    color: var(--text-muted);
    font-weight: 500;
}

.info-value {
    color: var(--text-secondary);
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    margin-top: auto;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

/* Tablet */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.75rem;
    }

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

    .results-container {
        gap: 0.75rem;
    }

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

    .result-value {
        font-size: 1.5rem;
    }

    .user-info {
        gap: 1rem;
        padding: 0.875rem;
    }

    .info-item {
        font-size: 0.8125rem;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .header p {
        font-size: 0.875rem;
    }

    .speedometer-container {
        max-width: 320px;
    }

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

    .speed-unit {
        font-size: 0.875rem;
    }

    .status {
        font-size: 1rem;
    }

    .start-btn {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }

    .results-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        max-width: 280px;
    }

    .result-card {
        display: flex;
        align-items: center;
        padding: 1rem;
        gap: 1rem;
    }

    .result-icon {
        margin: 0;
        flex-shrink: 0;
    }

    .result-label {
        margin-bottom: 0;
        text-align: left;
    }

    .result-value {
        font-size: 1.75rem;
        text-align: right;
        margin-left: auto;
        margin-bottom: 0;
    }

    .result-unit {
        position: absolute;
        opacity: 0;
    }

    .result-card {
        position: relative;
    }

    .result-card::after {
        content: attr(data-unit);
        position: absolute;
        right: 1rem;
        bottom: 0.5rem;
        font-size: 0.75rem;
        color: var(--text-secondary);
    }

    .user-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .info-item {
        width: 100%;
        justify-content: space-between;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */

/* Loading state for user info */
.info-value[data-loading="true"] {
    position: relative;
    color: transparent;
}

.info-value[data-loading="true"]::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 12px;
    background: linear-gradient(90deg, var(--bg-secondary), var(--text-muted), var(--bg-secondary));
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

.main-content > * {
    animation: fadeIn 0.6s ease-out backwards;
}

.main-content > *:nth-child(1) { animation-delay: 0.1s; }
.main-content > *:nth-child(2) { animation-delay: 0.2s; }
.main-content > *:nth-child(3) { animation-delay: 0.3s; }
.main-content > *:nth-child(4) { animation-delay: 0.4s; }
