/* Main Container */
.typing-test-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header */
.typing-test-header {
    text-align: center;
    margin-bottom: 30px;
}

.typing-test-header h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.test-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.test-controls select,
.test-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.test-controls select {
    background: white;
    color: #333;
    min-width: 180px;
}

.test-controls button {
    background: #ff6b6b;
    color: white;
    min-width: 150px;
}

.test-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

/* Stats Bar */
.test-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Text Display */
.text-display-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.text-display {
    font-size: 1.3rem;
    line-height: 1.8;
    color: #333;
    min-height: 120px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

.char-correct {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 1px;
    border-radius: 3px;
}

.char-wrong {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    padding: 2px 1px;
    border-radius: 3px;
    text-decoration: line-through;
}

.char-current {
    background: #2196F3;
    color: white;
    padding: 2px 1px;
    border-radius: 3px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { background-color: #2196F3; }
    50% { background-color: #64b5f6; }
    100% { background-color: #2196F3; }
}

.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.3s ease;
}

/* Typing Input */
.typing-input {
    width: 100%;
    padding: 20px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 15px;
    resize: none;
    font-family: 'Courier New', monospace;
    margin-bottom: 25px;
    transition: border-color 0.3s ease;
}

.typing-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Test Actions */
.test-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.test-actions button {
    padding: 15px 40px;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.btn-start {
    background: linear-gradient(135deg, #4CAF50, #2E7D32);
    color: white;
}

.btn-pause {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

.btn-resume {
    background: linear-gradient(135deg, #2196F3, #1565C0);
    color: white;
}

.test-actions button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Results Container */
.results-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.results-container h3 {
    text-align: center;
    color: #333;
    font-size: 2rem;
    margin-bottom: 30px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    color: white;
    transition: transform 0.3s ease;
}

.result-card:hover {
    transform: translateY(-5px);
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.result-value {
    font-size: 2.8rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.result-label {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.results-actions button {
    padding: 12px 30px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.btn-save {
    background: #4CAF50;
    color: white;
}

.btn-share {
    background: #2196F3;
    color: white;
}

.btn-try-again {
    background: #FF9800;
    color: white;
}

.results-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Save Form */
.save-form {
    text-align: center;
    margin-top: 20px;
}

.save-form input {
    padding: 15px;
    width: 300px;
    max-width: 100%;
    border: 2px solid #ddd;
    border-radius: 50px;
    font-size: 16px;
    margin-right: 10px;
    margin-bottom: 10px;
}

.save-form button {
    padding: 15px 30px;
    background: #333;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    cursor: pointer;
}

.save-message {
    margin-top: 15px;
    min-height: 25px;
}

.save-message .success {
    color: #4CAF50;
    font-weight: bold;
}

.save-message .error {
    color: #f44336;
    font-weight: bold;
}

/* Leaderboard */
.typing-leaderboard {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.typing-leaderboard h3 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8rem;
}

.leaderboard-table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px 150px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    padding: 20px;
    text-align: center;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 80px 1fr 120px 120px 150px;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    text-align: center;
    align-items: center;
    transition: background 0.3s ease;
}

.leaderboard-row:hover {
    background: #f8f9fa;
}

.leaderboard-row.top-1 {
    background: linear-gradient(135deg, #FFD700, #FFC400);
    color: #333;
    font-weight: bold;
}

.leaderboard-row.top-2 {
    background: linear-gradient(135deg, #C0C0C0, #B0B0B0);
    color: #333;
    font-weight: bold;
}

.leaderboard-row.top-3 {
    background: linear-gradient(135deg, #CD7F32, #B87333);
    color: white;
    font-weight: bold;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
    .typing-test-container {
        padding: 20px;
        border-radius: 15px;
    }
    
    .typing-test-header h2 {
        font-size: 2rem;
    }
    
    .test-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .test-controls select,
    .test-controls button {
        width: 100%;
        max-width: 300px;
    }
    
    .test-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .text-display {
        font-size: 1.1rem;
        min-height: 150px;
    }
    
    .test-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .test-actions button {
        width: 100%;
        max-width: 300px;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 60px 1fr 100px 100px 120px;
        font-size: 0.9rem;
        padding: 15px 10px;
    }
    
    .save-form input {
        width: 100%;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .save-form button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .test-stats {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .leaderboard-header,
    .leaderboard-row {
        grid-template-columns: 50px 1fr 80px 80px 100px;
        font-size: 0.8rem;
    }
}
/* Character Highlighting Styles */
.char-default {
    color: #636e72;
    transition: all 0.2s ease;
}

.char-upcoming {
    color: #74b9ff;
    background: rgba(116, 185, 255, 0.1);
    padding: 2px 1px;
    border-radius: 3px;
    font-weight: 600;
}

.char-current {
    background: #0984e3;
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: bold;
    position: relative;
    animation: currentPulse 1.5s infinite;
    box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.3);
}

.char-correct {
    color: #00b894;
    background: rgba(0, 184, 148, 0.08);
    padding: 2px 1px;
    border-radius: 3px;
    font-weight: 500;
}

.char-wrong {
    color: #d63031;
    background: rgba(214, 48, 49, 0.1);
    padding: 2px 1px;
    border-radius: 3px;
    position: relative;
    font-weight: 500;
}

.char-wrong::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #d63031;
    border-radius: 1px;
    opacity: 0.7;
}

.char-space {
    padding: 0 2px;
}

.char-space.char-correct {
    background: rgba(0, 184, 148, 0.15);
}

.char-space.char-wrong {
    background: rgba(214, 48, 49, 0.15);
}

.char-space.char-current {
    background: rgba(9, 132, 227, 0.3);
    color: #0984e3;
}

/* Word Highlighting */
.word-current {
    background: rgba(116, 185, 255, 0.15);
    border-radius: 4px;
    padding: 2px 0;
}

/* Animations */
@keyframes currentPulse {
    0%, 100% { 
        box-shadow: 0 0 0 2px rgba(9, 132, 227, 0.3);
        background: #0984e3;
    }
    50% { 
        box-shadow: 0 0 0 4px rgba(9, 132, 227, 0.5);
        background: #74b9ff;
    }
}

@keyframes correctGlow {
    0% { 
        background: rgba(0, 184, 148, 0.08);
        color: #00b894;
    }
    50% { 
        background: rgba(0, 184, 148, 0.2);
        color: #00a085;
    }
    100% { 
        background: rgba(0, 184, 148, 0.08);
        color: #00b894;
    }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Apply animations on specific events */
.char-correct.animate {
    animation: correctGlow 0.5s ease;
}

.char-wrong.animate {
    animation: wrongShake 0.3s ease;
}

/* Cursor animation */
.text-display {
    position: relative;
}

.text-display::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(transparent, #0984e3, transparent);
    opacity: 0;
    animation: cursorBlink 1.5s infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}