/**
 * MCQ Assessment Frontend Styles
 * Bootstrap 5 compatible with custom enhancements
 */

/* Main Assessment Container */
.mcq-assessment {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0;
}

/* Assessment Steps */
.mcq-assessment-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    position: relative;
}

.mcq-assessment-steps::before {
    display: none;
}

.mcq-step {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.mcq-step.active {
    background: #007bff;
    border-color: #007bff;
    color: #fff;
}

.mcq-step.completed {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.mcq-step-label {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 12px;
    color: #6c757d;
    min-width: 80px;
    text-align: center;
}

/* Ensure steps container has enough height for labels */
.mcq-assessment-steps {
    margin-bottom: 50px;
    padding-bottom: 20px;
}

/* Progress Bar - Hidden */
.mcq-progress {
    display: none;
}

.mcq-progress-bar {
    display: none;
}

.mcq-progress-text {
    text-align: center;
    margin-top: 30px;
    font-size: 14px;
    color: #6c757d;
    clear: both;
}

/* Personal Information Form */
.mcq-personal-info {
    background: #fff;
    padding: 22px;
    border-radius: 10px;
    border: 1px solid #e6e6e6;
    margin-bottom: 0;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.05);
}

.mcq-personal-info .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.mcq-personal-info .form-control,
.mcq-personal-info .form-select {
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 15px;
    transition: border-color 0.3s ease;
}

.mcq-personal-info .form-control:focus,
.mcq-personal-info .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.mcq-personal-info .required {
    color: #dc3545;
}

/* Category Selection */
.mcq-category-selection {
    margin-bottom: 30px;
}

/* Categories Grid - 2 columns layout */
.mcq-categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.mcq-category-item {
    width: 100%;
}

.mcq-category-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.mcq-category-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.mcq-category-card.selected {
    border-color: #007bff;
    background: #e7f3ff;
}

.mcq-category-card .category-checkbox {
    position: absolute;
    top: 20px;
    right: 20px;
}

/* Larger checkbox styling */
.mcq-category-card .category-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #007bff;
}

/* Custom checkbox appearance for better visibility */
.mcq-category-card .category-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    border: 2px solid #adb5bd;
    border-radius: 6px;
    background-color: #fff;
    transition: all 0.2s ease;
    position: relative;
}

.mcq-category-card .category-checkbox input[type="checkbox"]:hover {
    border-color: #007bff;
}

.mcq-category-card .category-checkbox input[type="checkbox"]:checked {
    background-color: #007bff;
    border-color: #007bff;
}

.mcq-category-card .category-checkbox input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 9px;
    top: 4px;
    width: 7px;
    height: 14px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.mcq-category-title {
    font-size: 18px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
}

.mcq-category-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.mcq-category-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 10px;
}

.mcq-category-type.aptitude {
    background: #d4edda;
    color: #155724;
}

.mcq-category-type.organizational {
    background: #d1ecf1;
    color: #0c5460;
}

.mcq-category-type.personality {
    background: #f8d7da;
    color: #721c24;
}

/* Questions */
.mcq-questions-container {
    margin-bottom: 30px;
}

.mcq-question {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.mcq-question:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mcq-question-number {
    display: inline-block;
    background: #007bff;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-bottom: 15px;
}

.mcq-question-text {
    font-size: 16px;
    line-height: 1.6;
    color: #495057;
    margin-bottom: 20px;
    font-weight: 400;
}

.mcq-question-text strong,
.mcq-question-text b {
    font-weight: 700;
}

/* Answer Options */
.mcq-answer-options {
    margin-bottom: 15px;
}

.mcq-answer-option {
    display: block;
    margin-bottom: 12px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.mcq-answer-option:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.mcq-answer-option input[type="radio"],
.mcq-answer-option input[type="checkbox"] {
    margin-right: 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid #adb5bd;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    flex-shrink: 0;
}

.mcq-answer-option input[type="radio"]:hover,
.mcq-answer-option input[type="checkbox"]:hover {
    border-color: #007bff;
}

.mcq-answer-option input[type="radio"]:checked,
.mcq-answer-option input[type="checkbox"]:checked {
    border-color: #007bff;
    background-color: #007bff;
}

.mcq-answer-option input[type="radio"]:checked::after,
.mcq-answer-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background-color: #fff;
    border-radius: 50%;
}

.mcq-answer-option.selected {
    border-color: #007bff;
    background: #e7f3ff;
}

.mcq-answer-option label {
    cursor: pointer;
    margin: 0;
    font-weight: 500;
    color: #495057;
}

/* Likert Scale */
.mcq-likert-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.mcq-likert-option {
    text-align: center;
    flex: 1;
    margin: 0 5px;
}

.mcq-likert-option input[type="radio"] {
    display: block;
    margin: 0 auto 8px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid #adb5bd;
    border-radius: 50%;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mcq-likert-option input[type="radio"]:hover {
    border-color: #007bff;
}

.mcq-likert-option input[type="radio"]:checked {
    border-color: #007bff;
    background-color: #007bff;
}

.mcq-likert-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: #fff;
    border-radius: 50%;
}

.mcq-likert-option label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
    line-height: 1.3;
}

.mcq-likert-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: #6c757d;
}

/* Navigation Buttons */
.mcq-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
    margin-top: 30px;
}

.mcq-nav-button {
    min-width: 120px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.mcq-nav-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Thank You Page */
.mcq-thank-you {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.mcq-thank-you h2 {
    color: #28a745;
    margin-bottom: 20px;
}

.mcq-thank-you p {
    font-size: 16px;
    color: #6c757d;
    margin-bottom: 30px;
}

.mcq-download-button {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    color: #fff;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mcq-download-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Results Display */
.mcq-results {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.mcq-results-header {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.mcq-results-header h2 {
    margin: 0 0 10px 0;
}

.mcq-results-body {
    padding: 30px;
}

.mcq-score-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mcq-score-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.mcq-score-value {
    font-size: 32px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
}

.mcq-score-label {
    font-size: 14px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mcq-detailed-scores {
    margin-top: 30px;
}

.mcq-score-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.mcq-score-table th,
.mcq-score-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.mcq-score-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.mcq-score-table tr:hover {
    background: #f8f9fa;
}

/* Loading States */
.mcq-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.mcq-assessment.loading {
    position: relative;
    pointer-events: none;
    user-select: none;
}

.mcq-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: mcq-spin 1s linear infinite;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

@keyframes mcq-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mcq-loading-text {
    margin-top: 20px;
    color: #495057;
    font-size: 18px;
    font-weight: 500;
}

.mcq-loading-subtext {
    margin-top: 10px;
    color: #6c757d;
    font-size: 14px;
}

/* Error Messages */
.mcq-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 15px 0;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
    animation: mcq-message-fade-in 0.3s ease;
}

.mcq-error ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
    text-align: left;
}

.mcq-error li {
    margin-bottom: 5px;
}

/* Success Messages */
.mcq-success {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin: 15px 0;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
    animation: mcq-message-fade-in 0.3s ease;
}

@keyframes mcq-message-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Alert Messages */
.mcq-alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.mcq-alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.mcq-alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mcq-assessment {
        padding: 15px;
    }
    
    .mcq-assessment-steps {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .mcq-step {
        font-size: 12px;
    }
    
    .mcq-step-label {
        font-size: 10px;
        top: 45px;
    }
    
    .mcq-personal-info {
        padding: 20px;
    }
    
    .mcq-question {
        padding: 20px;
    }
    
    .mcq-likert-scale {
        flex-direction: column;
        gap: 10px;
    }
    
    .mcq-likert-option {
        margin: 5px 0;
    }
    
    .mcq-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .mcq-nav-button {
        width: 100%;
    }
    
    .mcq-score-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mcq-categories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .mcq-category-card {
        padding: 15px;
    }
    
    .mcq-category-title {
        font-size: 16px;
    }
    
    .mcq-category-card .category-checkbox input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }
    
    .mcq-category-card .category-checkbox input[type="checkbox"]:checked::after {
        left: 7px;
        top: 3px;
        width: 6px;
        height: 12px;
    }
    
    .mcq-question-text {
        font-size: 15px;
    }
    
    .mcq-results-header {
        padding: 20px;
    }
    
    .mcq-results-body {
        padding: 20px;
    }
}

/* Print Styles */
@media print {
    .mcq-navigation,
    .mcq-download-button,
    .mcq-loading {
        display: none !important;
    }
    
    .mcq-assessment {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .mcq-question {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Accessibility - removed blue border on focus to avoid visual clutter */
.mcq-assessment:focus-within {
    outline: none;
}

.mcq-answer-option:focus-within {
    outline: none;
}

/* Keep focus visible only on interactive elements for accessibility */
.mcq-answer-option input:focus-visible + label,
.mcq-likert-option input:focus-visible + label {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .mcq-question {
        border-width: 2px;
    }
    
    .mcq-answer-option {
        border-width: 2px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .mcq-step,
    .mcq-progress-bar,
    .mcq-category-card,
    .mcq-question,
    .mcq-answer-option,
    .mcq-nav-button,
    .mcq-download-button {
        transition: none;
    }
    
    .mcq-spinner {
        animation: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .mcq-assessment {
        background: #1a1a1a;
        color: #fff;
    }
    
    .mcq-personal-info,
    .mcq-question,
    .mcq-results {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .mcq-category-card {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .mcq-category-card:hover {
        border-color: #007bff;
    }
    
    .mcq-answer-option {
        background: #2d2d2d;
        border-color: #404040;
        color: #fff;
    }
    
    .mcq-likert-scale {
        background: #2d2d2d;
    }
}

/* Form Validation Error Styles */
.mcq-form .form-control.is-invalid,
.mcq-form .form-select.is-invalid,
.mcq-personal-info .form-control.is-invalid,
.mcq-personal-info .form-select.is-invalid {
    border-color: #dc3545 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px 20px;
    padding-right: 40px !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15) !important;
}

.mcq-form .form-control.is-invalid:focus,
.mcq-form .form-select.is-invalid:focus,
.mcq-personal-info .form-control.is-invalid:focus,
.mcq-personal-info .form-select.is-invalid:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

.mcq-form .invalid-feedback,
.mcq-personal-info .invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 5px;
    font-size: 13px;
    color: #dc3545;
    font-weight: 500;
}

/* Shake animation for error fields */
@keyframes mcq-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.mcq-form .form-control.is-invalid,
.mcq-form .form-select.is-invalid {
    animation: mcq-shake 0.5s ease-in-out;
}

/* Unanswered Question Highlight Styles */
.mcq-question.mcq-question-unanswered {
    border: 2px solid #dc3545 !important;
    background: #fff5f5 !important;
    border-radius: 10px;
    position: relative;
    animation: mcq-shake 0.5s ease-in-out;
}

.mcq-question.mcq-question-unanswered::before {
    content: '⚠ Please answer this question';
    position: absolute;
    top: -12px;
    left: 15px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    z-index: 10;
}

.mcq-question.mcq-question-unanswered .mcq-question-number {
    background: #dc3545 !important;
    color: #fff !important;
}

.mcq-question.mcq-question-unanswered .mcq-answer-option,
.mcq-question.mcq-question-unanswered .mcq-likert-option {
    border-color: #f5c6cb !important;
}

.mcq-question.mcq-question-unanswered .mcq-answer-option:hover,
.mcq-question.mcq-question-unanswered .mcq-likert-option:hover {
    border-color: #dc3545 !important;
    background: #fff !important;
}
