/* Typing Speed Test - Modern Edition */

/* Base styles and CSS variables */
:root {
    --primary: #7C3AED;
    --primary-dark: #6D28D9;
    --primary-light: #DDD6FE;
    --success: #059669;
    --error: #DC2626;
    --surface: #ffffff;
    --surface-dark: #F9FAFB;
    --bg: #111827;
    --text: #F9FAFB;
    --text-secondary: #9CA3AF;
    --border-radius: 0.75rem;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --shadow-subtle: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    --glow: 0 0 20px rgba(124, 58, 237, 0.4);
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Base styles for the entire page */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(124, 58, 237, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.1) 0%, transparent 40%);
}

/* Main container for the typing test */
.container {
    width: 800px;
    padding: 3rem;
    background: rgba(17, 24, 39, 0.8);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-elevated);
    border: 1px solid rgba(124, 58, 237, 0.2);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, #8B5CF6 50%, #C084FC 100%);
}

/* Title styling */
h1 {
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--text);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    position: relative;
    display: inline-block;
    width: 100%;
}

h1::after {
    content: "";
    display: block;
    width: 80px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto;
    margin-top: 1rem;
}

/* Text prompt display area */
#prompt-text {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    margin: 1.5rem 0;
    line-height: 1.8;
    color: var(--text);
    padding: 1.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    min-height: 100px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
}

/* Progress bar styles */
.progress-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 1.5rem 0;
    overflow: hidden;
    position: relative;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #8B5CF6 100%);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

#progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shine 2s infinite;
}

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

/* Input field for typing */
#input-field {
    width: 100%;
    padding: 1.5rem;
    font-size: 1.125rem;
    font-family: var(--font-mono);
    margin: 1.5rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    resize: none;
    transition: all 0.2s ease;
    color: var(--text);
}

#input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

#input-field:disabled {
    background: rgba(255, 255, 255, 0.03);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Start button styling */
#start-btn {
    display: block;
    width: 100%;
    padding: 1.5rem;
    font-size: 1.125rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    margin: 1.5rem 0;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-subtle), var(--glow);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#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: 0.5s;
}

#start-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated), var(--glow);
}

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

#start-btn:active {
    transform: translateY(0);
}

#start-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
    box-shadow: none;
}

/* Results section styling */
#results {
    margin-top: 2.5rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.result-item {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-subtle);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.result-item:nth-child(2)::before {
    background: linear-gradient(180deg, var(--primary) 0%, #8B5CF6 100%);
}

.result-item:nth-child(3)::before {
    background: linear-gradient(180deg, #8B5CF6 0%, #C084FC 100%);
}

#results p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.result-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0.75rem;
}

#results span {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.result-value small {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* Character state classes */
.correct { 
    color: var(--success);
}

.incorrect { 
    color: var(--error);
    position: relative;
}

.incorrect::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--error);
}

.neutral { 
    color: var(--text-secondary);
    opacity: 0.7;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.6);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-8px);
    }
    100% {
        transform: translateY(0px);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.slide-up {
    opacity: 0;
    animation: slideUp 0.5s ease-out forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

.float {
    animation: float 6s ease-in-out infinite;
}

/* Countdown animation */
.countdown {
    font-size: 6rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    animation: pulse 1s infinite, float 2s ease-in-out infinite;
}

/* Result highlight effect */
@keyframes highlight {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
    }
    100% {
        transform: scale(1);
    }
}

.highlight {
    animation: highlight 0.5s ease-out;
}

/* Responsive design */
@media (max-width: 850px) {
    .container {
        width: 90%;
        padding: 2rem;
    }

    h1 {
        font-size: 2.25rem;
        margin-bottom: 2rem;
    }

    #prompt-text {
        font-size: 1.125rem;
        padding: 1.25rem;
    }

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

    .result-item::before {
        width: 100%;
        height: 4px;
        top: 0;
        left: 0;
    }

    #results span {
        font-size: 2rem;
    }
}

/* Social Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2.5rem;
}

.social-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.social-button svg {
    transition: all 0.3s ease;
}

.social-button.instagram:hover {
    background: #E4405F;
    border-color: #E4405F;
    box-shadow: 0 0 20px rgba(228, 64, 95, 0.4);
}

.social-button.linkedin:hover {
    background: #0077B5;
    border-color: #0077B5;
    box-shadow: 0 0 20px rgba(0, 119, 181, 0.4);
}

.social-button:hover svg {
    transform: scale(1.1);
}

.social-button span {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
} 