/* JEE CBT Plugin Styles */

/* Test Interface */
.jeecbt-test {
    max-width: 900px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.jeecbt-test-header h2 {
    color: #23282d;
    margin-bottom: 15px;
    font-size: 28px;
}

.jeecbt-test-description {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #0073aa;
}

.jeecbt-test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

#jeecbt-timer-display {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #0073aa;
    min-width: 120px;
    text-align: center;
}

/* Questions */
.jeecbt-question {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.jeecbt-question:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.question-header {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-number {
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
}

.question-subject {
    background: #f1f1f1;
    color: #666;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.question-text {
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.6;
    color: #2c3e50;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-label {
    display: flex;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
}

.option-label:hover {
    background: #f0f0f1;
    border-color: #0073aa;
}

.option-label input[type="radio"] {
    margin-right: 12px;
    margin-top: 2px;
}

.option-label .option-text {
    flex: 1;
    line-height: 1.5;
}

.option-label:has(input:checked) {
    background: #e7f3ff;
    border-color: #0073aa;
    border-width: 2px;
}

.option-label input:checked + .option-text {
    font-weight: 600;
    color: #0073aa;
}

/* Test Footer */
.jeecbt-test-footer {
    text-align: center;
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

#jeecbt-submit {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#jeecbt-submit:hover:not(:disabled) {
    background: #005a87;
}

#jeecbt-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Results List */
.jeecbt-results-list {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.jeecbt-results-list h3 {
    color: #23282d;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
}

.jeecbt-results-list table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.jeecbt-results-list th,
.jeecbt-results-list td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.jeecbt-results-list th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.jeecbt-results-list tr:hover {
    background: #f8f9fa;
}

/* Admin Styles */
.jeecbt-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.jeecbt-stats > div {
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
    flex: 1;
    min-width: 150px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.jeecbt-stats h3,
.jeecbt-stats h4 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.jeecbt-stats .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #0073aa;
    margin: 0;
}

/* Form Enhancements */
.form-table th {
    width: 150px;
    vertical-align: top;
    padding-top: 10px;
}

.form-table td {
    vertical-align: top;
}

.char-counter {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.duration-helper {
    margin-top: 5px;
}

/* Question Block in Results */
.question-block {
    margin-bottom: 20px;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.question-correct {
    border-left: 4px solid #00a32a;
    background: #f6fff6;
}

.question-incorrect {
    border-left: 4px solid #d63638;
    background: #fff6f6;
}

.question-unanswered {
    border-left: 4px solid #dba617;
    background: #fffbf0;
}

.result-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-correct {
    background: #d1e7dd;
    color: #0f5132;
}

.badge-incorrect {
    background: #f8d7da;
    color: #842029;
}

.badge-unanswered {
    background: #fff3cd;
    color: #664d03;
}

.option {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.option-correct {
    background: #d1e7dd;
    border-color: #badbcc;
    font-weight: bold;
}

.option-incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.option-user-answer {
    background: #cff4fc;
    border-color: #b6effb;
}

/* Responsive Design */
@media (max-width: 768px) {
    .jeecbt-test {
        margin: 10px;
        padding: 15px;
    }
    
    .jeecbt-test-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    #jeecbt-timer-display {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .jeecbt-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .option-label {
        padding: 10px;
    }
    
    .question-text {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .jeecbt-test {
        margin: 5px;
        padding: 10px;
    }
    
    .question-number {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .option-label {
        padding: 8px;
        font-size: 14px;
    }
    
    #jeecbt-submit {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}

/* Print Styles */
@media print {
    .jeecbt-test {
        box-shadow: none;
        margin: 0;
    }
    
    .no-print {
        display: none !important;
    }
    
    .jeecbt-question {
        page-break-inside: avoid;
        margin-bottom: 15px;
    }
    
    .question-block {
        page-break-inside: avoid;
    }
}

/* Loading States */
.jeecbt-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.jeecbt-loading:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.jeecbt-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.jeecbt-success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #276749;
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

/* Admin Table Enhancements */
.widefat tbody tr:hover {
    background: #f8f9fa;
}

.button-small {
    padding: 4px 8px;
    font-size: 12px;
    height: auto;
    line-height: 1.4;
}

/* Form Validation */
.form-field-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 1px #d63638;
}

.form-error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

/* Accessibility Improvements */
.jeecbt-test:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.option-label:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 1px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .jeecbt-question {
        border-width: 2px;
    }
    
    .option-label {
        border-width: 2px;
    }
    
    .question-number {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}