﻿/* =========================================================
   RT-SYSTEM: RATING MODULE STYLES (Scrollable Page)
   Prefix: rt-
   ========================================================= */

:root {
    --rt-primary: #0d6efd;
    --rt-success: #198754;
    --rt-warning: #ffc107;
    --rt-danger: #dc3545;
    --rt-dark: #343a40;
    --rt-light: #f8f9fa;
    --rt-border: #dee2e6;
    --rt-bg: #f4f6f9;
}

/* 1. LAYOUT: PHÁ KHUNG SCROLL */
.rt-page {
    width: 100%;
    min-height: 100vh; /* Ít nhất bằng chiều cao màn hình */
    height: auto !important; /* Cho phép giãn nở theo nội dung */
    background-color: var(--rt-bg);
    padding: 20px 30px;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #212529;
    box-sizing: border-box;
    overflow-y: visible !important; /* BẮT BUỘC: Để body cuộn được */
}

/* 2. HEADER */
.rt-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--rt-primary);
}

.rt-icon-box {
    width: 36px;
    height: 36px;
    background: var(--rt-primary);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.2);
}

.rt-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #495057;
}

/* 3. FILTER SECTION */
.rt-filter-box {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--rt-border);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.rt-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rt-label {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
}

    .rt-label i {
        margin-right: 4px;
    }

.rt-select, .rt-input {
    height: 36px;
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    min-width: 140px;
    background-color: #fff;
    transition: border-color 0.15s;
}

    .rt-select:focus, .rt-input:focus {
        border-color: var(--rt-primary);
        box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
    }

/* 4. TABS */
.rt-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: -1px; /* Đè lên viền card */
    padding-left: 10px;
    position: relative;
    z-index: 1;
}

.rt-tab {
    padding: 10px 20px;
    background: #e9ecef;
    border: 1px solid var(--rt-border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    font-size: 14px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .rt-tab:hover {
        background: #dee2e6;
    }

    .rt-tab.active {
        background: white;
        color: var(--rt-primary);
        border-top: 3px solid var(--rt-primary);
        padding-top: 8px; /* Bù lại border-top */
        box-shadow: 0 -2px 5px rgba(0,0,0,0.02);
    }

/* 5. MAIN CARD */
.rt-card {
    background: white;
    border: 1px solid var(--rt-border);
    border-radius: 0 8px 8px 8px; /* Bo góc trừ góc trên trái */
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Info Bar */
.rt-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.rt-subject-badge {
    background: #0dcaf0;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 10px;
}

/* Alert */
.rt-alert {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rt-alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Toolbar Buttons */
.rt-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.rt-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    transition: filter 0.2s;
}

    .rt-btn:hover {
        filter: brightness(0.9);
    }

/* Custom Colors from Screenshot */
.rt-btn-green {
    background-color: #198754;
}

.rt-btn-purple {
    background-color: #6f42c1;
}

.rt-btn-cyan {
    background-color: #0dcaf0;
    color: white;
}

.rt-btn-orange {
    background-color: #fd7e14;
}

/* Toggle Switch */
.rt-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    margin-right: 15px;
    font-weight: 600;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
}

    .rt-switch input {
        width: 40px;
        height: 20px;
        appearance: none;
        background: #dee2e6;
        border-radius: 20px;
        position: relative;
        cursor: pointer;
        transition: 0.3s;
    }

        .rt-switch input::before {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: white;
            top: 2px;
            left: 2px;
            transition: 0.3s;
            box-shadow: 0 1px 2px rgba(0,0,0,0.2);
        }

        .rt-switch input:checked {
            background: #0d6efd;
        }

            .rt-switch input:checked::before {
                left: 22px;
            }

/* Bulk Actions */
.rt-bulk-area {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #e9ecef;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.rt-bulk-btn {
    width: 28px;
    height: 28px;
    border: none;
    font-weight: 700;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* RATING COLORS */
.bg-t {
    background-color: #28a745 !important;
    color: white !important;
}

.bg-h {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.bg-c {
    background-color: #dc3545 !important;
    color: white !important;
}

.bg-del {
    background-color: #6c757d !important;
    color: white !important;
}

/* 6. TABLE STYLES */
.rt-table-responsive {
    overflow-x: auto;
    border: 1px solid var(--rt-border);
    border-radius: 4px;
}

.rt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1000px; /* Đảm bảo bảng không bị co quá nhỏ */
}

    .rt-table th, .rt-table td {
        border: 1px solid #dee2e6;
        padding: 8px 10px;
        vertical-align: middle;
    }

    .rt-table thead th {
        background-color: #005b9f; /* Đồng bộ head table toàn source */
        color: white;
        font-weight: 600;
        text-transform: uppercase;
        text-align: center;
        height: 40px;
    }

/* Sticky Columns (Chỉ hoạt động tốt khi overflow wrapper được set) */
.rt-sticky-left {
    position: sticky;
    left: 0;
    background-color: white;
    z-index: 2;
}

.rt-table tr:hover td {
    background-color: #f1f3f5;
}

/* Inputs in Table */
.rt-cell-select {
    width: 100%;
    height: 30px;
    border: 1px solid #ced4da;
    border-radius: 0; /* Vuông vức như ảnh */
    text-align: center;
    text-align-last: center;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.rt-cell-input {
    width: 100%;
    border: 1px solid #ced4da;
    padding: 5px;
    font-size: 13px;
}

.rt-text-code {
    font-family: monospace;
    font-weight: 700;
    color: #495057;
}

.rt-name-col {
    font-weight: 600;
    color: #000;
    text-align: left !important;
}

/* Modal */
.rt-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.rt-modal {
    background: white;
    width: 600px;
    max-width: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}
