/* ไฟล์: style.css */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600&display=swap');

:root {
    --primary: #0d6efd;       /* สีหลัก (น้ำเงิน) */
    --primary-dark: #0a58ca;
    --secondary: #6c757d;     /* สีรอง (เทา) */
    --success: #198754;       /* สีสำเร็จ (เขียว) */
    --warning: #ffc107;       /* สีเตือน (เหลือง) */
    --danger: #dc3545;        /* สีอันตราย (แดง) */
    --light: #f8f9fa;         /* พื้นหลัง */
    --dark: #212529;          /* ข้อความ */
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-radius: 12px;
}

body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f0f2f5;
    color: var(--dark);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* --- Header & Nav --- */
.header-container {
    background: linear-gradient(135deg, #ffffff 0%, #a3bbff 100%);
    padding: 20px;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    border-left: 5px solid var(--primary);
}

.header-title-text {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-left: 15px;
    font-weight: 600;
}

.nav-back {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    transition: 0.3s;
}
.nav-back:hover { color: var(--primary); transform: translateX(-5px); }

/* --- Card Design (กล่องสวยๆ) --- */
.card {
    background: white;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 25px;
    margin-bottom: 25px;
    transition: transform 0.2s;
    border: none;
}

.card:hover {
    transform: translateY(-2px); /* ลอยขึ้นเล็กน้อยเมื่อเอาเมาส์ชี้ */
}

.card h3, .card h4 {
    margin-top: 0;
    color: var(--primary-dark);
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0,0,0,0.15); }
.btn-primary { background: linear-gradient(45deg, var(--primary), #4e95ff); }
.btn-secondary { 
    background: linear-gradient(45deg, var(--secondary), #909396); 
    color: white; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #1a7eca, #7e8285); 
    transform: translateY(-1px);
}
.btn-success { background: linear-gradient(45deg, var(--success), #42ba96); }
.btn-warning { background: linear-gradient(45deg, var(--warning), #ffcd39); color: #333; }
.btn-danger { background: linear-gradient(45deg, var(--danger), #ff6b6b); }

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* --- Evaluation Form (ตารางประเมิน) --- */
.eval-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--card-radius);
    overflow: hidden;
}

.eval-table th {
    background-color: var(--primary);
    color: white;
    padding: 15px;
    font-weight: 500;
}

.eval-table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: white;
}

/* Highlight แถวเมื่อเอาเมาส์ชี้ */
.eval-table tr:hover td {
    background-color: #f8faff;
}

/* Radio Button แบบสวย (Checklist ง่าย) */
.radio-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* ซ่อน Radio เดิม */
.custom-radio input[type="radio"] {
    display: none;
}

/* สร้างปุ่มใหม่แทน */
.custom-radio label {
    display: inline-block;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    font-weight: bold;
    color: #888;
    transition: all 0.2s;
}

/* เมื่อเลือกแล้วเปลี่ยนสี */
.custom-radio input[type="radio"]:checked + label {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.4);
}

/* ปุ่ม N/A */
.custom-checkbox input[type="checkbox"] {
    transform: scale(1.5);
    cursor: pointer;
}

/* --- Comment Modal & Chat Styles --- */
.modal-overlay {
    display: none; /* ซ่อนไว้ก่อน */
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.chat-box {
    background: white; width: 90%; max-width: 500px;
    border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; max-height: 80vh;
}
.chat-header {
    padding: 15px; border-bottom: 1px solid #eee;
    font-weight: bold; display: flex; justify-content: space-between;
    background: var(--primary); color: white; border-radius: 12px 12px 0 0;
}
.chat-body {
    flex: 1; padding: 15px; overflow-y: auto; background: #f8f9fa;
}
.chat-footer {
    padding: 15px; border-top: 1px solid #eee; background: white;
    border-radius: 0 0 12px 12px;
}

/* Bubble Styles */
.msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.msg-bubble {
    padding: 10px 15px; border-radius: 15px; max-width: 80%;
    font-size: 0.95rem; position: relative; word-wrap: break-word;
}
.msg-info { font-size: 0.75rem; color: #888; margin-top: 3px; }

/* แยกฝั่ง: Inspector อยู่ขวา, School อยู่ซ้าย (หรือ User ปัจจุบันอยู่ขวา) */
.msg.self { align-items: flex-end; }
.msg.self .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 2px; }

.msg.other { align-items: flex-start; }
.msg.other .msg-bubble { background: #e9ecef; color: #333; border-bottom-left-radius: 2px; }

.btn-comment-trigger {
    background: none; border: 1px solid #ddd; color: #666;
    border-radius: 50%; width: 32px; height: 32px; cursor: pointer;
    transition: 0.2s; position: relative;
}
.btn-comment-trigger:hover { background: #eee; color: var(--primary); }
.btn-comment-trigger.has-comment { background: #ffc107; color: #333; border-color: #ffc107; }
.btn-comment-trigger .count-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--danger); color: white; font-size: 0.7em;
    padding: 2px 5px; border-radius: 10px;
}

.btn-delete-msg {
    font-size: 0.8em;
    color: #ccc;
    cursor: pointer;
    margin-left: 10px;
    visibility: hidden; /* ซ่อนไว้ก่อน */
    transition: color 0.2s;
}

/* แสดงปุ่มลบเมื่อเอาเมาส์ชี้ที่ข้อความ */
.msg-bubble:hover .btn-delete-msg {
    visibility: visible;
}

.btn-delete-msg:hover {
    color: #dc3545; /* สีแดงตอนชี้ */
}