/* Hindi Typing Test Styles - Version 2.3 - COMPLETE OVERHAUL */
.htt-container {
    font-family: Arial, sans-serif;
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    border-radius: 5px;
    box-sizing: border-box;
    width: 100%;
}

.htt-title {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #FFD700;
    background: linear-gradient(to right, #1565C0, #FFD700);
    color: white;
    padding: 15px;
    border-radius: 5px;
}

.htt-card {
    background: #fff;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    box-sizing: border-box;
}

.htt-text-selection-container {
    margin-bottom: 20px;
}

.htt-form-group {
    margin-bottom: 15px;
}

/* ===== COMPLETELY REDESIGNED SELECT TEXT SECTION ===== */
.htt-text-select-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

/* Select Text Button - FIXED POSITION AND SIZE */
.htt-select-label-btn {
    background: #c62828;
    color: white;
    padding: 0 20px;
    border: none;
    border-radius: 40px;
    font-weight: bold;
    min-width: 140px;
    height: 50px;
    line-height: 50px;
    font-size: 16px;
    border: 2px solid #8B0000;
    cursor: default;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Dropdown - FIXED WIDTH AND VISIBILITY */
.htt-text-dropdown {
    background: #E3F2FD;
    color: #1565C0;
    border: 2px solid #90CAF9;
    font-weight: bold;
    height: 50px;
    padding: 0 20px;
    border-radius: 40px;
    width: 450px; /* FIXED WIDTH - NOT MIN-WIDTH */
    max-width: 450px;
    box-sizing: border-box;
    font-size: 16px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231565C0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    flex: 0 1 auto; /* PREVENT FLEX GROWING */
}

/* Preview Button - FIXED SIZE */
.htt-btn-preview-text {
    background: #9C27B0;
    color: white;
    white-space: nowrap;
    height: 50px;
    border: none;
    border-radius: 40px;
    padding: 0 25px;
    font-weight: bold;
    cursor: pointer;
    box-sizing: border-box;
    border: 2px solid #7B1FA2;
    font-size: 16px;
    flex-shrink: 0;
    min-width: 140px;
}

/* ===== WORD HIGHLIGHT TOGGLE - NAVY BLUE BOX ===== */
.htt-highlight-toggle-container {
    margin-top: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
    width: 100%;
}

.htt-highlight-toggle {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #1E3D58; /* Navy Blue */
    padding: 0 25px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    height: 50px;
    box-sizing: border-box;
    border: 2px solid #FFD700;
    width: auto;
    min-width: 300px;
}

.htt-highlight-label {
    color: white;
    font-weight: bold;
    font-size: 16px;
    white-space: nowrap;
}

.htt-toggle-switch {
    position: relative;
    display: inline-block;
    width: 70px;
    height: 30px;
    flex-shrink: 0;
}

.htt-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.htt-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e74c3c; /* Red for OFF */
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
}

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

.htt-toggle-state {
    font-size: 12px;
    font-weight: bold;
    color: white;
    z-index: 1;
    position: relative;
}

.htt-toggle-state.htt-on {
    margin-left: 8px;
}

.htt-toggle-state.htt-off {
    margin-right: 8px;
}

.htt-toggle-slider.htt-on {
    background-color: #2ecc71; /* Green for ON */
}

.htt-toggle-slider.htt-on:before {
    transform: translateX(40px);
}

.htt-toggle-slider.htt-off {
    background-color: #e74c3c; /* Red for OFF */
}

/* Time Selector */
.htt-time-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #8e44ad;
    padding: 0 25px;
    border-radius: 40px;
    color: white;
    font-weight: bold;
    margin-bottom: 15px;
    height: 50px;
    border: 2px solid #FFD700;
    width: fit-content;
    min-width: 350px;
}

.htt-time-dropdown {
    background: white;
    color: #333;
    border: none;
    padding: 0 20px;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    width: 180px;
    height: 36px;
    box-sizing: border-box;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.htt-submit-container {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.htt-btn-submit {
    background: #2196F3;
    color: white;
    font-size: 18px;
    padding: 0 40px;
    height: 50px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-weight: bold;
    border: 2px solid #1976D2;
    min-width: 200px;
}

/* Test Header Styles */
.htt-test-header {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(145deg, #ffffff, #f5f7fa);
    border-radius: 16px;
    border: 1px solid #e9ecef;
}

.htt-stats-container {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.htt-stat-box {
    flex: 1;
    min-width: 200px;
    padding: 15px;
    border-radius: 14px;
    text-align: center;
    box-sizing: border-box;
}

.htt-ref-stat {
    background: linear-gradient(145deg, #0A192F, #1A2F4F);
    border: 2px solid #FFD700;
}

.htt-ref-stat .htt-stat-label {
    color: #FFD700;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.htt-ref-stat-inner-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.htt-ref-mini-stat-box {
    background: rgba(255,255,255,0.1);
    padding: 8px;
    border-radius: 8px;
    min-width: 70px;
}

.htt-ref-mini-label {
    color: #FFD700;
    font-size: 12px;
    margin-bottom: 5px;
}

.htt-ref-mini-value {
    color: white;
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(145deg, #2A3F5F, #1E2E4E);
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #FFD700;
}

/* Timer Stat */
.htt-timer-stat {
    background: linear-gradient(145deg, #8B0000, #B22222);
    border: 2px solid #FFD700;
}

.htt-timer-stat .htt-stat-label {
    color: #FFD700;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.htt-timer-stat .htt-stat-value {
    background: rgba(255,255,255,0.95);
    color: #8B0000;
    border: 3px solid #FFD700;
    font-size: 32px;
    font-weight: bold;
    padding: 10px;
    border-radius: 10px;
    display: inline-block;
    min-width: 120px;
}

/* User Typing Stats */
.htt-user-stat {
    background: linear-gradient(145deg, #FF6B35, #FF8C5A);
    border: 2px solid #1E3D58;
}

.htt-user-stat .htt-stat-label {
    color: #1E3D58;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.htt-user-stat-inner-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.htt-user-mini-stat-box {
    background: rgba(255,255,255,0.2);
    padding: 8px;
    border-radius: 8px;
    min-width: 70px;
}

.htt-user-mini-label {
    color: #1E3D58;
    font-size: 12px;
    margin-bottom: 5px;
}

.htt-user-mini-value {
    color: #1E3D58;
    font-size: 24px;
    font-weight: bold;
    background: #FFE5D9;
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #1E3D58;
}

/* Countdown */
.htt-countdown-message {
    font-size: 24px;
    text-align: center;
    color: #2E7D32;
    padding: 20px;
    background: #E8F5E9;
    margin: 20px 0;
    border-radius: 5px;
}

.htt-countdown {
    font-size: 48px;
    font-weight: bold;
    text-align: center;
    color: #c62828;
    padding: 20px;
    background: #FFF9C4;
    margin: 20px 0;
    border-radius: 5px;
}

/* Main Content */
.htt-main-content {
    margin-top: 20px;
}

/* Reference Text Area */
.htt-text-container {
    height: 350px;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
    margin-bottom: 15px;
}

.htt-reference-text {
    padding: 20px;
    line-height: 2.2;
    font-size: 22px;
    background: #fff;
    font-family: 'Nirmala UI', 'Arial Unicode MS', Arial, sans-serif;
    transition: transform 0.3s ease;
}

.htt-word {
    display: inline;
    padding: 2px 4px;
    border-radius: 3px;
}

.htt-word-correct {
    background-color: #E8F5E9 !important;
    color: #2E7D32 !important;
}

.htt-word-incorrect {
    background-color: #FFEBEE !important;
    color: #c62828 !important;
}

.htt-current-word {
    background-color: #FFF9C4 !important;
    box-shadow: 0 0 0 2px #FFD700 !important;
}

/* Typing Area */
.htt-typing-area-container {
    border: 1px solid #2196F3;
    border-radius: 5px;
    padding: 15px;
    background: #E3F2FD;
}

.htt-typing-label {
    font-weight: bold;
    color: #1565C0;
    margin-bottom: 10px;
    font-size: 16px;
}

.htt-user-input {
    width: 100%;
    min-height: 80px;
    max-height: 80px;
    padding: 12px;
    border: 1px solid #90CAF9;
    border-radius: 5px;
    resize: none;
    font-size: 20px;
    font-family: 'Nirmala UI', 'Arial Unicode MS', Arial, sans-serif;
    direction: ltr;
    text-align: left;
    box-sizing: border-box;
}

.htt-typing-hint {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

/* Report */
.htt-report {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.htt-report-title {
    text-align: center;
    color: #2E7D32;
    border-bottom: 2px solid #2E7D32;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.htt-report-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.htt-report-table th,
.htt-report-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.htt-report-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.htt-highlight-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 20px;
    display: inline-block;
}

.htt-highlight-yellow {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    display: inline-block;
}

.htt-report-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.htt-btn-retest {
    background: #FF9800;
    color: white;
    min-width: 120px;
    padding: 12px 25px;
    border: none;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #F57C00;
    height: 50px;
}

.htt-btn-preview {
    background: #9C27B0;
    color: white;
    min-width: 120px;
    padding: 12px 25px;
    border: none;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid #7B1FA2;
    height: 50px;
}

/* Modals */
.htt-fulltext-modal,
.htt-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
}

.htt-fulltext-content,
.htt-preview-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.htt-fulltext-close,
.htt-preview-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #666;
}

/* ===== RESPONSIVE FIXES - COMPLETELY REVISED ===== */
/* Desktop and Laptop - Standard View */
@media (min-width: 1024px) {
    .htt-text-select-wrapper {
        flex-direction: row;
    }
    
    .htt-text-dropdown {
        width: 450px;
    }
}

/* Small Desktop and Large Tablet */
@media (max-width: 1023px) and (min-width: 769px) {
    .htt-text-select-wrapper {
        flex-direction: row;
    }
    
    .htt-text-dropdown {
        width: 350px;
    }
    
    .htt-select-label-btn {
        min-width: 120px;
        padding: 0 15px;
    }
    
    .htt-btn-preview-text {
        min-width: 120px;
        padding: 0 15px;
    }
}

/* Tablet */
@media (max-width: 768px) {
    .htt-text-select-wrapper {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .htt-select-label-btn,
    .htt-text-dropdown,
    .htt-btn-preview-text {
        width: 100%;
        min-width: 100%;
    }
    
    .htt-text-dropdown {
        width: 100%;
        max-width: 100%;
    }
    
    .htt-highlight-toggle {
        width: 100%;
        min-width: 100%;
        justify-content: space-between;
    }
    
    .htt-time-selector {
        width: 100%;
        min-width: 100%;
        justify-content: space-between;
    }
    
    .htt-stats-container {
        flex-direction: column;
    }
    
    .htt-stat-box {
        width: 100%;
        min-width: 100%;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .htt-container {
        padding: 10px;
    }
    
    .htt-card {
        padding: 15px;
    }
    
    .htt-select-label-btn,
    .htt-text-dropdown,
    .htt-btn-preview-text {
        width: 100%;
        min-width: 100%;
        height: 45px;
        line-height: 45px;
        padding: 0 15px;
        font-size: 14px;
    }
    
    .htt-text-dropdown {
        background-position: right 10px center;
    }
    
    .htt-highlight-toggle {
        padding: 0 15px;
        height: 45px;
    }
    
    .htt-highlight-label {
        font-size: 14px;
    }
    
    .htt-time-selector {
        padding: 0 15px;
        height: 45px;
        justify-content: space-between;
    }
    
    .htt-time-dropdown {
        width: 130px;
        padding: 0 12px;
        font-size: 14px;
    }
    
    .htt-btn-submit {
        width: 100%;
        height: 45px;
        font-size: 16px;
    }
    
    .htt-reference-text {
        font-size: 18px;
        padding: 15px;
    }
    
    .htt-user-input {
        font-size: 18px;
        min-height: 70px;
    }
    
    .htt-timer-stat .htt-stat-value {
        font-size: 24px;
        min-width: 100px;
    }
    
    .htt-report-buttons {
        flex-direction: column;
    }
    
    .htt-btn-retest,
    .htt-btn-preview {
        width: 100%;
    }
}

/* Very Small Mobile */
@media (max-width: 360px) {
    .htt-time-selector {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 10px;
    }
    
    .htt-time-dropdown {
        width: 100%;
    }
    
    .htt-highlight-toggle {
        flex-wrap: wrap;
        justify-content: center;
        height: auto;
        padding: 12px;
        gap: 10px;
    }
    
    .htt-reference-text {
        font-size: 16px;
        line-height: 2;
    }
}

/* Fix for dropdown text visibility */
.htt-text-dropdown option {
    background: white;
    color: #333;
    padding: 10px;
    font-size: 16px;
}

/* Ensure consistent box-sizing */
* {
    box-sizing: border-box;
}

/* Fix for iOS */
.htt-user-input,
.htt-text-dropdown,
.htt-time-dropdown {
    -webkit-appearance: none;
}