/* public/css/style.css - Facebook UI Theme with Dark Mode & Header Utility Icons */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
    --fb-blue: #1877f2;
    --fb-blue-hover: #166fe5;
    --fb-blue-light: #e7f3ff;
    --fb-bg: #f0f2f5;
    --fb-card-bg: #ffffff;
    --fb-text-main: #050505;
    --fb-text-sub: #65676b;
    --fb-border: #ced0d4;
    --fb-divider: #e4e6eb;
    --fb-input-bg: #f0f2f5;
    --fb-btn-gray: #e4e6eb;
    --fb-btn-gray-hover: #d8dadf;
    --radius-card: 12px;
    --radius-pill: 20px;
    --shadow-fb: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.2s ease;
    --font-main: 'Sarabun', system-ui, -apple-system, sans-serif;
}

/* ⭐ Dark Mode Variables */
body.dark-mode {
    --fb-bg: #18191a;
    --fb-card-bg: #242526;
    --fb-text-main: #e4e6eb;
    --fb-text-sub: #b0b3b8;
    --fb-border: #38393a;
    --fb-divider: #393a3b;
    --fb-input-bg: #3a3b3c;
    --fb-btn-gray: #3a3b3c;
    --fb-btn-gray-hover: #4e4f50;
    --fb-blue-light: #263951;
}

body.dark-mode header {
    background-color: #242526;
    border-bottom: 1px solid var(--fb-divider);
}

body.dark-mode .eval-card-header-full {
    background: #2d2e2f;
}

body.dark-mode .file-dropdown-menu {
    background: #242526;
    border-color: var(--fb-divider);
}

body.dark-mode .dropdown-file-item:hover {
    background: #3a3b3c;
}

* { box-sizing: border-box; }

body {
    background-color: var(--fb-bg);
    color: var(--fb-text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header Navbar */
header {
    background-color: var(--fb-blue);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.brand-logo { display: flex; align-items: center; gap: 10px; }

.brand-icon {
    width: 40px; height: 40px; background: #ffffff; color: var(--fb-blue);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.brand-title { font-size: 1.2rem; font-weight: 700; color: #ffffff; margin: 0; }
.brand-subtitle { font-size: 0.78rem; color: #d8e4fc; margin: 0; }

/* ⭐ Header Utility Icons (Dark Mode, Language, Print) */
.header-utilities {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: var(--transition);
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

body.dark-mode .header-icon-btn {
    background: var(--fb-input-bg);
    color: var(--fb-text-main);
}
body.dark-mode .header-icon-btn:hover {
    background: var(--fb-btn-gray-hover);
}

/* Navigation Tabs */
.tab-menu {
    display: flex; gap: 8px; background: var(--fb-card-bg); padding: 6px; border-radius: var(--radius-card);
    margin: 20px 0; box-shadow: var(--shadow-fb); border: 1px solid var(--fb-divider);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.tab-btn {
    flex: 1; padding: 10px 16px; border: none; background: transparent; color: var(--fb-text-sub);
    border-radius: 8px; cursor: pointer; font-size: 0.95rem; font-weight: 600; white-space: nowrap; transition: var(--transition); font-family: var(--font-main);
}
.tab-btn:hover { background-color: var(--fb-input-bg); color: var(--fb-blue); }
.tab-btn.active { background: var(--fb-blue-light); color: var(--fb-blue); }

/* Card Section */
.card-section {
    background: var(--fb-card-bg); border: 1px solid var(--fb-divider); border-radius: var(--radius-card);
    padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow-fb);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.card-section h2 {
    margin-top: 0; margin-bottom: 18px; font-size: 1.15rem; color: var(--fb-text-main); font-weight: 700;
    display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--fb-divider); padding-bottom: 12px;
}

/* Category Header Badge */
.category-header-badge-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.category-title-badge { display: inline-flex; align-items: center; background-color: var(--fb-blue); color: #ffffff; padding: 5px 16px; border-radius: var(--radius-pill); font-size: 0.92rem; font-weight: 700; }
.category-count-badge { display: inline-flex; align-items: center; background-color: var(--fb-btn-gray); color: var(--fb-text-sub); padding: 3px 10px; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; }

/* Form Controls */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 170px; }
.flex-2 { flex: 2; min-width: 220px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.88rem; color: var(--fb-text-main); }

.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid var(--fb-border); border-radius: 8px; font-size: 0.92rem; background: var(--fb-input-bg); color: var(--fb-text-main); transition: var(--transition); font-family: var(--font-main);
}
.form-control:focus { outline: none; background: var(--fb-card-bg); border-color: var(--fb-blue); box-shadow: 0 0 0 2px var(--fb-blue-light); }
.help-text { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--fb-text-sub); }

/* Avatar Checkbox Pills */
.teacher-pills-container { display: flex; flex-wrap: wrap; gap: 8px; background: var(--fb-input-bg); padding: 12px; border-radius: var(--radius-card); border: 1px solid var(--fb-divider); }
.teacher-pill { position: relative; cursor: pointer; user-select: none; }
.teacher-pill input[type="checkbox"] { position: absolute; opacity: 0; height: 0; width: 0; }
.pill-content { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 5px; background: var(--fb-card-bg); border: 1px solid var(--fb-border); border-radius: var(--radius-pill); transition: var(--transition); }
.pill-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.pill-info { display: flex; flex-direction: column; }
.pill-pos { font-size: 0.65rem; color: var(--fb-text-sub); }
.pill-name { font-size: 0.82rem; font-weight: 600; color: var(--fb-text-main); }
.pill-check { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: #ced0d4; color: #ffffff; font-size: 0.65rem; font-weight: bold; }
.teacher-pill input[type="checkbox"]:checked + .pill-content { background: var(--fb-blue-light); border-color: var(--fb-blue); }

/* Filter Toolbar */
.filter-bar { background: var(--fb-input-bg); padding: 14px 16px; border-radius: var(--radius-card); border: 1px solid var(--fb-divider); margin-bottom: 20px; }

/* Buttons */
.btn-primary { background-color: var(--fb-blue); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 0.92rem; font-weight: 600; font-family: var(--font-main); transition: var(--transition); }
.btn-primary:hover { background-color: var(--fb-blue-hover); }

.btn-secondary { background-color: var(--fb-btn-gray); color: var(--fb-text-main); border: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.88rem; }
.btn-secondary:hover { background-color: var(--fb-btn-gray-hover); }

.status-text { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 0.88rem; }

/* Icon Buttons */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--fb-btn-gray); color: var(--fb-text-main); cursor: pointer; font-size: 0.88rem; transition: var(--transition); }
.btn-icon:hover { background: var(--fb-btn-gray-hover); }

/* FULL-WIDTH CARDS LAYOUT */
.cards-grid { display: flex; flex-direction: column; gap: 16px; width: 100%; }

.eval-card {
    background: var(--fb-card-bg); border: 1px solid var(--fb-divider); border-radius: var(--radius-card); padding: 0; box-shadow: var(--shadow-fb); transition: var(--transition); display: flex; flex-direction: column; width: 100%; position: relative;
}
.eval-card:hover { box-shadow: var(--shadow-hover); }

.eval-card-header-full {
    display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px; border-bottom: 1px solid var(--fb-divider); background: var(--fb-input-bg); border-radius: var(--radius-card) var(--radius-card) 0 0; gap: 16px;
}

.eval-card-cmd-num { font-size: 0.88rem; font-weight: 700; color: var(--fb-blue); margin-bottom: 4px; }
.eval-card-title-main { font-size: 1.25rem; font-weight: 700; color: var(--fb-text-main); line-height: 1.4; }

.eval-card-badges { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.eval-card-badge { padding: 4px 10px; border-radius: 6px; font-size: 0.78rem; font-weight: 600; }
.badge-cat { background: var(--fb-blue-light); color: var(--fb-blue); }
.badge-evidence { background: #f3e8ff; color: #7e22ce; }
.badge-gcal { background: #e0e7ff; color: #3730a3; }

.eval-card-teachers-pills { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.teachers-pill-label { font-size: 0.82rem; font-weight: 600; color: var(--fb-text-sub); margin-right: 4px; }
.teacher-tag-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--fb-input-bg); border: 1px solid var(--fb-border); padding: 3px 10px 3px 4px; border-radius: 20px; font-size: 0.82rem; font-weight: 600; color: var(--fb-text-main); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); transition: var(--transition); }
.teacher-tag-pill:hover { background: var(--fb-blue-light); border-color: var(--fb-blue); color: var(--fb-blue); }
.teacher-tag-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 1px solid var(--fb-card-bg); }

.eval-card-dates-bar { font-size: 0.85rem; color: var(--fb-text-sub); background: var(--fb-input-bg); padding: 8px 12px; border-radius: 8px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

/* File Icon & Dropdown Styles */
.file-pill-dropdown { position: relative; display: inline-block; }
.btn-fb-attachment-icon-only { background-color: var(--fb-btn-gray); color: var(--fb-text-main); border: none; padding: 5px 12px; border-radius: 18px; cursor: pointer; font-size: 0.95rem; transition: var(--transition); display: inline-flex; align-items: center; gap: 4px; list-style: none; user-select: none; }
.btn-fb-attachment-icon-only::-webkit-details-marker { display: none; }
.btn-fb-attachment-icon-only:hover { background-color: var(--fb-btn-gray-hover); }

.type-icon-group { display: inline-flex; align-items: center; gap: 2px; }
.caret-icon { font-size: 0.65rem; color: var(--fb-text-sub); transition: transform 0.2s ease; margin-left: 2px; }
.file-pill-dropdown[open] .caret-icon { transform: rotate(180deg); }

.file-dropdown-menu { position: absolute; bottom: 100%; left: 0; margin-bottom: 8px; min-width: 260px; max-width: 320px; background: var(--fb-card-bg); border: 1px solid var(--fb-divider); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); padding: 8px; z-index: 90; }
.dropdown-group-header { font-size: 0.74rem; font-weight: 700; color: var(--fb-blue); background: var(--fb-input-bg); padding: 4px 8px; border-radius: 4px; margin: 4px 0; display: flex; align-items: center; gap: 4px; }
.dropdown-file-item { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; color: var(--fb-text-main); text-decoration: none; font-size: 0.82rem; border-radius: 6px; transition: background 0.15s ease; }
.dropdown-file-item:hover { background: var(--fb-blue-light); color: var(--fb-blue); }

.eval-card-footer-actions { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background: var(--fb-card-bg); border-top: 1px solid var(--fb-divider); border-radius: 0 0 var(--radius-card) var(--radius-card); }

/* Roster Cards */
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; margin-top: 12px; }
.roster-card { position: relative; background: var(--fb-card-bg); border: 1px solid var(--fb-divider); border-radius: var(--radius-card); padding: 16px; box-shadow: var(--shadow-fb); transition: var(--transition); display: flex; flex-direction: column; gap: 12px; }
.roster-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.roster-card-top { display: flex; gap: 12px; align-items: center; }
.roster-avatar { width: 65px; height: 65px; border-radius: 50%; object-fit: cover; border: 2px solid var(--fb-blue); flex-shrink: 0; }
.roster-info { display: flex; flex-direction: column; flex: 1; padding-right: 25px; }
.roster-pos { font-size: 0.75rem; font-weight: 700; color: var(--fb-blue); }
.roster-name { font-size: 1.05rem; font-weight: 700; color: var(--fb-text-main); }
.roster-email { font-size: 0.82rem; color: var(--fb-text-sub); font-weight: 500; margin-top: 2px; }

.roster-card-section { background: var(--fb-input-bg); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--fb-divider); }
.roster-section-title { font-size: 0.8rem; font-weight: 700; color: var(--fb-text-main); margin-bottom: 4px; }
.roster-edu-ul { margin: 0; padding-left: 0; list-style: none; font-size: 0.82rem; color: var(--fb-text-main); }
.roster-edu-ul li { margin-bottom: 3px; line-height: 1.35; }
.roster-art-thumbs-wrap { display: flex; gap: 8px; margin-top: 6px; }
.roster-art-thumb { width: 60px; height: 60px; border-radius: 6px; overflow: hidden; border: 1px solid var(--fb-border); display: block; background: var(--fb-card-bg); }
.roster-art-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s ease; }
.roster-art-thumb:hover img { transform: scale(1.1); }
.roster-edit-btn { position: absolute; top: 12px; right: 12px; }

/* Info Lists & Artworks */
.info-list { display: flex; flex-direction: column; gap: 8px; }
.info-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--fb-input-bg); border: 1px solid var(--fb-divider); border-radius: 8px; }

.artwork-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.art-card { border: 1px solid var(--fb-divider); border-radius: var(--radius-card); overflow: hidden; background: var(--fb-card-bg); box-shadow: var(--shadow-fb); transition: var(--transition); display: flex; flex-direction: column; justify-content: space-between; }
.art-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.art-img-wrapper { overflow: hidden; height: 200px; background: var(--fb-input-bg); }
.art-img { width: 100%; height: 100%; object-fit: cover; }
.art-body { padding: 14px; }
.art-technique { display: inline-block; background: var(--fb-blue-light); color: var(--fb-blue); padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; margin-bottom: 6px; }
.art-title { font-weight: 700; font-size: 1rem; color: var(--fb-text-main); }
.art-meta { font-size: 0.82rem; color: var(--fb-text-sub); }
.art-footer { padding: 10px 14px; background: var(--fb-card-bg); border-top: 1px solid var(--fb-divider); display: flex; justify-content: space-between; align-items: center; }

.profile-header { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.avatar-preview { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; border: 3px solid var(--fb-blue); box-shadow: var(--shadow-fb); }
.doc-grid, .meeting-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 15px; }
.doc-item, .meeting-item { background: var(--fb-card-bg); border: 1px solid var(--fb-divider); border-radius: var(--radius-card); padding: 16px; display: flex; flex-direction: column; justify-content: space-between; }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-content { background: var(--fb-card-bg); width: 100%; max-width: 600px; border-radius: var(--radius-card); padding: 24px; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2); max-height: 90vh; overflow-y: auto; color: var(--fb-text-main); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--fb-divider); }
.modal-header h3 { margin: 0; font-size: 1.15rem; color: var(--fb-text-main); }
.modal-close { background: var(--fb-btn-gray); border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 1.2rem; color: var(--fb-text-sub); cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Screen vs Print */
.screen-only { display: block; }
.print-only { display: none !important; }

/* Print Styles */
@media print {
    body { background: white; color: black; font-size: 11pt; font-family: 'Sarabun', sans-serif; }
    header, .tab-menu, #uploadForm, .btn-print, #refreshBtn, .btn-icon, .btn-primary, .btn-secondary, form, .screen-only, .filter-bar, .modal-overlay { display: none !important; }
    .print-only { display: block !important; }
    .container { max-width: 100%; padding: 0; margin: 0; }
    .card-section { border: none; box-shadow: none; padding: 0; margin-bottom: 20px; }
    .print-header-title { text-align: center; font-size: 15pt; font-weight: bold; margin-bottom: 15px; }
    .print-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; page-break-inside: avoid; }
    .print-table th, .print-table td { border: 0.5pt solid #000; padding: 6pt 8pt; font-size: 10pt; text-align: left; vertical-align: top; }
    .print-table th { background-color: #f0f0f0 !important; color: black; font-weight: bold; -webkit-print-color-adjust: exact; }

    .print-badge {
        display: inline-block;
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 8.5pt;
        font-weight: bold;
        background-color: #e4e6eb !important;
        color: #000 !important;
        border: 0.5pt solid #888;
        white-space: nowrap;
        -webkit-print-color-adjust: exact;
    }
}