/* Calendar – shared modern theme (injected last into every HTML page by csrf.php) */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700&display=swap");

:root {
  --c-ink: #1e293b; --c-muted: #64748b; --c-border: #e8ecf4; --c-radius: 18px;
  --c-shadow: 0 4px 24px rgba(79,70,229,.08); --c-shadow-lg: 0 14px 38px rgba(79,70,229,.18);
  --fc-border-color: #e8ecf4; --fc-today-bg-color: rgba(99,102,241,.08);
  --fc-button-bg-color: #4f46e5; --fc-button-border-color: #4f46e5; --fc-button-hover-bg-color: #4338ca; --fc-button-hover-border-color: #4338ca;
  --fc-button-active-bg-color: #3730a3; --fc-button-active-border-color: #3730a3; --fc-event-border-color: transparent;
}
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, "Segoe UI", sans-serif !important; color: var(--c-ink); line-height: 1.55;
  background: radial-gradient(900px 420px at 100% -5%, #e0e7ff 0%, transparent 60%), radial-gradient(700px 400px at 0% 100%, #cffafe 0%, transparent 60%), #f6f8ff !important;
  background-attachment: fixed !important; min-height: 100vh;
}
::selection { background: rgba(79,70,229,.18); }
:focus-visible { outline: 3px solid rgba(79,70,229,.35); outline-offset: 2px; }
*::-webkit-scrollbar { width: 10px; height: 10px; } *::-webkit-scrollbar-thumb { background: #c4cedd; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
h1,h2,h3,h4,h5,h6 { color: var(--c-ink); font-weight: 700; letter-spacing: -.015em; }
.text-muted { color: var(--c-muted) !important; }

/* Navbar */
.navbar, .app-navbar { position: sticky; top: 0; z-index: 1030; background: linear-gradient(90deg, #4f46e5, #7c3aed 55%, #0ea5e9) !important; box-shadow: 0 6px 22px rgba(79,70,229,.28) !important; padding: .4rem 0; }
.navbar-brand { font-weight: 700; }
.navbar .nav-link { border-radius: 10px; padding: .45rem .8rem !important; color: rgba(255,255,255,.86) !important; transition: background .15s; }
.navbar .nav-link:hover { background: rgba(255,255,255,.16); color: #fff !important; }
.navbar .nav-link.active { background: rgba(255,255,255,.25); color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.nav-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.55); display: inline-flex; align-items: center; justify-content: center; }
.nav-avatar-ph { background: rgba(255,255,255,.2); color: #fff; }
.bell-badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #f43f5e; color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-menu { min-width: 320px; max-width: 92vw; padding: 0; max-height: 420px; overflow-y: auto; }
.notif-item { white-space: normal; padding: .65rem 1rem; border-bottom: 1px solid var(--c-border); }

/* Layout */
.app-main { padding: 24px 24px 48px; max-width: 1400px; margin: 0 auto; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h4 { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; }
.page-head h4 i { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; color: #fff; background: linear-gradient(135deg, #6366f1, #7c3aed); box-shadow: 0 6px 14px rgba(79,70,229,.28); }
.cal-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; max-width: 1600px; margin: 0 auto; padding: 22px 22px 48px; align-items: start; }
.cal-side { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.side-card, .cal-card { background: #fff; border: 1px solid var(--c-border); border-radius: var(--c-radius); box-shadow: var(--c-shadow); padding: 16px; }
.cal-card { padding: 18px; }
.side-card h6 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #4f46e5; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.type-row { display: flex; align-items: center; gap: 9px; padding: 5px 2px; font-size: .92rem; cursor: pointer; }
.type-row input { accent-color: #4f46e5; }
.dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 11px; }
.upcoming { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.up-item { display: block; text-decoration: none; color: var(--c-ink); padding: 8px 10px 8px 12px; border-radius: 12px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); transition: transform .15s; }
.up-item:hover { transform: translateX(2px); color: var(--c-ink); }
.up-date { display: block; font-size: .74rem; font-weight: 700; color: var(--c); }
.up-title { display: block; font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* FullCalendar */
.fc { font-size: .95rem; }
.fc .fc-toolbar-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }
.fc .fc-button { border-radius: 10px !important; font-weight: 600; padding: .4rem .8rem; box-shadow: none !important; text-transform: none; }
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { background: #3730a3; border-color: #3730a3; }
.fc .fc-col-header-cell { background: #eef0ff; }
.fc .fc-col-header-cell-cushion { color: #4f46e5; font-weight: 700; padding: 8px 4px; text-decoration: none; }
.fc .fc-daygrid-day-number { color: var(--c-ink); font-weight: 600; text-decoration: none; padding: 6px 8px; }
.fc .fc-day-today .fc-daygrid-day-number { background: #4f46e5; color: #fff; border-radius: 999px; min-width: 28px; text-align: center; margin: 4px; padding: 3px 6px; }
.fc .fc-day-sat, .fc .fc-day-sun { background: rgba(244,63,94,.025); }
.fc-theme-standard .fc-scrollgrid, .fc-theme-standard td, .fc-theme-standard th { border-color: var(--c-border); }
.fc .fc-daygrid-event, .fc .fc-timegrid-event, .fc .fc-event { border-radius: 8px; padding: 1px 5px; cursor: pointer; box-shadow: 0 1px 3px rgba(30,27,75,.15); transition: transform .12s, box-shadow .12s; }
.fc .fc-event:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(30,27,75,.22); }
.fc-ev { display: flex; align-items: center; gap: 5px; overflow: hidden; color: #fff; font-weight: 600; font-size: .8rem; }
.fc-ev-time { opacity: .9; font-weight: 500; } .fc-ev-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .fc-ev-rec { font-size: .65rem; opacity: .85; }
.fc .fc-list-event-title a, .fc .fc-list-event-time { color: var(--c-ink); }
.fc .fc-list-day-cushion { background: #eef0ff; color: #4f46e5; font-weight: 700; }
.fc .fc-popover { border-radius: 14px; border: 1px solid var(--c-border); box-shadow: var(--c-shadow-lg); overflow: hidden; }
.ev-done { opacity: .55; } .ev-done .fc-ev-title { text-decoration: line-through; }
.ev-cancelled { opacity: .4; background-image: repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.35) 6px 12px) !important; }

/* Forms / buttons / modals */
.form-label { font-weight: 600; font-size: .9rem; color: #334155; }
.form-control, .form-select { border: 1px solid #d6ddea !important; border-radius: 12px !important; min-height: 42px; box-shadow: none !important; }
.form-control-sm, .form-select-sm { min-height: 34px; border-radius: 10px !important; }
textarea.form-control { min-height: auto; }
.form-control:focus, .form-select:focus { border-color: #818cf8 !important; box-shadow: 0 0 0 4px rgba(99,102,241,.16) !important; }
.form-check-input:checked { background-color: #4f46e5; border-color: #4f46e5; }
.btn { border-radius: 12px !important; font-weight: 600; transition: transform .15s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5) !important; border-color: transparent !important; box-shadow: 0 6px 16px rgba(79,70,229,.25); color: #fff !important; }
.btn-primary:hover { background: linear-gradient(135deg, #4f46e5, #4338ca) !important; box-shadow: 0 8px 20px rgba(79,70,229,.35); }
.btn-success { background: linear-gradient(135deg, #34d399, #10b981) !important; border-color: transparent !important; color: #fff !important; }
.btn-danger { background: linear-gradient(135deg, #fb7185, #f43f5e) !important; border-color: transparent !important; }
.btn-outline-secondary { border-color: #cfd8e6; color: #475467; } .btn-outline-secondary:hover { background: #f1f2ff; color: var(--c-ink); }
.btn-sm { border-radius: 9px !important; }
.modal-content { border: 0 !important; border-radius: var(--c-radius) !important; box-shadow: 0 24px 70px rgba(30,27,75,.3); }
.modal-header { background: #f3f4ff; border-bottom-color: var(--c-border); border-radius: var(--c-radius) var(--c-radius) 0 0; }
.modal-footer { border-top-color: var(--c-border); }
.alert { border: 0 !important; border-radius: 14px !important; }
.table { --bs-table-bg: transparent; } .table thead th { background: #eef0ff; color: #4f46e5; font-size: .78rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; border-color: #dfe3fb; }
.table-hover tbody tr:hover > * { background: #f5f6ff; }
.nav-tabs { border-bottom-color: var(--c-border); } .nav-tabs .nav-link { border-radius: 12px 12px 0 0; font-weight: 600; color: var(--c-muted); } .nav-tabs .nav-link.active { color: #4f46e5; border-color: var(--c-border) var(--c-border) #fff; }
.tbadge { display: inline-block; padding: .3em .75em; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 30%, #fff); white-space: nowrap; }
.info-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; } .info-row > i { width: 34px; height: 34px; border-radius: 10px; background: #eef0ff; color: #4f46e5; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; }
.desc-box { background: #f8f9ff; border: 1px solid var(--c-border); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; margin-top: 8px; }
.toast-lite { position: fixed; right: 20px; bottom: 20px; padding: 10px 18px; border-radius: 12px; color: #fff; font-weight: 600; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 2000; }
.toast-lite.show { opacity: 1; transform: none; } .toast-lite.ok { background: #10b981; } .toast-lite.err { background: #f43f5e; }

/* Legacy pages (login, register, profile, statistics) */
body:has(.login-card), body:has(.register-card) {
  background: radial-gradient(600px 400px at 10% 10%, rgba(244,114,182,.45), transparent 60%), radial-gradient(700px 500px at 95% 15%, rgba(56,189,248,.5), transparent 60%), radial-gradient(700px 500px at 60% 100%, rgba(167,139,250,.55), transparent 60%), linear-gradient(135deg, #6366f1, #7c3aed 55%, #0ea5e9) !important; background-attachment: fixed !important;
}
.login-card, .register-card { border-radius: 24px !important; box-shadow: 0 24px 70px rgba(30,27,75,.35) !important; border: 0 !important; }
.card, .profile-card, .stat-card, .chart-card, .info-card { border-radius: var(--c-radius) !important; border: 1px solid var(--c-border) !important; box-shadow: var(--c-shadow) !important; }

/* Responsive */
@media (max-width: 991.98px) { .cal-layout { grid-template-columns: 1fr; padding: 14px 12px 40px; } .cal-side { position: static; } .upcoming { max-height: 220px; } }
@media (max-width: 575.98px) { .app-main { padding: 14px 10px 30px; } .cal-card { padding: 10px; } .fc .fc-toolbar { flex-wrap: wrap; gap: 8px; } .fc .fc-toolbar-title { font-size: 1.1rem; } }
@media print { .navbar, .cal-side, .fc-toolbar-chunk:last-child { display: none !important; } .cal-layout { display: block; } body { background: #fff !important; } .cal-card { box-shadow: none; border: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
