/* Prevent role-based UI flicker on first paint */
#predictionTabs,
#predictionTabContent {
    visibility: hidden;
}

html[data-role-ready="1"] #predictionTabs,
html[data-role-ready="1"] #predictionTabContent {
    visibility: visible;
}

/* Role-specific tab visibility (applies immediately, JS will sync active states later) */
/* Teacher: allow both single + batch tabs (JS decides the active one). */

html[data-role="student"] #batch-tab-item { display: none !important; }
html[data-role="student"] #single-tab-item { display: list-item !important; }
html[data-role="student"] #batch-prediction { display: none !important; }
html[data-role="student"] #single-prediction { display: block !important; opacity: 1 !important; }

body {
    background: linear-gradient(135deg,#c0c0c0);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.92rem;
}

/* Student dashboard (mockup-like) */
.student-dashboard { margin-bottom: 14px; }

/* When zooming, keep the dashboard layout fixed; allow horizontal scroll instead of reflow. */
.student-dashboard {
    overflow-x: auto;
}

/* Keep dashboard stable on desktop zoom/resizes (avoid Bootstrap breakpoint reflow). */
.student-dashboard .dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 12px;
    align-items: start;
    min-width: 1100px;
}

.student-dashboard .dashboard-layout__chart {
    grid-column: 1 / -1;
}

.student-dashboard .dashboard-layout__alert,
.student-dashboard .dashboard-layout__history {
    grid-column: 1;
    min-width: 0;
}

/* History table should be as wide as the trend chart. */
.student-dashboard .dashboard-layout__history {
    grid-column: 1 / -1;
}

.student-dashboard .dashboard-layout__risk,
.student-dashboard .dashboard-layout__summary {
    grid-column: 2;
}

/* Fix chart area height to reduce visual jumping when re-rendering. */
.student-dashboard .dashboard-chart {
    height: 220px;
}
.student-dashboard .dashboard-chart canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}
.student-only { display: none; }
html[data-role="student"] .student-only { display: block; }

.dashboard-card {
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.dashboard-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.dashboard-card__title {
    font-weight: 700;
    color: #2f3542;
}

.dashboard-card__link {
    text-decoration: none;
    font-weight: 600;
    color: #0000FF;
}

.dashboard-card__body { padding: 14px; }

.dashboard-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
}

/* Variants: warning (danger), congrats (success), neutral (secondary) */
.dashboard-alert--warning { background: rgba(var(--bs-danger-rgb), 0.08); }
.dashboard-alert--congrats { background: rgba(var(--bs-success-rgb), 0.10); }
.dashboard-alert--neutral { background: rgba(var(--bs-secondary-rgb), 0.10); }

.dashboard-alert__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.dashboard-alert--warning .dashboard-alert__icon {
    background: rgba(var(--bs-danger-rgb), 0.18);
    color: var(--bs-danger);
}
.dashboard-alert--congrats .dashboard-alert__icon {
    background: rgba(var(--bs-success-rgb), 0.18);
    color: var(--bs-success);
}
.dashboard-alert--neutral .dashboard-alert__icon {
    background: rgba(var(--bs-secondary-rgb), 0.18);
    color: var(--bs-secondary);
}

.dashboard-alert__title {
    font-weight: 800;
    margin-bottom: 2px;
}

.dashboard-alert--warning .dashboard-alert__title { color: var(--bs-danger); }
.dashboard-alert--congrats .dashboard-alert__title { color: var(--bs-success); }
.dashboard-alert--neutral .dashboard-alert__title { color: var(--bs-secondary); }

.dashboard-alert__desc {
    font-weight: 600;
    color: #2f3542;
}

.dashboard-alert__metric {
    margin-top: 8px;
    font-weight: 800;
}

.dashboard-alert--warning .dashboard-alert__metric { color: var(--bs-danger); }
.dashboard-alert--congrats .dashboard-alert__metric { color: var(--bs-success); }
.dashboard-alert--neutral .dashboard-alert__metric { color: var(--bs-secondary); }
}

.dashboard-alert__metric-val { font-size: 1.05rem; }
.dashboard-alert__metric-arrow { margin: 0 6px; opacity: 0.8; }
.dashboard-alert__metric-delta { margin-left: 8px; }

.dashboard-alert__reason { margin-top: 6px; font-size: 0.88rem; }

.dashboard-alert__pill {
    margin-left: auto;
    align-self: center;
    text-decoration: none;
    background: rgba(0, 0, 255, 0.10);
    color: #0000FF;
    padding: 8px 12px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.dashboard-table thead th {
    font-size: 0.82rem;
    color: #6c757d;
    border-top: 0;
}

.dashboard-mini-list { display: flex; flex-direction: column; gap: 10px; }

.dashboard-mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(0,0,0,0.03);
    text-decoration: none;
    color: inherit;
}

.dashboard-mini-item:hover { background: rgba(0,0,0,0.05); }
.dashboard-mini-item__date { font-weight: 800; color: #2f3542; }
.dashboard-mini-item__meta { font-size: 0.85rem; }

.main-container {
    padding: 10px;
}

/* Batch dashboard: keep 2 columns stable (avoid Bootstrap breakpoint reflow on zoom).
   When viewport becomes narrower, allow horizontal scroll instead of stacking. */
.main-container.batch-dashboard {
    overflow-x: auto;
}

.batch-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 12px;
    align-items: start;
    min-width: 1100px;
}

.batch-dashboard-layout__left,
.batch-dashboard-layout__right {
    min-width: 0; /* allow table/chart to shrink inside grid */
}

@media (max-width: 768px) {
    /* On very small screens, prefer stacking to reduce horizontal scrolling */
    .batch-dashboard-layout {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}

/* Center main content at ~80% width */
.main-container > .row > .col-12 {
    width: 80%;
    margin-left: auto;
    margin-right: auto;
}

/* Batch dashboard uses Bootstrap grid; don't force 80% width per column */
.main-container.batch-dashboard > .row > .col-12,
.main-container.batch-dashboard > .row > [class^="col-"] {
    width: auto;
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 992px) {
    .main-container > .row > .col-12 {
        width: 100%;
    }
}

.card {
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(108, 9, 9, 0.1);
    border: none;
}

.card-header {
    background: linear-gradient(45deg, #0000FF);
    color: white;
    border-radius: 15px 15px 0 0 !important;
    padding: 12px 16px;
}

.card-header h2 {
    font-size: 1.45rem;
    margin-bottom: 6px;
}

.card-header p {
    font-size: 0.82rem;
}

.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    padding: 0.35rem 0.55rem;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background: transparent !important;
}

.btn-predict {
    background: linear-gradient(45deg, #0000FF);
    border: none;
    border-radius: 25px;
    padding: 8px 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    color: #fff;           /* chữ màu trắng */
    font-size: 0.9rem;
}

.btn-predict:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: #fff; /* giữ trắng khi hover */
}

/* Student: floating side predict button (fixed, bottom-right) */
.sticky-predict-footer {
    display: none;
    position: fixed;
    right: 100px;
    bottom: 24px;
    z-index: 1030;
    background: transparent;
    border: 0;
    padding: 0;
}

.sticky-predict-footer .sticky-inner {
    max-width: none;
    margin: 0;
}

.sticky-predict-footer .btn-predict {
    width: auto;
    white-space: nowrap;
}

html[data-role="student"] .sticky-predict-footer { display: block; }
html[data-role="student"] #studentPredictInlineArea { display: none !important; }

/* Ensure icons and text inside .btn-predict are white even when disabled */
.btn-predict i { color: #fff !important; }
.btn-predict.disabled, .btn-predict:disabled, .btn-predict[disabled] {
    color: #fff !important;
    opacity: 1 !important; /* override browser dimming for disabled buttons */
}
.btn-clear {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    border: none;
    border-radius: 25px;
    padding: 8px 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    color: white;
    font-size: 0.9rem;
}

.btn-clear:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
    color: white;
}

.prediction-result {
    margin-top: 20px;
    padding: 14px;
    border-radius: 15px;
    /* background: white; */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.progress {
    height: 20px;
    border-radius: 12px;
}

.progress-bar {
    border-radius: 12px;
    font-weight: bold;
}

/* XGBoost-only: removed rule-item styles */

.subject-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .subject-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .subject-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .subject-grid {
        grid-template-columns: 1fr;
    }
}

.subject-item {
    /* background: white; */
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner-border {
    color: #667eea;
}

.label-excellent {
    color: #28a745;
    font-weight: bold;
}

.label-good {
    color: #17a2b8;
    font-weight: bold;
}

.label-average {
    color: #ffc107;
    font-weight: bold;
}

.label-late {
    color: #fd7e14;
    font-weight: bold;
}

.label-dropout {
    color: #dc3545;
    font-weight: bold;
}

.label-suspend {
    color: #6f42c1;
    font-weight: bold;
}

/* Chỉnh sửa ô nhập điểm */
.score-input {
    width: 100%;
}

.subject-name {
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

.graduation-status-main {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #007bff;
}

.improvement-section {
    margin-top: 20px;
}

.improvement-item {
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.improvement-item:hover {
    /* background: #e9ecef; */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.improvement-impact {
    text-align: center;
}

.importance-bar {
    max-width: 100px;
    margin: 0 auto;
}

.alert-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Grouped prediction panels */
.group-panel {
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 12px;
    border-radius: 10px;
}

.group-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #343a40;
}

.prediction-result .progress {
    height: 18px;
}

.text-success.fw-bold {
    color: #28a745 !important;
}

.text-info.fw-bold {
    color: #17a2b8 !important;
}

.text-primary.fw-bold {
    color: #007bff !important;
}

.text-warning.fw-bold {
    color: #ffc107 !important;
}

.text-danger.fw-bold {
    color: #dc3545 !important;
}

.text-secondary.fw-bold {
    color: #6c757d !important;
}

.text-purple.fw-bold {
    color: #6f42c1 !important;
}

.text-orange.fw-bold {
    color: #fd7e14 !important;
}

/* Readonly score styles */
/* .readonly-score {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    color: #6c757d !important;
    cursor: not-allowed;
} */

.readonly-score:focus {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
    box-shadow: none !important;
}

.readonly-label {
    display: block;
    margin-top: 5px;
    font-size: 0.8em;
    color: #6c757d;
}

/* Upload area styles */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f0ff;
    transform: scale(1.02);
}

/* Prediction notice modal (3 cases) */
.notice-modal {
    border: 0;
    border-radius: 16px;
}

.notice-modal .modal-body {
    padding: 18px 18px 16px 18px;
}

.notice-modal__top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notice-modal__icon {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    font-size: 20px;
}

.notice-modal__text {
    flex: 1 1 auto;
    min-width: 0;
}

.notice-modal__title {
    font-weight: 800;
    font-size: 1.35rem;
    line-height: 1.2;
    margin-top: 2px;
}

.notice-modal__desc {
    margin-top: 6px;
    color: #6c757d;
}

.notice-metric {
    margin-top: 14px;
    border-radius: 14px;
    padding: 14px 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
    text-align: center;
}

.notice-metric__row {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
}

.notice-metric__value {
    font-weight: 800;
    font-size: 1.6rem;
}

.notice-metric__arrow {
    font-weight: 800;
    font-size: 1.6rem;
    opacity: 0.7;
}

.notice-metric__delta {
    margin-top: 2px;
    font-weight: 700;
    opacity: 0.85;
}

.notice-modal__actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

.notice-modal__actions .btn {
    flex: 1 1 0;
    border-radius: 10px;
    font-weight: 700;
}

/* Themes */
.notice-modal--danger .notice-modal__title {
    color: var(--bs-danger);
}

.notice-modal--danger .notice-modal__icon {
    color: var(--bs-danger);
    background: rgba(var(--bs-danger-rgb), 0.12);
}

.notice-modal--danger .notice-metric {
    background: rgba(var(--bs-danger-rgb), 0.06);
    border-color: rgba(var(--bs-danger-rgb), 0.18);
}

.notice-modal--danger .notice-metric__row,
.notice-modal--danger .notice-metric__delta {
    color: var(--bs-danger);
}

.notice-modal--danger .notice-modal__actions #predictionNoticeDetailBtn {
    background: var(--bs-danger);
    border-color: var(--bs-danger);
    color: #fff;
}

.notice-modal--success .notice-modal__title {
    color: var(--bs-success);
}

.notice-modal--success .notice-modal__icon {
    color: var(--bs-success);
    background: rgba(var(--bs-success-rgb), 0.12);
}

.notice-modal--success .notice-metric {
    background: rgba(var(--bs-success-rgb), 0.06);
    border-color: rgba(var(--bs-success-rgb), 0.18);
}

.notice-modal--success .notice-metric__row,
.notice-modal--success .notice-metric__delta {
    color: var(--bs-success);
}

.notice-modal--success .notice-modal__actions #predictionNoticeDetailBtn {
    background: var(--bs-success);
    border-color: var(--bs-success);
    color: #fff;
}

.notice-modal--neutral .notice-modal__title {
    color: var(--bs-secondary);
}

.notice-modal--neutral .notice-modal__icon {
    color: var(--bs-secondary);
    background: rgba(var(--bs-secondary-rgb), 0.12);
}

.notice-modal--neutral .notice-metric__row,
.notice-modal--neutral .notice-metric__delta {
    color: var(--bs-secondary);
}

.notice-modal--neutral .notice-modal__actions #predictionNoticeDetailBtn {
    background: var(--bs-secondary);
    border-color: var(--bs-secondary);
    color: #fff;
}

.batch-result-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    /* background: white; */
}

.batch-result-item.success {
    border-color: #198754;
    background: #f8fff9;
}

.batch-result-item.error {
    border-color: #dc3545;
    background: #fff8f8;
}

.nav-tabs .nav-link {
    border-radius: 10px 10px 0 0;
    border: none;
    color: #667eea;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(45deg, #0000FF);
    color: white;
}

/* Scrollable subject lists: fixed height for consistent scrollbar gutter across columns */
.scrollable-subjects {
    height: 432px; /* fixed height to display ~8 rows and keep scrollbar track visible */
    overflow-y: scroll; /* force vertical scrollbar gutter even when content is short */
    overflow-x: hidden; /* keep horizontal responsiveness handled by table */
    margin-bottom: 0; /* avoid extra gap under table */
}

/* Smaller scroll area for unscored subjects (fewer rows) */
.unscored-scroll {
    height: 200px; /* shorter area for unscored lists */
    overflow-y: scroll;
}

/* Ensure table doesn't add extra bottom margin inside scroll container */
.scrollable-subjects table {
    margin-bottom: 0;
}

/* Custom scrollbar styling (WebKit) to match the provided screenshot */
.scrollable-subjects::-webkit-scrollbar {
    width: 12px;
}

.scrollable-subjects::-webkit-scrollbar-track {
    background: rgba(34, 4, 4, 0.6);
    border-radius: 10px;
}

.scrollable-subjects::-webkit-scrollbar-thumb {
    background: #cfcfcf;
    border-radius: 10px;
    border: 3px solid rgba(0,0,0,0.15);
}

.scrollable-subjects::-webkit-scrollbar-thumb:hover {
    background: #bdbdbd;
}

/* Firefox scrollbar tuning */
.scrollable-subjects {
    scrollbar-width: thin;
    scrollbar-color: #cfcfcf rgba(0,0,0,0.6);
}

/* App shell layout (sidebar left + top user menu right) */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 290px;
    background: #fff;
    border-right: 1px solid #e9ecef;
    padding: 8px;
    /* height: 200px; */
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px 8px 4px;
    border-bottom: 1px solid #f1f3f5;
    margin-bottom: 10px;
}

.sidebar-title {
    font-weight: 700;
    font-size: 0.8rem;
    color: #6c757d;
    letter-spacing: 0.02em;
}

.sidebar-toggle {
    border: 1px solid #e9ecef;
    background: #fff;
    border-radius: 6px;
    width: 32px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    color: #343a40;
    text-decoration: none;
    font-weight: 600;
    /* font-size: 0.85rem; */
    font-size: 1.5rem;
}

.sidebar-link i {
    font-size: 0.95em;
}

.sidebar-link:hover {
    background: #f1f5ff;
    color: #0000FF;
}

.sidebar-link.active {
    background: #e8f0ff;
    color: #0000FF;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-topbar {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
}

body.sidebar-collapsed .app-sidebar {
    width: 64px;
    padding: 10px 8px;
}

body.sidebar-collapsed .sidebar-title,
body.sidebar-collapsed .sidebar-text {
    display: none;
}

/* Sidebar UX improvements: clearer active, smaller footprint */
.app-sidebar { width: 250px; padding: 10px; }
.sidebar-header { margin-bottom: 8px; }
.sidebar-title { font-size: 0.75rem; text-transform: uppercase; }
.sidebar-link {
    font-size: 0.95rem;
    padding: 9px 10px;
    border-radius: 10px;
    line-height: 1.2;
    position: relative;
}
.sidebar-link i { width: 18px; text-align: center; opacity: 0.9; }
.sidebar-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-link:hover { background: #f1f5ff; }
.sidebar-link.active { background: #e8f0ff; }
.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: #0000FF;
    border-radius: 4px;
}
.sidebar-link:focus-visible { outline: 2px solid rgba(0, 0, 255, 0.35); outline-offset: 2px; }
body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px 8px; }
body.sidebar-collapsed .sidebar-link i { width: auto; }
body.sidebar-collapsed .sidebar-link.active::before { top: 10px; bottom: 10px; }

/* Print: only show bulk prediction results as a sheet */
@media print {
    body {
        background: #fff !important;
    }

    .app-sidebar,
    .app-topbar,
    #sidebarToggle,
    #predictionTabs,
    #single-prediction,
    #classPredictArea,
    #predictionForm {
        display: none !important;
    }

    #batch-prediction {
        display: block !important;
        opacity: 1 !important;
    }

    #batchResults {
        display: block !important;
    }

    .card,
    .main-container {
        box-shadow: none !important;
    }

    #batchResultsContent {
        max-height: none !important;
        overflow: visible !important;
    }
}

.bg-orange {
    background-color: #fd7e14 !important;
}

.bg-purple {
    background-color: #6f42c1 !important;
}
