/**
 * Typing Speed Tester Styles
 * Ultra-modern design with visual keyboard and animations
 */

.typing-speed-tester-tool {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
}

.tool-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}

.tool-header p {
    margin: 0;
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Tester Container */
.tester-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

/* Stats Dashboard */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* Text Type Section */
.text-type-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.text-type-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.text-type-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.text-type-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
    font-weight: 600;
    color: #374151;
}

.text-type-btn:hover {
    border-color: #667eea;
    background: #f0f4ff;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.text-type-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.text-type-btn.active:hover {
    color: white;
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
}

.btn-icon {
    font-size: 1.25rem;
}

/* Test Controls */
.test-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Progress Section */
.progress-section {
    margin-bottom: 2rem;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 12px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.1s linear;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: #667eea;
    z-index: 1;
}

/* Test Area */
.test-area {
    margin-bottom: 2rem;
}

.text-display-wrapper {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    min-height: 150px;
    max-height: 250px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.text-display {
    font-size: 1.25rem;
    line-height: 1.8;
    color: #374151;
}

.test-text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.test-text .char {
    display: inline-block;
    padding: 2px 1px;
    border-radius: 3px;
    transition: all 0.1s ease;
}

.test-text .char.correct {
    background: #d1fae5;
    color: #065f46;
}

.test-text .char.incorrect {
    background: #fee2e2;
    color: #991b1b;
    text-decoration: underline;
}

.test-text .char.current {
    background: #dbeafe;
    color: #1e40af;
    border-left: 3px solid #3b82f6;
    animation: blink 1s infinite;
}

.test-text .char.pending {
    color: #9ca3af;
}

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

.typing-area {
    margin-bottom: 1rem;
}

.typing-input {
    width: 100%;
    padding: 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.125rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.8;
    color: #374151;
    background: #ffffff;
    resize: vertical;
    min-height: 100px;
    max-height: 150px;
    transition: all 0.2s ease;
}

.typing-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.typing-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Visual Keyboard */
.keyboard-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #f0f0f0;
    background: #ffffff;
    padding-bottom: 1rem;
}

@media (min-width: 769px) {
    .keyboard-section {
        position: sticky;
        bottom: 20px;
        z-index: 10;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        border-radius: 12px 12px 0 0;
    }
}

.keyboard-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #374151;
}

.keyboard-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
}

.keyboard-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 0.75rem;
    background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    border: 1px solid #1f2937;
    border-radius: 8px;
    color: #f9fafb;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: default;
    transition: all 0.1s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.key:hover {
    background: linear-gradient(135deg, #4b5563 0%, #6b7280 100%);
}

.key.pressed {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #8b5cf6;
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    animation: keyPress 0.2s ease;
}

.key.wide {
    min-width: 88px;
}

.key.extra-wide {
    min-width: 132px;
}

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

@keyframes keyPress {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(2px) scale(0.95); }
    100% { transform: translateY(2px) scale(1); }
}

/* Test Results */
.test-results {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    animation: slideDown 0.5s ease-out;
}

.results-header {
    margin-bottom: 1.5rem;
}

.results-header h4 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
}

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

.result-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.15);
}

.result-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.result-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn svg {
    flex-shrink: 0;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-outline {
    background: #ffffff;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

/* Status Messages */
.status-message {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    animation: slideDown 0.3s ease-out;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent unwanted scrolling */
.typing-speed-tester-tool {
    overflow-x: hidden;
}

.tester-container {
    position: relative;
}


/* Responsive Design */
@media (max-width: 768px) {
    .typing-speed-tester-tool {
        padding: 1rem;
    }
    
    .tester-container {
        padding: 1.5rem;
    }
    
    .tool-header {
        padding: 1.5rem;
    }
    
    .tool-header h3 {
        font-size: 1.5rem;
    }
    
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .text-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .text-type-btn {
        flex: 1;
        justify-content: center;
    }
    
    .test-controls {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .keyboard-section {
        position: relative;
        margin-top: 1rem;
    }
    
    .keyboard-container {
        padding: 1rem;
        max-height: 300px;
    }
    
    .key {
        min-width: 36px;
        height: 36px;
        font-size: 0.75rem;
        padding: 0 0.5rem;
    }
    
    .key.wide {
        min-width: 72px;
    }
    
    .key.extra-wide {
        min-width: 108px;
    }
    
    .key.space {
        min-width: 200px;
    }
    
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .result-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
}

