/* WordPress-safe styles */
.typing-tutor-wrapper {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0 auto;
    padding: 20px;
    background-color: #FFFDE7;
    color: #333;
    max-width: 1000px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Enhanced header with black text */
.typing-tutor-wrapper h1 {
    background: linear-gradient(135deg, #FFD600, #4CAF50);
    color: #000;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8rem;
    padding: 18px 0;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

.typing-tutor-card {
    background-color: #FFFFFF;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 1px solid #FFCDD2;
    position: relative;
}

#referenceText {
    white-space: pre-wrap;
    line-height: 2;
    font-size: 1.1rem;
    height: 200px;
    overflow-y: hidden;
    padding: 15px;
    border: 2px solid #FFF9C4;
    border-radius: 8px;
    background-color: #FFFFFF;
    margin-bottom: 15px;
    position: relative;
    scroll-behavior: smooth;
    text-align: justify;
    text-justify: inter-word;
}

#referenceText span {
    position: relative;
    display: inline;
    line-height: inherit;
}

#userInput {
    width: 100%;
    height: 150px;
    padding: 15px;
    font-size: 1.1rem;
    border: 2px solid #FFCDD2;
    border-radius: 8px;
    resize: none;
    margin-bottom: 15px;
    background-color: #FFFFFF;
    text-align: justify;
    text-justify: inter-word;
}

#userInput:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

#userInput:focus {
    border-color: #E53935;
    outline: none;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.2);
}

.typing-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.typing-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    flex: 1;
    min-width: 140px;
    font-weight: bold;
}

#startBtn {
    background-color: #4CAF50;
    color: white;
}

#startBtn.running {
    background-color: #E53935;
}

#startBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#startBtn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#resetBtn {
    background-color: #FFD600;
    color: #333;
}

#resetBtn:hover:not(:disabled) {
    background-color: #2196F3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#resetBtn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#nextBtn {
    background-color: #2196F3;
    color: white;
    min-width: 120px;
    flex: none;
}

#prevBtn {
    background-color: #E91E63;
    color: white;
    min-width: 120px;
    flex: none;
}

#nextBtn:hover:not(:disabled),
#prevBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#nextBtn:active:not(:disabled),
#prevBtn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#setTimerBtn {
    background-color: #607D8B;
    color: white;
    min-width: 120px;
}

#adminPanelBtn {
    background-color: #9C27B0;
    color: white;
    display: none;
}

.typing-controls button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.timer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.timer {
    font-size: 2rem;
    font-weight: bold;
    color: #E53935;
    background-color: #FFF9C4;
    padding: 12px 30px;
    border-radius: 50px;
    display: inline-block;
    min-width: 140px;
    text-align: center;
}

.stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.stat-box {
    background-color: #FFF9C4;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #FFD600;
}

.stat-title {
    font-size: 0.9rem;
    color: #C62828;
    margin-bottom: 5px;
    font-weight: bold;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #E53935;
}

.current-char {
    background-color: #FFD600;
    border-radius: 2px;
}

.correct {
    color: #388E3C;
}

.incorrect {
    color: #E53935;
    text-decoration: underline;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.checkbox-container input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #E53935;
}

.language-selector {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.language-option {
    padding: 8px 16px;
    border-radius: 5px;
    border: 2px solid #FFCDD2;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #fff;
}

.language-option.selected {
    background-color: #E53935;
    color: white;
    border-color: #C62828;
}

.language-option:hover:not(.selected) {
    background-color: #FFF9C4;
}

.part-info {
    text-align: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: #C62828;
}

.time-up-message {
    text-align: center;
    color: #E53935;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: none;
}

.time-input-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

#timeInput {
    width: 60px;
    height: 40px;
    padding: 5px;
    font-size: 1.1rem;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.time-input-container span {
    font-size: 1.1rem;
}

.text-editor-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.text-editor-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.text-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.text-editor-title {
    font-size: 1.5rem;
    color: #C62828;
}

.close-editor {
    font-size: 1.5rem;
    cursor: pointer;
    color: #C62828;
}

#editorTextInput {
    width: 100%;
    height: 300px;
    padding: 15px;
    margin-bottom: 15px;
    border: 2px solid #FFF9C4;
    border-radius: 8px;
    font-size: 1.1rem;
    resize: vertical;
    text-align: justify;
    text-justify: inter-word;
}

.editor-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.editor-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}

#saveEditorText {
    background-color: #4CAF50;
    color: white;
}

#resetEditorText {
    background-color: #FFD600;
    color: #333;
}

#cancelEditorText {
    background-color: #FFCDD2;
    color: #C62828;
}

.admin-access-container {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.admin-access-link a {
    display: inline-block;
    padding: 10px 20px;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.admin-access-link a:hover {
    background-color: #0b7dda;
    text-decoration: none;
}

.admin-instructions {
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.admin-login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.admin-login-content {
    background-color: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.admin-login-title {
    font-size: 1.5rem;
    color: #C62828;
    margin-bottom: 20px;
}

.admin-password-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #FFF9C4;
    border-radius: 8px;
    font-size: 1.1rem;
}

.admin-login-btn {
    padding: 12px 30px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s;
}

.admin-login-btn:hover {
    background-color: #388E3C;
}

.admin-login-message {
    color: #E53935;
    margin-top: 10px;
    min-height: 24px;
}

@media (min-width: 768px) {
    .typing-tutor-wrapper {
        max-width: 100%;
        padding: 20px;
    }
    
    #referenceText, #userInput {
        height: 250px;
    }
    
    .stats-container {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .typing-controls button {
        min-width: 160px;
        padding: 14px 28px;
    }
    
    #nextBtn, #prevBtn, #setTimerBtn {
        min-width: 140px;
    }
    
    .timer {
        font-size: 2.2rem;
        min-width: 160px;
        padding: 14px 35px;
    }
}

@media (max-width: 480px) {
    .typing-controls {
        flex-direction: column;
    }
    
    .typing-controls button {
        width: 100%;
    }
    
    .checkbox-container {
        width: 100%;
        justify-content: center;
    }
    
    .timer {
        font-size: 1.8rem;
        padding: 10px 20px;
    }

    .editor-buttons {
        flex-direction: column;
    }

    .editor-btn {
        width: 100%;
    }

    .time-input-container {
        width: 100%;
        justify-content: center;
    }

    .language-selector {
        flex-direction: column;
        gap: 10px;
    }
}