:root {
  --brand-primary: #0284c7;
  --brand-primary-dark: #0369a1;
  --brand-accent: #2563eb;
  --brand-soft: #e0f2fe;
  --brand-soft-border: #bae6fd;
  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #475569; /* Đảm bảo độ tương phản >= 4.5:1 chuẩn WCAG AA */
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-strong: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.94);
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(2, 132, 199, 0.04);
  --card-shadow-hover: 0 14px 34px rgba(2, 132, 199, 0.1), 0 4px 12px rgba(15, 23, 42, 0.05);
  --sidebar-expanded: 264px;
  --sidebar-collapsed: 76px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-main);
  min-height: 100vh;
  background-color: #f4f7fb;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}

/* Tách lớp nền cố định sang GPU layer riêng thay cho background-attachment: fixed để không gây repaint giật hình */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(at 10% 10%, rgba(186, 230, 253, 0.34) 0px, transparent 55%),
    radial-gradient(at 90% 12%, rgba(224, 231, 255, 0.32) 0px, transparent 52%),
    radial-gradient(at 80% 90%, rgba(204, 251, 241, 0.24) 0px, transparent 55%),
    linear-gradient(160deg, #f8fafc 0%, #f1f6fc 52%, #edf3fa 100%);
  transform: translateZ(0);
}

.text-muted {
  color: var(--text-muted) !important;
}

/* Focus Ring rõ ràng khi điều hướng bằng bàn phím (Accessibility) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ================= SIDEBAR LIGHT GLASS (COLLAPSIBLE + PIN) ================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: var(--sidebar-expanded);
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
  z-index: 1030;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  min-height: 64px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  min-width: 0;
}

.sidebar-brand:hover {
  color: var(--brand-primary);
}

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.26);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #ffffff;
  flex-shrink: 0;
  transition: transform 0.22s var(--ease-out);
}

.sidebar-brand:hover .brand-icon {
  transform: scale(1.04);
}

.sidebar-hideable {
  opacity: 1;
  white-space: nowrap;
}

.sidebar-pin-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.sidebar-pin-btn:hover {
  background: #f1f5f9;
  color: var(--brand-primary);
}

body.sidebar-locked .sidebar-pin-btn {
  color: var(--brand-primary);
  background: var(--brand-soft);
}

.sidebar-user-box {
  margin: 4px 12px 12px;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.75), rgba(239, 246, 255, 0.92));
  border: 1px solid rgba(186, 230, 253, 0.75);
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.22s var(--ease-out), background-color 0.22s ease;
}

.sidebar-user-box:hover {
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.14);
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.24);
  transition: transform 0.22s var(--ease-out);
}

.sidebar-user-box:hover .user-avatar-circle {
  transform: scale(1.05);
}

.user-role-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
}

.sidebar-nav {
  padding: 4px 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  padding: 10px 12px 4px;
  white-space: nowrap;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 13px;
  min-height: 44px;
  border-radius: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: background-color 0.22s var(--ease-out), color 0.22s ease, transform 0.22s var(--ease-out);
}

.sidebar-link i {
  font-size: 1.15rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.16s ease;
}

.sidebar-link:hover {
  background: rgba(224, 242, 254, 0.65);
  color: var(--brand-primary-dark);
}

.sidebar-link:hover i {
  color: var(--brand-primary);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #e0f2fe, #dbeafe);
  color: #0369a1;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.25);
}

.sidebar-link.active i {
  color: #0284c7;
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.85);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-settings-btn {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 12px;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: background-color 0.22s var(--ease-out), border-color 0.22s ease, color 0.22s ease;
}

.sidebar-settings-btn i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  color: #475569;
}

.sidebar-settings-btn:hover,
.sidebar-settings-btn.active {
  border-color: var(--brand-soft-border);
  background: var(--brand-soft);
  color: var(--brand-primary-dark);
}

/* ================= MAIN CONTENT & TOPBAR ================= */
.app-main {
  margin-left: calc(var(--sidebar-expanded) + 24px);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px 20px 28px 6px;
}

/* Hiệu ứng vào trang êm bằng opacity thuần GPU (không giữ transform gây lỗi modal) */
@keyframes softFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.app-content {
  flex: 1;
  animation: softFadeIn 0.28s var(--ease-out);
}

.app-topbar {
  background: linear-gradient(120deg, #ffffff 0%, #f5faff 100%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.topbar-title {
  color: #0369a1;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-search {
  position: relative;
  width: 250px;
}

.topbar-search input {
  border-radius: 999px;
  padding-left: 2.15rem;
  padding-right: 2.1rem;
  font-size: 0.83rem;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid #e2e8f0;
  height: 36px;
}

.topbar-search input:focus {
  background: #ffffff;
  border-color: #38bdf8;
}

.topbar-search .search-icon {
  position: absolute;
  left: 0.78rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.85rem;
  pointer-events: none;
}

.topbar-search .kbd-hint {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  padding: 0.05rem 0.38rem;
  border-radius: 5px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 600;
  pointer-events: none;
}

.topbar-date-pill {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 0.36rem 0.88rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

/* ================= GLASS CARDS, PROGRESS STRIP & SESSION CARDS ================= */
.card-clean {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.stat-card {
  padding: 1.2rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.section-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  font-size: 0.78rem;
  margin-right: 0.55rem;
  flex-shrink: 0;
}

/* Thẻ buổi học trên lịch tuần với thanh màu trạng thái bên trái */
.session-tile {
  display: block;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--brand-primary);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease, border-color 0.2s ease;
}

.session-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.12);
}

.session-tile.is-completed {
  background: #f0fdf4;
  border-color: #bbf7d0;
  border-left-color: #16a34a;
}

.session-tile.is-cancelled {
  background: #f8fafc;
  border-color: #e2e8f0;
  border-left-color: #94a3b8;
  opacity: 0.78;
}

.session-tile.is-conflict {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: #dc2626;
}

/* Hàng điểm danh khi chọn Vắng */
tr.attendance-row-absent > td {
  background-color: rgba(254, 226, 226, 0.45) !important;
}

/* Bộ lọc nhanh dạng thuốc (Filter Pills) */
.filter-pill-btn {
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill-btn:hover {
  border-color: #7dd3fc;
  color: var(--brand-primary-dark);
  background: #f0f9ff;
}

.filter-pill-btn.active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.25);
}

/* Buttons & Form Controls */
.btn {
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
}

.btn-sm {
  border-radius: 8px;
}

.btn-chem {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border: none;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}

.btn-chem:hover,
.btn-chem:focus {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.34);
}

/* Làm dịu các nút viền tối (Thao tác nhanh, nút phụ) thay vì nền đen gắt khi hover */
.btn-outline-dark {
  color: #1e293b;
  border-color: #dbe4f0;
  background-color: #ffffff;
  transition: background-color 0.2s var(--ease-out), border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-out), box-shadow 0.2s ease;
}

.btn-outline-dark:hover,
.btn-outline-dark:focus-visible,
.btn-outline-dark:active {
  color: #0369a1 !important;
  background-color: #f0f7ff !important;
  border-color: #93c5fd !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
  transform: translateY(-1px);
}

.form-control,
.form-select {
  border-radius: 10px;
  border-color: #cbd5e1;
  background-color: rgba(255, 255, 255, 0.96);
  padding: 0.52rem 0.85rem;
}

.form-control-sm,
.form-select-sm {
  border-radius: 8px;
  padding: 0.36rem 0.68rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.18);
  background-color: #ffffff;
}

.vnd-live-hint {
  font-size: 0.78rem;
  font-weight: 600;
  color: #0369a1;
  margin-top: 0.25rem;
}

.badge {
  border-radius: 999px;
  font-weight: 600;
  padding: 0.35em 0.72em;
}

.table {
  --bs-table-bg: transparent;
}

.table > thead {
  background: rgba(241, 245, 249, 0.85);
}

.table > thead th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom-width: 1px;
  padding-top: 0.82rem;
  padding-bottom: 0.82rem;
}

.table > tbody > tr > td {
  padding-top: 0.82rem;
  padding-bottom: 0.82rem;
  border-color: rgba(226, 232, 240, 0.8);
}

.modal-content {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
}

.modal-header {
  border-bottom-color: #f1f5f9;
  padding: 1.15rem 1.4rem;
}

.modal-footer {
  border-top-color: #f1f5f9;
  padding: 0.95rem 1.4rem;
}

.alert {
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

/* Auth Card */
.auth-bg {
  min-height: 100vh;
  background-color: #f4f7fb;
  background-image:
    radial-gradient(at 15% 15%, rgba(186, 230, 253, 0.36) 0px, transparent 52%),
    radial-gradient(at 85% 20%, rgba(224, 231, 255, 0.34) 0px, transparent 52%),
    radial-gradient(at 50% 90%, rgba(204, 251, 241, 0.26) 0px, transparent 55%),
    linear-gradient(155deg, #f8fafc 0%, #f1f6fc 50%, #edf3fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 450px;
  background: var(--glass-strong);
  backdrop-filter: blur(18px);
  border-radius: 22px;
  border: 1px solid #ffffff;
  box-shadow: 0 18px 45px rgba(2, 132, 199, 0.12);
  padding: 2.35rem;
}

/* Khung mô phỏng cửa sổ chat Zalo trực quan */
.zalo-preview-frame {
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  background: #eef0f3;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.zalo-preview-header {
  background: linear-gradient(135deg, #0068ff, #0284c7);
  color: #ffffff;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.zalo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.zalo-preview-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-height: 220px;
  background-image: radial-gradient(rgba(148, 163, 184, 0.18) 1px, transparent 1px);
  background-size: 16px 16px;
}

.zalo-bubble {
  max-width: 94%;
  background: #e5efff;
  border: 1px solid #c7ddff;
  color: #0f172a;
  border-radius: 14px 14px 3px 14px;
  padding: 0.8rem 0.95rem;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}

.zalo-bubble .zalo-link-highlight {
  color: #0068ff;
  text-decoration: underline;
  font-weight: 500;
}

.zalo-bubble-meta {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 0.35rem;
  text-align: right;
}

.zalo-preview-footer {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  padding: 0.55rem 0.9rem;
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar-hideable {
    display: none;
  }
  .app-main {
    margin-left: calc(var(--sidebar-collapsed) + 20px);
  }
  .topbar-search {
    width: 100%;
    order: 3;
  }
}

/* Đảm bảo hiệu ứng trượt Sidebar, Thẻ và Modal luôn mượt ngay cả khi Windows tắt hiệu ứng cửa sổ hệ thống */
.modal.fade .modal-dialog {
  transition: transform 0.28s var(--ease-out), opacity 0.22s ease !important;
}

