/* includes/cbt_styles.css - CBT System Styles */

/* ============================================
   EXISTING STYLES (Keep all your existing styles)
   ============================================ */

/* Dynamic Options Styles */
.dynamic-options-container {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    background: #f8fafc;
    margin: 15px 0;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}

.options-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.option-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    transition: border-color 0.2s;
}

.option-row:hover {
    border-color: #667eea;
}

.option-row .note-editor {
    border-radius: 6px !important;
    border: 1px solid #e2e8f0 !important;
}

.option-row .note-toolbar {
    background: #f8fafc !important;
    border-radius: 6px 6px 0 0 !important;
    padding: 6px !important;
}

.option-row .note-toolbar .note-btn-group {
    margin-right: 4px;
}

.option-row .note-editable {
    min-height: 60px !important;
    background: white !important;
    padding: 10px !important;
}

.option-letter-badge {
    min-width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 4px;
}

.option-editor-wrapper {
    flex: 1;
    min-width: 200px;
}

.option-image-upload {
    min-width: 120px;
}

.option-image-preview {
    margin-top: 5px;
    position: relative;
    display: inline-block;
}

.option-image-preview img {
    max-width: 80px;
    max-height: 80px;
    border-radius: 6px;
    border: 1px solid #ddd;
    object-fit: cover;
}

.option-image-preview .remove-option-image {
    position: absolute;
    top: -8px;
    right: -8px;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 50%;
    line-height: 1;
}

.option-correct {
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.option-correct input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-correct label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-weight: 600;
    color: #27ae60;
    font-size: 13px;
}

.remove-option {
    align-self: center;
    flex-shrink: 0;
}

/* Student Exclusion */
.student-exclusion-container {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 15px;
    background: #f8fafc;
    margin: 15px 0;
    max-height: 400px;
    overflow-y: auto;
}

.exclusion-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.exclusion-controls .badge {
    font-size: 13px;
    padding: 5px 12px;
}

.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 5px;
}

.student-item {
    padding: 5px 10px;
    border-radius: 6px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.student-item:hover {
    background: #e8f4fd;
    border-color: #b8d4f0;
}

.student-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    width: 100%;
    padding: 2px 0;
}

.student-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #27ae60;
}

.student-checkbox-label input[type="checkbox"]:not(:checked) {
    accent-color: #e74c3c;
}

.student-name {
    font-weight: 500;
    font-size: 13px;
}

.student-class {
    font-size: 11px;
    margin-left: auto;
    color: #6c757d;
}

.student-id {
    font-size: 10px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Class/Arm Selector */
.class-selector-group,
.arm-selector-group {
    margin-bottom: 15px;
}

.select2-multi {
    border-radius: 8px !important;
    border: 2px solid #ddd !important;
}

.select2-container .select2-selection--multiple {
    border-radius: 8px !important;
    border: 2px solid #ddd !important;
    min-height: 120px !important;
    padding: 5px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    border: none !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: white !important;
    opacity: 0.8;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: white !important;
    opacity: 1;
}

.select2-container--default .select2-search--inline .select2-search__field {
    margin-top: 5px !important;
    font-size: 13px !important;
}

/* Summernote General Styles */
.note-editor {
    border-radius: 8px !important;
    border: 2px solid #e2e8f0 !important;
}

.note-editor .note-toolbar {
    background: #f8fafc !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 10px !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.note-editor .note-toolbar .note-btn {
    border-radius: 4px !important;
    padding: 5px 10px !important;
}

.note-editor .note-toolbar .note-btn:hover {
    background: #e2e8f0 !important;
}

.note-editor .note-editable {
    min-height: 200px !important;
    background: white !important;
    padding: 15px !important;
    border-radius: 0 0 8px 8px !important;
}

.note-editor .note-statusbar {
    border-top: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    border-radius: 0 0 8px 8px !important;
}

/* Editor Toolbar */
.editor-toolbar {
    margin: 10px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-toolbar .btn {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.editor-toolbar .btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
}

.editor-toolbar .btn-secondary:hover {
    background: #cbd5e1;
}

/* ============================================
   NEW: CBT EXAM MANAGEMENT STYLES
   ============================================ */

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.status-badge i {
    margin-right: 6px;
    font-size: 11px;
}

/* Exam Statuses */
.status-draft { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.status-published { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-ongoing { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }
.status-completed { background: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
.status-closed { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.status-emergency { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Approval Statuses */
.status-pending { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.status-approved { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-rejected { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Live Class Statuses */
.status-scheduled { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }
.status-live {
    background: #dc3545;
    color: white;
    border: none;
    animation: pulse 1.5s infinite;
}
.status-ended { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-cancelled { background: #e9ecef; color: #6c757d; border: 1px solid #dee2e6; text-decoration: line-through; }

/* Submission Statuses */
.status-submitted { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Transport Statuses */
.status-boarded { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-missed { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.status-not-marked { background: #e9ecef; color: #6c757d; border: 1px solid #dee2e6; font-style: italic; }
.status-en-route { background: #cce5ff; color: #004085; border: 1px solid #b8daff; }
.status-arrived { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.status-transport-late { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.status-absent { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* Waitlist */
.status-waitlisted { background: #e2d5f5; color: #6f42c1; border: 1px solid #d8c6f0; }

/* Pulse animation for LIVE badge */
@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- CBT Action Buttons --- */
.cbt-action-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-cbt-sm {
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-cbt-sm:hover { opacity: 0.85; }

.btn-cbt-preview { background: #9b59b6; color: white; }
.btn-cbt-edit { background: #f39c12; color: white; }
.btn-cbt-view { background: #3498db; color: white; }
.btn-cbt-danger { background: #e74c3c; color: white; }
.btn-cbt-success { background: #27ae60; color: white; }
.btn-cbt-warning { background: #f39c12; color: white; }
.btn-cbt-secondary { background: #6c757d; color: white; }
.btn-cbt-info { background: #17a2b8; color: white; }

.btn-cbt-locked {
    background: #6c757d;
    color: white;
    cursor: not-allowed;
    padding: 5px 12px;
    font-size: 11px;
    border-radius: 5px;
    display: inline-block;
    opacity: 0.7;
}

/* --- CBT Badges --- */
.cbt-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}
.cbt-badge-draft { background: #f8f9fa; color: #666; border: 1px solid #ddd; }
.cbt-badge-published { background: #d4edda; color: #155724; }
.cbt-badge-ongoing { background: #cce5ff; color: #004085; }
.cbt-badge-completed { background: #e2e3e5; color: #383d41; }
.cbt-badge-danger { background: #f8d7da; color: #721c24; }
.cbt-badge-closed { background: #d1ecf1; color: #0c5460; }
.cbt-badge-entrance { background: #f39c12; color: white; }
.cbt-badge-regular { background: #3498db; color: white; }
.cbt-badge-section { background: #9b59b6; color: white; padding: 2px 8px; border-radius: 10px; font-size: 9px; margin-left: 5px; }

/* --- CBT Attempt Stats --- */
.cbt-attempt-stats {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    font-size: 11px;
}
.cbt-attempt-stats span {
    padding: 2px 8px;
    border-radius: 10px;
}
.cbt-attempt-completed { background: #d4edda; color: #155724; }
.cbt-attempt-ongoing { background: #cce5ff; color: #004085; }
.cbt-attempt-total { background: #e2e3e5; color: #383d41; }

/* --- CBT Section Badge --- */
.cbt-section-badge {
    background: #9b59b6;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 9px;
    margin-left: 5px;
}

/* --- CBT Info Boxes --- */
.cbt-info-box {
    background: #e8f4fd;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin-bottom: 15px;
}
.cbt-warning-box {
    background: #fff3cd;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #f39c12;
    margin-bottom: 15px;
}
.cbt-danger-box {
    background: #f8d7da;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 15px;
}

/* --- CBT Form Group --- */
.cbt-form-group {
    margin-bottom: 15px;
}
.cbt-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
    font-size: 13px;
}
.cbt-form-group input,
.cbt-form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}
.cbt-form-group input:focus,
.cbt-form-group select:focus {
    outline: none;
    border-color: #3498db;
}
.cbt-form-group small {
    color: #666;
    font-size: 11px;
}

/* --- CBT Modals --- */
.cbt-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}
.cbt-modal-content {
    background: white;
    margin: 5% auto;
    width: 90%;
    max-width: 550px;
    border-radius: 16px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.cbt-modal-header {
    padding: 15px 20px;
    background: #1e3c72;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cbt-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}
.cbt-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}
.cbt-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}
.cbt-modal-footer {
    padding: 15px 20px;
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #e2e8f0;
}

/* Modal Variations */
.cbt-modal-danger .cbt-modal-header {
    background: #e74c3c;
}
.cbt-modal-success .cbt-modal-header {
    background: #27ae60;
}
.cbt-modal-warning .cbt-modal-header {
    background: #f39c12;
}

/* --- Quick Stats Summary --- */
.cbt-stats-summary {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}
.cbt-stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cbt-stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
}

/* --- Filter Bar --- */
.cbt-filter-bar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.cbt-filter-bar select,
.cbt-filter-bar input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    min-width: 150px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    /* Option row responsive */
    .option-row {
        flex-direction: column;
        align-items: stretch;
    }
    .option-editor-wrapper {
        min-width: unset;
    }
    .option-image-upload {
        min-width: unset;
    }
    .option-correct {
        justify-content: center;
        padding: 5px 0;
    }
    .remove-option {
        align-self: flex-end;
    }
    .students-grid {
        grid-template-columns: 1fr;
    }
    .option-row .note-editable {
        min-height: 40px !important;
    }
    .select2-container .select2-selection--multiple {
        min-height: 80px !important;
    }

    /* CBT Management responsive */
    .cbt-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .cbt-filter-bar select,
    .cbt-filter-bar input {
        width: 100%;
    }
    .cbt-stats-summary {
        flex-direction: column;
        gap: 10px;
    }
    .cbt-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    .cbt-action-group {
        flex-direction: column;
        align-items: stretch;
    }
    .cbt-action-group .btn-cbt-sm {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .options-header {
        flex-direction: column;
        align-items: stretch;
    }
    .options-header h5 {
        text-align: center;
    }
    .option-letter-badge {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    .option-row .note-editable {
        min-height: 30px !important;
        font-size: 13px !important;
    }
}