/* style.css - ฉบับสมบูรณ์ (รองรับ Light & Dark Mode) */
:root {
    --bg-main: #f4f7f6; --bg-card: #ffffff; --bg-input: #ffffff; --bg-hover: #f8f9fa;
    --bg-header-table: #f2f2f2; --bg-collapsible: #f9f9f9; --bg-slip: #6c757d; --bg-slip-hover: #5a6268;
    --text-primary: #212529; --text-secondary: #6c757d; --text-on-dark-bg: #ffffff;
    --text-input: #212529; --text-header: #333; --border-main: #dee2e6; --border-card: rgba(0,0,0,0.1);
    --border-input: #ced4da; --border-hr: #e0e0e0; --link-primary: #007bff; --link-hover: #0056b3;
    --link-clear-search: #dc3545; --shadow-card: 0 4px 8px rgba(0,0,0,0.1); --shadow-card-hover: 0 12px 24px rgba(0,0,0,0.2);
}
body.dark-mode {
    --bg-main: #121212; --bg-card: #1e1e1e; --bg-input: #2a2a2a; --bg-hover: #2a2a2a;
    --bg-header-table: #343a40; --bg-collapsible: #212121; --bg-slip: #495057; --bg-slip-hover: #6c757d;
    --text-primary: #e0e0e0; --text-secondary: #adb5bd; --text-on-dark-bg: #ffffff;
    --text-input: #e0e0e0; --text-header: #ffffff; --border-main: #343a40; --border-card: #343a40;
    --border-input: #495057; --border-hr: #343a40; --link-primary: #3e9cff; --link-hover: #69b4ff;
    --link-clear-search: #ff7b7b; --shadow-card: none; --shadow-card-hover: none;
}
body { font-family: 'Sarabun', sans-serif; background-color: var(--bg-main); margin: 0; padding: 20px; color: var(--text-primary); transition: background-color 0.3s, color 0.3s; }
.container { max-width: 1200px; margin: auto; padding: 20px; }
h1, h2, h3 { color: var(--text-header); }
h1 { text-align: center; border-bottom: 2px solid var(--link-primary); padding-bottom: 10px; font-weight: 700; }
h2 { margin-top: 40px; font-weight: 700; }
hr { border: 0; height: 1px; background-color: var(--border-hr); margin: 40px 0; }
a { color: var(--link-primary); }
.admin-login-link { display: block; text-align: right; margin-bottom: 20px; text-decoration: none; }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card { background-color: var(--bg-card); border: 1px solid var(--border-card); border-radius: 8px; box-shadow: var(--shadow-card); overflow: hidden; transition: background-color 0.3s, border-color 0.3s, transform 0.3s, box-shadow 0.3s; text-decoration: none; color: inherit; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; padding-top: 45px; text-align: center; min-height: 120px; position: relative; }
.card:hover { transform: translateY(-10px); box-shadow: var(--shadow-card-hover); background-color: var(--bg-hover); }
.card-icon { font-size: 2.5rem; margin-bottom: 10px; color: var(--link-primary); }
.card-title { font-size: 1.2rem; font-weight: bold; color: var(--text-header); }
.card-description { font-size: 0.9rem; color: var(--text-secondary); margin-top: 8px; padding: 0 10px; }
.card-date { position: absolute; top: 8px; left: 12px; font-size: 0.8rem; color: var(--text-secondary); background-color: var(--bg-hover); padding: 3px 8px; border-radius: 12px; }
.card-tag { position: absolute; width: 120px; height: 25px; line-height: 25px; text-align: center; top: 10px; right: -30px; transform: rotate(45deg); font-size: 0.8rem; color: white; font-weight: bold; }
.tag-important { background-color: #dc3545; }
.tag-backup { background-color: #6c757d; }
.slip-container { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.slip-item { background-color: var(--bg-slip); color: var(--text-on-dark-bg); padding: 8px 15px; border-radius: 20px; text-decoration: none; font-size: 0.9rem; transition: background-color 0.2s, transform 0.2s; }
.slip-item:hover { background-color: var(--bg-slip-hover); transform: translateY(-2px); }
.admin-panel, .announcement-view { background-color: var(--bg-card); padding: 20px 30px; border-radius: 8px; border: 1px solid var(--border-card); margin-top: 20px; }
label { display: block; margin-top: 10px; margin-bottom: 5px; font-weight: bold; }
input, textarea, select { width: 95%; padding: 12px; margin-bottom: 5px; border: 1px solid var(--border-input); border-radius: 4px; font-family: 'Sarabun', sans-serif; font-size: 1rem; background-color: var(--bg-input); color: var(--text-input); }
textarea { min-height: 150px; resize: vertical; }
button { background-color: var(--link-primary); color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: background-color 0.2s; }
button:hover { background-color: var(--link-hover); }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; border: 1px solid var(--border-input); text-align: left; vertical-align: middle; }
th { background-color: var(--bg-header-table); font-weight: bold; }
.edit-btn, .delete-btn { display: inline-block; padding: 5px 10px; text-decoration: none; border-radius: 4px; margin-right: 5px; font-size: 0.9rem; transition: background-color 0.2s; }
.edit-btn { background-color: #ffc107; color: #212529; }
.edit-btn:hover { background-color: #e0a800; }
.delete-btn { background-color: #dc3545; color: white; }
.delete-btn:hover { background-color: #c82333; }
.announcement-view h1 { text-align: left; border-bottom: none; }
.pdf-embed-container { margin-top: 30px; padding: 20px; border: 1px solid var(--border-main); border-radius: 8px; background-color: var(--bg-main); }
.pdf-viewer { width: 100%; height: 800px; border: 1px solid var(--border-input); border-radius: 4px; }
.search-form { margin: 20px 0; text-align: center; }
.search-form form { display: inline-flex; gap: 10px; align-items: center; }
.search-form input[type="text"] { width: 300px; padding: 10px; }
.search-form button { padding: 10px 15px; }
.search-form .clear-search { color: var(--link-clear-search); text-decoration: none; }
.toggle-btn { background-color: #343a40; color: white; cursor: pointer; padding: 16px; width: 100%; border: none; text-align: left; outline: none; font-size: 1.1rem; font-weight: bold; transition: background-color 0.3s; border-radius: 8px; margin-top: 20px; position: relative; }
.toggle-btn:hover { background-color: #495057; }
.toggle-btn::after { content: '\f067'; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 20px; transition: transform 0.3s; }
.toggle-btn.active::after { content: '\f068'; }
.collapsible-content { padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.5s; background-color: var(--bg-collapsible); border: 1px solid var(--border-main); border-top: none; border-radius: 0 0 8px 8px; }
.collapsible-content .form-section { border-bottom: none; padding: 20px; }
.tab-buttons { border-bottom: 2px solid var(--border-main); }
.tab-btn { color: var(--text-secondary); padding: 15px 25px; cursor: pointer; border: none; background-color: transparent; font-size: 1.1rem; font-weight: bold; position: relative; bottom: -2px; border-bottom: 3px solid transparent; transition: color 0.3s, border-color 0.3s; }
.tab-btn:hover { color: var(--link-primary); }
.tab-btn.active { color: var(--link-primary); border-bottom-color: var(--link-primary); }
.tab-content { display: none; animation: fadeIn 0.5s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.theme-switcher-container { position: absolute; top: 20px; right: 20px; }
#theme-toggle-btn { background: var(--bg-card); border: 1px solid var(--border-main); color: var(--text-primary); width: 45px; height: 45px; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; padding: 0; box-shadow: var(--shadow-card); }
.light-mode #theme-toggle-btn .fa-sun { display: none; }
.dark-mode #theme-toggle-btn .fa-moon { display: none; }
.top-nav-links { text-align: right; margin-bottom: 20px; color: var(--text-secondary); }
.message { padding: 15px; margin-bottom: 20px; border-radius: 5px; text-align: center; font-weight: bold; }
.message.success { background-color: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.message.error { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.role-tag { padding: 4px 8px; border-radius: 5px; color: white; font-size: 0.8rem; font-weight: bold; }
.role-tag.role-it, .role-tag.role-admin { background-color: #198754; }
.delete-btn.disabled { background-color: #e9ecef; color: #adb5bd; cursor: not-allowed; border: 1px solid #dee2e6; }
.password-cell { display: flex; align-items: center; gap: 5px; }
.password-cell .password-field { flex-grow: 1; background-color: transparent !important; border: none !important; padding-left: 0 !important; }
.password-cell .toggle-password-btn { padding: 5px 10px; background-color: var(--bg-slip); flex-shrink: 0; }

/* --- Schedule Iframe --- */
.schedule-iframe {
    width: 100%;
    height: 1200px; /* กำหนดความสูงเริ่มต้น (สามารถปรับได้ตามความเหมาะสม) */
    border: 1px solid var(--border-main);
    border-radius: 8px;
    background-color: #ffffff; /* มีพื้นหลังสีขาวเผื่อกรณีหน้าเว็บที่โหลดมาช้า */
}