/* ============================================
   Dashboard Học Sinh CSS
   ============================================ */

/* --- 1. Box bài học (Đang diễn ra & Sắp tới) --- */
.box-current-lesson {
    background: #eef6ff;
    border: solid 1px #62a5f6;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
}


.box-current-lesson .icon-cam {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.box-current-lesson .icon-cam img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.box-current-lesson .course-name i {
    font-size: 16px;
    flex-shrink: 0;
}

.box-current-lesson .info {
    flex: 1;
}

/* Live badge (var(--ce-color-red-500)) — reuse style from course-live-badge */
.box-current-lesson .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--ce-color-red-350);
    color: var(--ce-color-white);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 3px 8px 3px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.box-current-lesson .status-badge.upcoming {
    background: #3b82f6;
}

/* Ripple pulse dot */
.box-current-lesson .status-badge .dot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

.box-current-lesson .status-badge .dot .pulse-inner {
    width: 7px;
    height: 7px;
    background: var(--ce-color-white);
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.box-current-lesson .status-badge .dot::before,
.box-current-lesson .status-badge .dot::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    animation: liveRipple 2s ease-out infinite;
}

.box-current-lesson .status-badge .dot::after {
    animation-delay: 0.75s;
}

@keyframes liveRipple {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    100% {
        transform: scale(3.2);
        opacity: 0;
    }
}

.box-current-lesson .lesson-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.3;
    color: var(--ce-color-indigo-700);
}

.box-current-lesson .course-name {
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box-current-lesson .action {
    display: flex;
    align-items: center;
    gap: 15px;
}

.box-current-lesson .button-bg {
    background: var(--ce-color-blue-700);
    height: 40px;
    width: auto;
    padding: 0 20px;
    border-radius: 8px;
    white-space: nowrap;
}

.box-current-lesson .button-bg:hover {
    background: var(--ce-color-primary);
    transform: translateY(-1px);
}

.box-current-lesson .button-bg .txt {
    font-size: 14px;
    font-weight: 600;
}

.box-current-lesson .countdown {
    color: #3271e8;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    line-height: 1;
    width: 112px;
    text-align: right;
}


@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}

/* --- 2. Thống kê (Quick Stats) --- */
.item-statistical .icon i {
    font-size: 32px;
    position: relative;
}

/* Màu icon đậm theo tone nền card */
.item-statistical-yellow .icon i {
    color: #e58f09;
    /* Dark Amber */
}

.item-statistical-gray .icon i {
    color: #325d6c;
    /* Dark Slate */
}

.item-statistical-purple .icon i {
    color: #2459bb;
    /* Dark Blue */
}

.item-statistical-green .icon i {
    color: #229674;
    /* Dark Green */
}

.item-statistical .icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- 2. Thời khóa biểu (Timetable) --- */
/* Áp dụng style title-item từ AES */
.card-dashboard {
    background: var(--ce-color-white);
    border: 1px solid var(--ce-border-muted);
    border-radius: 8px;
}

.card-dashboard-header {
    padding: 11px 16px;
    background: var(--ce-btn-gray-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-dashboard-header .name {
    font-size: 18px;
    font-weight: 700;
    color: var(--ce-text-primary);
    margin: 0;
}

.card-dashboard-header .actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pupil-dashboard-chart-actions {
    flex-shrink: 0;
}

.pupil-dashboard-chart-actions .date-range-label {
    white-space: nowrap;
    flex-shrink: 0;
}

/* Timetable Grid */
.timetable-wrapper {
    overflow: visible;
    /* Cho popup không bị cắt */
    position: relative;
    background: var(--ce-color-white);
}

.timetable-grid {
    min-width: 800px;
    /* Force scroll on mobile */
    display: grid;
    /* 1 col cho Time lable (80px), 10 col cho 10 ngày (1fr) */
    grid-template-columns: 70px repeat(10, minmax(100px, 1fr));
}

.tt-cell {
    border-right: 1px solid #e1e6eb;
    border-bottom: 1px solid #e1e6eb;
    padding: 6px 6px;
    min-height: 32px;
    position: relative;
    transition: 0.3s;
}



.tt-cell.header:nth-child(11n) {
    border-right: none;
}

.tt-cell.header {
    text-align: center;
    padding: 6px 6px;
    border-bottom: 1px dashed #8794a5;
}

.tt-cell.header .day {
    font-size: 13px;
    color: var(--ce-color-slate-500);
}

.tt-cell.header .date {
    font-size: 15px;
    font-weight: 700;
    margin-top: -2px;
}

.tt-cell.header.today .day,
.tt-cell.header.today .date {
    color: var(--ce-color-blue-700);
}

.tt-cell.time-label {
    font-size: 13px;
    color: var(--ce-color-slate-500);
    text-align: center;

    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px dashed #8794a5;
}

.tt-cell.time-label-header {
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 1px dashed #8794a5;
    border-bottom: 1px dashed #8794a5;
}


/* Lesson box in timetable */
.tt-lesson {
    background: rgba(15, 103, 191, 0.1);
    border-left: 3px solid var(--ce-color-blue-700);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 12px;
    margin-bottom: 4px;
}

.tt-lesson:last-child {
    margin-bottom: 0;
}

.tt-lesson .time {
    color: var(--ce-color-blue-700);
    font-weight: 600;
}

.tt-lesson .title {
    color: var(--ce-color-slate-800);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Past sessions */
.tt-lesson.past {
    background: rgba(148, 163, 184, 0.12);
    border-left-color: var(--ce-color-slate-400);
    opacity: 0.65;
}

.tt-lesson.past .time {
    color: var(--ce-color-slate-400);
}

.tt-lesson.past .title {
    color: var(--ce-color-slate-400);
}

.tt-past-label {
    display: inline-block;
    font-size: 10px;
    color: var(--ce-color-slate-500);
    background: rgba(148, 163, 184, 0.18);
    border-radius: 3px;
    padding: 1px 5px;
    margin-top: 2px;
    line-height: 1.4;
}

/* Tooltip/Mini Popup TKB */
.tt-popup {
    position: absolute;
    top: 0;
    left: calc(100% + 10px);
    width: 260px;
    background: var(--ce-color-white);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 16px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all .2s;
    border: 1px solid var(--ce-color-slate-200);
}

/* Mũi tên tooltip */
.tt-popup::after {
    content: '';
    position: absolute;
    top: 16px;
    left: -5px;
    transform: rotate(45deg);
    width: 10px;
    height: 10px;
    background: var(--ce-color-white);
    border-left: 1px solid var(--ce-color-slate-200);
    border-bottom: 1px solid var(--ce-color-slate-200);
}

.tt-cell:hover .tt-popup {
    opacity: 1;
    visibility: visible;
}

/* Fix z-index grid lines */
.tt-cell {
    z-index: 1;
}

.tt-cell:hover {
    z-index: 100;
}

/* Chỉ highlight ô có bài học khi hover */
.tt-cell:has(.tt-lesson)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: solid 1px #f5ac2b;
    z-index: 1;
    transition: 0.2s;
    opacity: 0;
}

.tt-cell:has(.tt-lesson):hover {
    cursor: pointer;
}

.tt-cell:has(.tt-lesson):hover::before {
    opacity: 1;
}

/* Nếu box nằm sát mép phải màn hình hoặc gần cuối */
.tt-cell:nth-child(11n),
.tt-cell:nth-child(11n - 1),
.tt-cell:nth-child(11n - 2) {
    /* Các cột cuối */
}

.timetable-grid .tt-cell:nth-child(11n) .tt-popup,
.timetable-grid .tt-cell:nth-child(11n - 1) .tt-popup,
.timetable-grid .tt-cell:nth-child(11n - 2) .tt-popup {
    left: auto;
    right: calc(100% + 10px);
}

.timetable-grid .tt-cell:nth-child(11n) .tt-popup::after,
.timetable-grid .tt-cell:nth-child(11n - 1) .tt-popup::after,
.timetable-grid .tt-cell:nth-child(11n - 2) .tt-popup::after {
    left: auto;
    right: -5px;
    transform: rotate(225deg);
}

.tt-popup .p-time {
    color: #7f92a4;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--ce-color-slate-200);
}

.tt-popup .p-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ce-color-slate-800);
    margin-bottom: 4px;
    line-height: 1.4;
}

/* Lesson item inside popup */
.tt-popup .p-lesson-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--ce-color-slate-150);
}

.tt-popup .p-lesson-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tt-popup .p-lesson-item:first-of-type {
    padding-top: 0;
}

.tt-popup .p-lesson-time {
    font-size: 13px;
    font-weight: 600;
    color: var(--ce-color-blue-700);
    margin-bottom: 2px;
}

.tt-popup .p-course {
    font-size: 13px;
    color: var(--ce-color-slate-500);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.tt-popup .p-time i,
.tt-popup .p-course i {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Nút Bắt đầu dạy / Vào lớp trong popup */
.tt-popup .p-btn-join {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 6px 14px;
    background: var(--ce-color-blue-700);
    color: var(--ce-color-white);
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
}

.tt-popup .p-btn-join:hover {
    background: var(--ce-color-primary);
    transform: translateY(-1px);
}

.tt-popup .p-btn-join i {
    font-size: 15px;
    color: var(--ce-color-white);
    margin-top: 0;
}

/* --- 3. Biểu đồ Chart --- */
.chart-container {
    height: 400px;
    width: 100%;
    padding: 20px;
}

/* --- 4. Table Khóa học --- */

/* Progress bar cho list khóa học */

/* --- Course summary on class overview --- */
.link-view-all {
    font-size: 13px;
    color: var(--ce-color-blue-700);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.link-view-all:hover {
    text-decoration: underline;
}

.course-summary-list {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.course-summary-item {
    display: flex;
    align-items: center;
    gap: 12px;
}
.course-summary-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--ce-surface-chip-neutral);
}
.course-summary-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ce-text-primary);
    margin: 0;
    line-height: 1.3;
}
.course-summary-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--ce-color-slate-500);
    margin-top: 2px;
}
.course-summary-meta i {
    margin-right: 2px;
}

/* DataGrid cho bảng khóa học của bạn */

.pupil-dashboard-course-grid__course {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.pupil-dashboard-course-grid__thumb {
    width: 56px;
    height: 56px;
    overflow: hidden;
    border-radius: 8px;
}

.pupil-dashboard-course-grid__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pupil-dashboard-course-grid__name {
    overflow: hidden;
    color: #102a56;
    font-size: 16px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pupil-dashboard-course-grid__progress {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 12px;
}

.pupil-dashboard-course-grid__bar {
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: #e8edf5;
}

.pupil-dashboard-course-grid__bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #10b981;
}

.pupil-dashboard-course-grid__progress b {
    min-width: 38px;
    color: #102a56;
    font-size: 14px;
    text-align: right;
}

.pupil-dashboard-course-grid__thumb {
    margin: 10px 10px 10px 0;
}

@media (max-width: 640px) {
    .pupil-dashboard-course-grid__name {
    white-space: normal;
    }
    .pupil-dashboard-course-grid .dg--table:not(.dg--table-active)
    .dg-cell:has(.btn-table-action) {
    padding-top: 16px;
    }
}

.dashboard-scope-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.dashboard-scope-tabs__btn {
    border: 1px solid #d7e0ee;
    background: #fff;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #35507a;
    cursor: pointer;
}
.dashboard-scope-tabs__btn.is-active {
    background: #1d6fe9;
    border-color: #1d6fe9;
    color: #fff;
}
.pupil-dashboard-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.pupil-dashboard-child-chip,
.pupil-dashboard-child-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eef6ff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 14px;
}
.pupil-dashboard-child-select select {
    border: 1px solid #c9d7ea;
    border-radius: 8px;
    padding: 4px 8px;
    min-width: 180px;
}
.pupil-class-info__stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #5b6b86;
}
.pupil-class-info__body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: 4px 20px 20px;
}
.pupil-class-info__field {
    min-width: 0;
    border: 1px solid #e8edf5;
    border-radius: 10px;
    padding: 14px 16px;
    background: #f8fbff;
}
.pupil-class-info__label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: #5b6b86;
    font-size: 13px;
}
.pupil-class-info__value {
    display: block;
    overflow: hidden;
    color: #102a56;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 767px) {
    .pupil-class-info__body {
        grid-template-columns: 1fr;
    }
    .pupil-class-info__value {
        white-space: normal;
    }
}
/* Thông báo + Nhiệm vụ: cùng khung item-table-category, header cao bằng nhau */
.pupil-dashboard-v3 .block-table-category-dashboard .item-table-category .title-item {
    min-height: 64px;
    box-sizing: border-box;
}
.dashboard-task-box {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.dashboard-task-box__summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.dashboard-task-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f4f7fb;
    color: #35507a;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.dashboard-task-summary i {
    font-size: 15px;
}
.dashboard-task-summary__label {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}
.dashboard-task-summary__count {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.dashboard-task-summary--todo {
    background: #eef5ff;
    color: #2f6fed;
}
.dashboard-task-summary--todo.is-active {
    border-color: #b7d0ff;
    box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.12);
}
.dashboard-task-summary--done {
    background: #eefaf2;
    color: #1f9d57;
}
.dashboard-task-summary--done.is-active {
    border-color: #b6e7c8;
    box-shadow: inset 0 0 0 1px rgba(31, 157, 87, 0.12);
}
.dashboard-task-row {
    cursor: default;
}
.dashboard-task-row:hover .left-table .name {
    text-decoration: none;
}
.dashboard-task-row .right-table {
    width: auto;
}
.dashboard-task-row__main {
    min-width: 0;
}
.dashboard-task-row__name {
    margin: 0 0 4px;
    overflow: hidden;
    color: #102a56;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-task-row__meta {
    margin: 0;
    color: #6b7c96;
    font-size: 13px;
    line-height: 1.4;
}
.dashboard-task-row__subject.is-exam {
    color: #2f6fed;
}
.dashboard-task-row__subject.is-homework {
    color: #7b61ff;
}
.dashboard-task-row__subject.is-test {
    color: #e24b8c;
}
.dashboard-task-row__dot {
    margin: 0 4px;
    color: #9aa8bd;
}
.dashboard-task-row__aside {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}
.dashboard-task-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.dashboard-task-type i {
    font-size: 13px;
}
.dashboard-task-type.is-exam {
    background: #eef5ff;
    color: #2f6fed;
}
.dashboard-task-type.is-homework {
    background: #f2efff;
    color: #7b61ff;
}
.dashboard-task-type.is-test {
    background: #ffeff5;
    color: #e24b8c;
}
.dashboard-task-row__score {
    color: #102a56;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}
.dashboard-task-box__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 12px 0;
}
@media (max-width: 767px) {
    .dashboard-task-row {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-task-row__name {
        white-space: normal;
    }
    .dashboard-task-row__aside {
        justify-content: space-between;
        width: 100%;
    }
    .dashboard-task-summary__label {
        display: none;
    }
}
.dashboard-announce-box .name.is-unread {
    font-weight: 700;
}
.dashboard-pupil-activity {
    display: flex;
    flex-direction: column;
    max-height: 420px;
    overflow: hidden;
}
.dashboard-pupil-activity .title-item {
    flex-shrink: 0;
}
.dashboard-pupil-activity .table-category {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.dashboard-pupil-activity .box-user-avatar .content .text-small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}
.dashboard-shortcut-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.dashboard-shortcut-row--staff {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.dashboard-shortcut {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e8ecf2;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.05);
    font-weight: 700;
    color: #102a56;
    text-decoration: none;
    box-sizing: border-box;
}
.dashboard-shortcut i {
    font-size: 20px;
    color: #1d6fe9;
}
.dashboard-shortcut:hover {
    border-color: #b7d0ff;
    color: #1d6fe9;
}
@media (max-width: 767px) {
    .dashboard-shortcut-row {
        grid-template-columns: 1fr;
    }
}