﻿/* =========================
       WRAPPER TRANG RÀNG BUỘC
    ========================= */
.rb-page {
    --rb-blue: #1e88e5;
    --rb-green: #43a047;
    --rb-red: #c62828;
    --rb-bg: #fafafa;
}

.rbtkb-header {
    border-radius: 14px;
    background: linear-gradient(135deg, #e9f3ea, #cbeaf9);
    border: 1px solid #d6e9dc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

    .rbtkb-header h5 {
        font-weight: 700;
        color: #023807;
        display: flex;
        align-items: center;
        font-size: .8rem;
    }

    .rbtkb-header .lop-name {
        color: #0d6efd;
        font-weight: 700;
        margin-left: 6px;
        padding: 2px 10px;
        background: rgba(13,110,253,0.1);
        border-radius: 8px;
    }

    .rbtkb-header i {
        font-size: 1.1rem;
        color: #20c997;
    }

/* ===== ACTION BUTTONS ===== */

.rb-page .rb-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

    .rb-page .rb-actions .btn {
        padding: 5px 10px;
        font-size: .78rem;
        
    }

/* ===== STYLE CHUNG ===== */

.rb-page .rb-btn {
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    min-height: 38px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all .2s ease;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

    .rb-page .rb-btn:hover {
        transform: translateY(-2px);
    }

    .rb-page .rb-btn:active {
        transform: scale(0.98);
    }


/* ===== LƯU ===== */

.rb-page .rb-btn-luu {
    background: linear-gradient( 135deg, #1e3a8a 0%, #1e40af 45%, #2563eb 100% );
    color: #ffffff;
    border: 1px solid #1e3a8a !important;
    box-shadow: 0 8px 20px rgba(30, 58, 138, 0.35), 0 3px 8px rgba(37, 99, 235, 0.25), inset 0 1px 1px rgba(255,255,255,0.25);
    transition: all .25s ease;
}

    .rb-page .rb-btn-luu:hover {
        transform: translateY(-2px);
        background: linear-gradient( 135deg, #172554 0%, #1e3a8a 50%, #2563eb 100% );
        box-shadow: 0 12px 28px rgba(30,58,138,.45), 0 5px 12px rgba(37,99,235,.30), inset 0 1px 1px rgba(255,255,255,.30);
    }

    .rb-page .rb-btn-luu:active {
        transform: translateY(0);
    }

    .rb-page .rb-btn-luu i {
        color: #dbeafe;
    }

/* ===== KHỐI ===== */

.rb-page .rb-btn-khoi {
    background: linear-gradient( 135deg, #dbeafe 0%, #93c5fd 45%, #3b82f6 100% );
    color: #0f3d91;
    border: 1px solid #2563eb !important;
    box-shadow: 0 8px 18px rgba(59,130,246,.25), 0 3px 8px rgba(37,99,235,.18), inset 0 1px 1px rgba(255,255,255,.35);
    transition: all .25s ease;
}

    .rb-page .rb-btn-khoi:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 24px rgba(59,130,246,.35), 0 5px 12px rgba(37,99,235,.22), inset 0 1px 1px rgba(255,255,255,.40);
    }


/* ===== TRƯỜNG ===== */

.rb-page .rb-btn-truong {
    background: linear-gradient( 135deg, #fff7d6 0%, #fde68a 45%, #f59e0b 100% );
    color: #92400e;
    border: 1px solid #d97706 !important;
    box-shadow: 0 8px 18px rgba(245,158,11,.25), 0 3px 8px rgba(217,119,6,.18), inset 0 1px 1px rgba(255,255,255,.35);
    transition: all .25s ease;
}

    .rb-page .rb-btn-truong:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 24px rgba(245,158,11,.35), 0 5px 12px rgba(217,119,6,.22), inset 0 1px 1px rgba(255,255,255,.40);
    }
/* ===== FORM ===== */

.rb-page .form-label {
    font-size: .85rem;
}

.rb-page input.form-control,
.rb-page select.form-select,
.rb-page .input-group-text {
    padding: 3px 6px;
    font-size: .78rem;
    height: 38px;
}


/* ===== TABLE ===== */

.rb-page .table {
    table-layout: fixed;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .78rem;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    border: 1px solid #dbeafe;
}

/* ===== HEADER ===== */

.rb-page thead th {
    background: linear-gradient(180deg,#009fa5,#015153);
    color: #fff;
    height: 32px;
    font-size: .8rem;
    font-weight: 600;
    vertical-align: middle;
    padding: 10px 6px;
}

/* ===== CELL ===== */

.rb-page th,
.rb-page td {
    text-align: center;
    vertical-align: middle;
    color: #1e3a8a;
    padding: 5px;
    line-height: 1.15;
    border-right: 1px solid #edf2f7;
    border-bottom: 1px solid #edf2f7;
    transition: all .18s ease;
}

/* ===== ROW ===== */

.rb-page tbody tr {
    height: 32px;
    transition: all .15s ease;
}

    .rb-page tbody tr:nth-child(even) td {
        background: #fcfdff;
    }

    /* hover dòng */

    .rb-page tbody tr:hover td {
        background: #eef7ff;
    }

/* hover ô */

.rb-page tbody td:hover {
    background: #dff1ff;
}

/* ===== CHECKBOX ===== */

.rb-page input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2196f3;
    cursor: pointer;
    transition: all .18s ease;
    border-radius: 4px;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
}

    .rb-page input[type="checkbox"]:hover {
        transform: scale(1.18);
    }

    .rb-page input[type="checkbox"]:checked {
        transform: scale(1.1);
    }

/* ===== TÁCH SÁNG / CHIỀU ===== */

.rb-page .table-lichnghi tbody tr:nth-child(5) {
    border-bottom: 3px solid #64b5f6;
}

    .rb-page .table-lichnghi tbody tr:nth-child(5) td {
        box-shadow: inset 0 -2px 0 #90caf9;
    }

/* ===== DÒNG TICK NHANH ===== */

.rb-page tr.table-secondary td:first-child {
    background: linear-gradient(180deg,#f1fff2,#dff7e4);
    color: #1736f4;
    font-weight: 700;
    font-size: 13px;
}

.rb-page tr.table-secondary:hover td {
    background: #edf7ff;
}

.rb-page .table-secondary th {
    background: #e3f2fd;
    color: #1a237e;
}

/* ===== LIST GROUP ===== */

.rb-page .rb-list-group {
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.rb-page .rb-list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    font-size: .86rem;
    border-bottom: 1px solid #eef2f7;
    cursor: pointer;
    transition: all .18s ease;
    color: #334155;
}

    .rb-page .rb-list-group-item:last-child {
        border-bottom: none;
    }

    .rb-page .rb-list-group-item:hover {
        background: #f1f8ff;
        padding-left: 16px;
    }

    .rb-page .rb-list-group-item.active {
        background: linear-gradient(135deg,#42a5f5,#1e88e5);
        color: white;
        font-weight: 600;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
    }

    .rb-page .rb-list-group-item .badge {
        font-size: .7rem;
        padding: 3px 7px;
        border-radius: 999px;
    }

    .rb-page .rb-list-group-item.active .badge {
        background: white;
        color: #1e88e5;
    }

/* ===== CARD ===== */

.rb-page .card {
    border-radius: 14px;
    border: none;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
}

/* ===== SCROLL TABLE ===== */

.rb-page .table-container {
    border-radius: 14px;
    overflow: auto;
    border: 1px solid #dbeafe;
    background: white;
}

/* =========================
   KHUNG TICK NHANH
========================= */

.rb-page .table-lichnghi tr.table-secondary {
    position: relative;
    font-weight: 600;
}

    /* Viền khối */

    .rb-page .table-lichnghi tr.table-secondary td {
        border-top: 2px solid #dbeafe !important;
        border-bottom: 2px solid #dbeafe !important;
        background: #f8fbff;
    }

        /* ô đầu */

        .rb-page .table-lichnghi tr.table-secondary td:first-child {
            border-left: 3px solid #90caf9 !important;
            border-radius: 10px 0 0 10px;
            font-size: .82rem;
            letter-spacing: .2px;
        }

        /* ô cuối */

        .rb-page .table-lichnghi tr.table-secondary td:last-child {
            border-right: 3px solid #90caf9 !important;
            border-radius: 0 10px 10px 0;
        }

    /* Hover */

    .rb-page .table-lichnghi tr.table-secondary:hover td {
        transform: scale(1.005);
        transition: all .15s ease;
    }

    /* =========================
   NGHỈ SÁNG
========================= */

    .rb-page .table-lichnghi tr.table-secondary:nth-last-child(3) td {
        background: linear-gradient(180deg,#fff8e1,#ffefc2);
    }

        .rb-page .table-lichnghi tr.table-secondary:nth-last-child(3) td:first-child {
            color: #d97706;
            border-left-color: #f59e0b !important;
        }

    /* =========================
   NGHỈ CHIỀU
========================= */

    .rb-page .table-lichnghi tr.table-secondary:nth-last-child(2) td {
        background: linear-gradient(180deg,#eef4ff,#dbeafe);
    }

        .rb-page .table-lichnghi tr.table-secondary:nth-last-child(2) td:first-child {
            color: #2563eb;
            border-left-color: #3b82f6 !important;
        }

    /* =========================
   NGHỈ CẢ NGÀY
========================= */

    .rb-page .table-lichnghi tr.table-secondary:nth-last-child(1) td {
        background: linear-gradient(180deg,#fef2f2,#ffdede);
    }

        .rb-page .table-lichnghi tr.table-secondary:nth-last-child(1) td:first-child {
            color: #dc2626;
            border-left-color: #ef4444 !important;
        }

    /* =========================
   CHECKBOX TICK NHANH
========================= */

    .rb-page .table-lichnghi tr.table-secondary input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: #0d6efd;
        cursor: pointer;
        transition: all .18s ease;
        filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
    }

        .rb-page .table-lichnghi tr.table-secondary input[type="checkbox"]:hover {
            transform: scale(1.22);
        }

/* =========================
   PHÂN VÙNG SÁNG / CHIỀU
========================= */

/* tiết sáng */

.rb-page .table-lichnghi tbody tr:nth-child(-n+5):not(.table-secondary) td {
    background: #fffdf7;
}

/* tiết chiều */

.rb-page .table-lichnghi tbody tr:nth-child(n+6):nth-child(-n+10):not(.table-secondary) td {
    background: #f8fbff;
}

/* đường phân cách */

.rb-page .table-lichnghi tbody tr:nth-child(5) td {
    border-bottom: 2px solid #60a5fa !important;
}

/* =========================
   HOVER BẢNG RÀNG BUỘC
   Đặt sau màu phân vùng để hover luôn có hiệu lực.
========================= */

/* Hover toàn hàng, nhưng không ghi đè ô cảnh báo hoặc ô đã chọn. */
.rb-page .table-lichnghi tbody tr:not(.table-secondary):hover
> td:not(.rb-cell-anomaly):not(.rb-drag-cell-selected) {
    background: #eef7ff;
}

/* Ô đang được trỏ chuột nổi bật hơn phần còn lại của hàng. */
.rb-page .table-lichnghi tbody tr:not(.table-secondary)
> td:not(.rb-cell-anomaly):hover {
    background: #dff1ff;
}

/* Chế độ kéo chọn dùng màu xanh lá để thể hiện ô sắp được tác động. */
.rb-page .table-lichnghi.rb-drag-table tbody tr:not(.table-secondary)
> td.rb-drag-cell:not(.rb-cell-anomaly):hover {
    background: #ecfdf5;
    box-shadow: inset 0 0 0 1px #34d399;
}

.rb-page .table-lichnghi.rb-drag-table tbody tr:not(.table-secondary)
> td.rb-drag-cell-selected:not(.rb-cell-anomaly):hover {
    background: #a7f3d0;
}

/* Giữ đường phân cách sáng/chiều khi hover trực tiếp ô của Tiết 5. */
.rb-page .table-lichnghi.rb-drag-table tbody tr:nth-child(5)
> td.rb-drag-cell:not(.rb-cell-anomaly):hover {
    box-shadow: inset 0 0 0 1px #34d399, inset 0 -2px 0 #90caf9;
}

/* ===== RESPONSIVE ===== */

@media (max-width:1366px) {

    .rb-page input.form-control,
    .rb-page select.form-select,
    .rb-page .input-group-text {
        font-size: .8rem;
        height: 32px;
    }

    .rb-page .rb-actions .btn {
        padding: 5px 7px;
        font-size: .8rem;
    }

    .rb-page .table th,
    .rb-page .table td {
        font-size: .74rem;
        padding: 3px;
    }

    .rb-page tbody tr {
        height: 28px;
    }

    .rb-page .table-container {
        max-height: 58vh;
        overflow-y: auto;
        overflow-x: auto;
    }
}
