/* Custom Test Manager - Frontend Styles */

.ctm-test-container h1, h2, h3 {
    text-transform: capitalize;
}

.ctm-test-container {
    max-width: 800px;
    margin: 0 0 30px;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    
}

/* Test Header */
.ctm-test-header {
    margin-bottom: 15px;
    text-align: center;
}

.ctm-test-title {
    color: #333;
    font-size: 28px;
    margin-bottom: 10px !important;
}

/* Progress Bar */
.ctm-progress-container {
    margin-bottom: 30px;
}

.ctm-progress-bar {
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ctm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a8996e, #baaa99);
    transition: width 0.3s ease;
    border-radius: 5px;
}

.ctm-progress-text {
    text-align: right;
    color: #313131;
    font-size: 14px;
    font-weight: 500;
}

/* Questions */
.ctm-questions-wrapper {
    margin-bottom: 30px;
}

.ctm-question-wrapper {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #a8996e;
}

.ctm-question-text {
    color: #313131;
    font-size: 18px;
    margin-bottom: 20px;
    line-height: 1.5;
    margin-top: 15px;
    text-transform: none;
}

/* Answers */
.ctm-answers-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ctm-answer-label {
    display: flex !important;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer !important;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin-bottom: 0 !important;
}

/* Hover state */
.ctm-answer-label:hover {
    border-color: #a8996e;
    background: #f8f6f4;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.1);
}

/* Selected state for radio/checkbox */
.ctm-answer-label.selected {
    border-color: #a8996e;
    background: #f8f6f4;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Selected state with different color for better visibility */
.ctm-answer-label input[type="radio"]:checked + .ctm-answer-text,
.ctm-answer-label input[type="checkbox"]:checked + .ctm-answer-text {
    font-weight: 500;
}

/* Style for when input is checked - parent gets selected class via JS */
.ctm-answer-label:has(input:checked) {
    border-color: #a8996e;
    background: #f8f6f4;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Active/Focus state */
.ctm-answer-label:active {
    transform: scale(0.98);
    background: #e3f2fd;
}

.ctm-answer-label input[type="radio"],
.ctm-answer-label input[type="checkbox"] {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
    position: relative;
    z-index: 2;
    accent-color: #4a90e2; /* Modern browsers - colors the radio/checkbox when checked */
}

.ctm-answer-text {
    flex: 1;
    color: #333;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.ctm-answer-label.selected .ctm-answer-text {
    color: #2c3e50;
    font-weight: 500;
}

.ctm-answer-score {
    display: none;
    color: #313131;
    font-size: 14px;
    font-weight: 600;
    margin-left: 10px;
    padding: 3px 8px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ctm-answer-label.selected .ctm-answer-score {
    background: #a8996e;
    color: white;
}

/* Navigation */
.ctm-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
}

.ctm-prev-btn,
.ctm-next-btn,
.ctm-submit-btn,
.ctm-retake-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ctm-prev-btn {
    background: #f0f0f0;
    color: #666;
}

.ctm-prev-btn:hover {
    background: #e0e0e0;
    transform: translateY(-1px);
}

.ctm-prev-btn:active {
    transform: translateY(0);
}

.ctm-next-btn,
.ctm-submit-btn {
    background: rgb(0 0 0 / 0%);
    color: #313131;
    border: 0.5px solid #313131;
    flex: 1;
}

.ctm-next-btn:hover,
.ctm-submit-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px #a8996e80;
}

.ctm-next-btn:active,
.ctm-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

.ctm-retake-btn {
    background: #4CAF50;
    color: white;
    margin-top: 20px;
}

.ctm-retake-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
}

/* Results */
.ctm-results {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #a8996e;
}

.ctm-results h3 {
    color: #313131;
    font-size: 24px;
    margin-bottom: 20px;
}

.ctm-score-display {
    font-size: 48px;
    font-weight: bold;
    color: #4a90e2;
    margin-bottom: 20px;
    line-height: 1.2;
}

.ctm-result-title {
    font-size: 28px;
    font-weight: 600;
    color: #313131;
    margin-bottom: 15px;
}

.ctm-result-image {
    margin: 20px 0;
}

.ctm-result-image img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.ctm-feedback {
    color: #666;
    font-size: 18px;
    margin-bottom: 20px;
    line-height: 1.6;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

/* Loading State */
.ctm-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
}

.ctm-loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f0f0f0;
    border-top-color: #4a90e2;
    border-radius: 50%;
    animation: ctm-spin 1s linear infinite;
}

@keyframes ctm-spin {
    to { transform: rotate(360deg); }
}

/* Messages */
.ctm-error {
    color: #d32f2f;
    background: #ffebee;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #d32f2f;
    margin-bottom: 20px;
}

.ctm-success {
    color: #2c3e50;
    background: #e8f0fe;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #4a90e2;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ctm-test-container {
        padding: 20px;
    }
    
    .ctm-question-wrapper {
        padding: 15px;
    }
    
    .ctm-answer-label {
        padding: 12px 15px;
    }
    
    .ctm-navigation {
        flex-direction: column;
    }
    
    .ctm-prev-btn,
    .ctm-next-btn,
    .ctm-submit-btn {
        width: 100%;
    }
    
    .ctm-score-display {
        font-size: 36px;
    }
    
    .ctm-result-title {
        font-size: 24px;
    }
}

/* Results */
.ctm-results {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-top: 20px;
    border-left: 4px solid #a8996e;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

.ctm-results h3 {
    color: #313131;
    font-size: 32px;
    margin-bottom: 20px;
    font-weight: 600;
}

.ctm-result-title h3 {
    color: #313131;
    font-size: 28px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
}

.ctm-result-image {
    margin: 30px 0;
}

.ctm-result-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.ctm-result-message {
    color: #333;
    font-size: 18px;
    line-height: 1.8;
    margin: 25px 0;
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-align: left;
}

.ctm-result-message p {
    margin-bottom: 15px;
}

.ctm-result-message p:last-child {
    margin-bottom: 0;
}

.ctm-result-message h1,
.ctm-result-message h2,
.ctm-result-message h3,
.ctm-result-message h4 {
    margin: 20px 0 10px;
    color: #333;
}

.ctm-result-message ul,
.ctm-result-message ol {
    margin: 10px 0 20px 20px;
}

.ctm-result-message li {
    margin-bottom: 5px;
}

.ctm-feedback {
    margin-bottom: 20px;
}