/* CSS Variables for theming */
.typing-test-container {
    --bg-color: #ffffff;
    --text-color: #333333;
    --primary-color: #007cba;
    --secondary-color: #f0f0f0;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --current-color: #ffc107;
    --border-color: #dddddd;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Dark theme */
.typing-test-container[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --primary-color: #4a9eff;
    --secondary-color: #2d2d2d;
    --correct-color: #28a745;
    --incorrect-color: #dc3545;
    --current-color: #ffc107;
    --border-color: #444444;
    --shadow-color: rgba(255, 255, 255, 0.1);
}

/* High contrast theme */
.typing-test-container[data-theme="high-contrast"] {
    --bg-color: #000000;
    --text-color: #ffffff;
    --primary-color: #ffff00;
    --secondary-color: #333333;
    --correct-color: #00ff00;
    --incorrect-color: #ff0000;
    --current-color: #ffff00;
    --border-color: #ffffff;
    --shadow-color: rgba(255, 255, 255, 0.3);
}

/* Base styles */
.typing-test-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.typing-test-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 20px;
    border-radius: 10px;
}

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

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.duration-selector,
.theme-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls label {
    font-weight: 600;
}

.controls select {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    cursor: pointer;
}

.start-button,
.reset-button {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.start-button:hover,
.reset-button:hover {
    opacity: 0.9;
}

.start-button:disabled,
.reset-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Test Info */
.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--secondary-color);
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.timer {
    font-size: 1.5rem;
    font-weight: 700;
}

.stats {
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 5px;
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Typing Area */
.typing-area {
    margin-bottom: 30px;
}

.text-display {
    background-color: var(--secondary-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 30px;
    font-size: 1.2rem;
    line-height: 1.8;
    min-height: 200px;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
    overflow-y: auto;
    max-height: 400px;
}

.word {
    display: inline;
    margin-right: 0.3em;
}

.word.current {
    background-color: var(--current-color);
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
}

.word.correct {
    color: var(--correct-color);
}

.word.incorrect {
    color: var(--incorrect-color);
    text-decoration: underline;
}

.char.correct {
    color: var(--correct-color);
}

.char.incorrect {
    color: var(--incorrect-color);
    background-color: rgba(220, 53, 69, 0.2);
}

.char.current {
    background-color: var(--current-color);
    color: #000;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.typing-input {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-color);
    color: var(--text-color);
    outline: none;
}

.typing-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

.typing-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Modal */
.results-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-color);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 2rem;
}

.result-stats {
    margin-bottom: 30px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 600;
}

.result-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.try-again-button,
.close-modal-button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.try-again-button {
    background-color: var(--primary-color);
    color: white;
}

.close-modal-button {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.try-again-button:hover,
.close-modal-button:hover {
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .test-info {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .stats {
        gap: 20px;
    }
    
    .text-display {
        padding: 20px;
        font-size: 1.1rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .text-display {
        padding: 15px;
        font-size: 1rem;
    }
    
    .typing-input {
        padding: 12px;
        font-size: 1rem;
    }
}

