/* ดีไซน์สำหรับ Student Report Dashboard */

/* 1. คอนเทนเนอร์หลัก */
.local-studentreport-dashboard {
    background-color: #f4f6f9;
    padding: 30px;
    border-radius: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 2. การ์ดปีการศึกษา */
.report-year-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    background: white;
    overflow: hidden;
}

.report-year-header {
    background: #343a40;
    color: white;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
}

/* 3. กล่องรายวิชา */
.report-course-block {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
    transition: transform 0.2s;
}

.report-course-block:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.report-course-title {
    color: #0056b3;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

/* 4. ตาราง */
.report-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.report-table thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px;
    border-bottom: 2px solid #dee2e6;
}

.report-table tbody td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid #e9ecef;
}

/* 5. Badge และสถานะ */
.badge-score-pass {
    color: #28a745;
    font-weight: bold;
}

.badge-score-fail {
    color: #dc3545;
    font-weight: bold;
    background: #ffe3e6;
    padding: 2px 8px;
    border-radius: 4px;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    margin-right: 15px;
    border-radius: 50%;
    border: 2px solid #e9ecef;
}

/* ระบบเตือนภัยเด็กเสี่ยงตก (At-risk Highlighting) */
.at-risk-row {
    background-color: #fff0f0 !important;
}
.at-risk-row:hover {
    background-color: #ffe6e6 !important;
}

/* =======================================================
   เทคนิค แผ่นใส (Invisible Overlay) ล่องหนทับซีกซ้าย 75% 
======================================================= */

/* Overlay สำหรับ Export (ซ้าย 75%) */
.export-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 75%;
    height: 100%;
    z-index: 5;
    cursor: pointer;
    /* เราไม่ใส่สีพื้นหลังให้ hover เพื่อความเนียนและสะอาดตา */
}

/* กล่อง Tooltip ที่ซ่อนอยู่ */
.hover-export-box {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #343a40;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease-in-out;
    pointer-events: none; /* ห้ามให้กล่องนี้บังการกดคลิก */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* สามเหลี่ยมชี้ลง */
.hover-export-box::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #343a40 transparent transparent transparent;
}

/* โชว์กล่องเมื่อชี้ที่แผ่นใส (ซีกซ้าย 75%) */
.export-overlay:hover .hover-export-box {
    opacity: 1;
    visibility: visible;
    bottom: 90%; /* ดันลอยขึ้นไปเหนือตัวหนังสือ */
}

/* ปรับไอคอน DataTables Sort ให้กลับไปอยู่ชิดขวาสวยๆ */
table.dataTable thead .sorting:before, 
table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:before, 
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:before, 
table.dataTable thead .sorting_desc:after {
    right: 8px !important; 
}

.grade-a {
    color: #00d25b;          /* สีเขียวสว่าง */
    border: 2px solid #ffc107; /* ขอบสีเหลือง */
    padding: 1px 6px;
    border-radius: 5px;
}
.grade-bplus {
    color: #198754;          /* สีเขียวเข้ม */
}
.grade-b {
    color: #008b8b;          /* สีฟ้าแกมเขียวเข้ม (Dark Cyan) */
}
.grade-cplus {
    color: #45c49e;          /* สีฟ้าแกมเขียวสว่าง (Teal/Light Cyan) */
}
.grade-c {
    color: #ffc107;          /* สีเหลือง */
}
.grade-dplus {
    color: #fd7e14;          /* สีเหลืองส้ม */
}
.grade-d {
    color: #e16411;          /* สีส้ม */
}

@media print {
    .print-hide, form#filterform, .btn, .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate {
        display: none !important;
    }
    body, .local-studentreport-dashboard {
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
    }
    .year-card {
        box-shadow: none; 
        border: none; 
        page-break-inside: avoid;
    }
    table { page-break-inside: auto; width: 100% !important; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    .at-risk-row { 
        background-color: #fff0f0 !important; 
        -webkit-print-color-adjust: exact; 
        color-adjust: exact; 
    }
    th {
        -webkit-print-color-adjust: exact; 
        color-adjust: exact; 
    }
}