/* ========================================
   Typing Test Interface Styles
   ======================================== */

.typing-test-page {
    padding-top: 0;
}

.stats-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stats-bar .stat-item {
    text-align: center;
}

.stats-bar .stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    color: #667eea;
}

.stats-bar .stat-label {
    font-size: 0.85rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    display: block;
}

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

.test-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: var(--box-shadow-lg);
}

.test-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   Typing Area
   ======================================== */

.typing-area {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    position: relative;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.test-title-display {
    position: absolute;
    top: 20px;
    left: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    z-index: 10;
}

.test-controls-top-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.test-controls-top-center .btn-warning {
    background: #FF5722;
    color: #fff;
    border: none;
}

.test-controls-top-center .btn-warning:hover {
    background: #E64A19;
    color: #fff;
}

.test-controls-top-center .btn-secondary {
    background: #800080;
    border: none;
    color: #fff;
}

.test-controls-top-center .btn-secondary:hover {
    background: #660066;
    color: #fff;
}

.test-controls-center {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.text-display {
    font-size: 1.4rem;
    line-height: 1.8;
    font-family: 'Georgia', 'Times New Roman', serif;
    padding: 30px;
    background: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    min-height: 180px;
    max-height: 300px;
    overflow-y: auto;
    user-select: none;
    word-wrap: break-word;
    white-space: pre-wrap;
    margin-top: 50px;
}

.text-display span {
    position: relative;
    transition: all 0.1s ease;
}

.text-display span.current {
    background-color: #ffd700;
    font-weight: 600;
}

.text-display span.correct {
    color: #198754;
    font-weight: 500;
}

.text-display span.incorrect {
    color: #dc3545;
    background-color: #ffe6e6;
    font-weight: 600;
    text-decoration: underline;
}

.text-display span.untyped {
    color: #495057;
}

/* ========================================
   Input Area
   ======================================== */

.typing-input {
    width: 100%;
    padding: 18px 20px;
    font-size: 1.3rem;
    font-family: 'Georgia', 'Times New Roman', serif;
    border: 3px solid #0d6efd;
    border-radius: var(--border-radius);
    transition: var(--transition);
    background-color: #f8f9fa;
    resize: none;
    overflow-y: auto;
    max-height: 120px;
    min-height: 60px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.typing-input:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.3rem rgba(13, 110, 253, 0.25);
    background-color: #ffffff;
}

.typing-input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    border-color: #dee2e6;
}

/* ========================================
   Timer and Controls
   ======================================== */

.timer-display {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.3rem;
    font-weight: 600;
    color: #0d6efd;
    background: #ffffff;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1.5px solid #0d6efd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 10;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.timer-display.warning {
    color: var(--warning-color);
    animation: pulse 1s infinite;
}

.timer-display.danger {
    color: var(--danger-color);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.test-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.test-controls-inline {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.control-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    transition: var(--transition);
}

.control-btn:hover {
    transform: translateY(-2px);
}

/* ========================================
   Results Modal/Section
   ======================================== */

.results-container {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.results-header {
    text-align: center;
    margin-bottom: 30px;
}

.results-header h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.result-card {
    background: linear-gradient(135deg, #407cd6 0%, #000000 100%);
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow);
}

.result-card.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.result-card.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.result-card.danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.result-label {
    font-size: 1rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ========================================
   Progress Bar
   ======================================== */

.progress-container {
    margin: 20px 0;
}

.progress {
    height: 30px;
    border-radius: 15px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 15px;
    transition: width 0.3s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Test Configuration
   ======================================== */

.config-panel {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.config-option {
    margin-bottom: 20px;
}

.config-option label {
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.config-option select,
.config-option input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.config-option select:focus,
.config-option input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* ========================================
   Keyboard Visualization
   ======================================== */

.keyboard-container {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 30px 0;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-bottom: 5px;
}

.key {
    min-width: 50px;
    height: 50px;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border: 2px solid #dee2e6;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
    transition: var(--transition);
    cursor: pointer;
}

.key:hover {
    background: linear-gradient(to bottom, #e9ecef, #dee2e6);
    transform: translateY(-2px);
}

.key.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: translateY(2px);
}

.key.space {
    min-width: 300px;
}

.key.large {
    min-width: 80px;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    .test-title-display {
        display: none;
    }

    .timer-display {
        font-size: 1.2rem;
        padding: 6px 12px;
        top: 15px;
        right: 15px;
    }

    .test-controls-top-center {
        left: 50%;
    }

    .typing-area {
        padding: 20px;
    }

    .text-display {
        font-size: 1.1rem;
        padding: 20px;
        max-height: 300px;
    }

    .typing-input {
        font-size: 1rem;
    }

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

    .test-stats {
        flex-direction: column;
    }

    .keyboard-container {
        overflow-x: auto;
    }

    .key {
        min-width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .key.space {
        min-width: 200px;
    }
}

@media (max-width: 576px) {
    .typing-container {
        padding: 15px;
    }

    .test-header {
        padding: 20px;
    }

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

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