/* ==========================================================================
   COOJ mini — hệ thiết kế
   Một chỗ duy nhất định nghĩa màu, giãn cách, kiểu chữ và các thành phần
   dùng lại. Mọi trang đều dựng từ những khối ở đây để nhìn nhất quán.
   ========================================================================== */

:root {
  /* Màu nền và chữ */
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Màu thương hiệu */
  --brand: #1d4ed8;
  --brand-dark: #1e40af;
  --brand-soft: #eff6ff;
  --header: #0f172a;

  /* Màu trạng thái */
  --ac: #16a34a;      --ac-bg: #dcfce7;
  --wa: #dc2626;      --wa-bg: #fee2e2;
  --tle: #d97706;     --tle-bg: #fef3c7;
  --re: #7c3aed;      --re-bg: #ede9fe;
  --mle: #0891b2;     --mle-bg: #cffafe;
  --warn: #b45309;    --warn-bg: #fffbeb;

  /* Giãn cách */
  --s1: 0.25rem;  --s2: 0.5rem;   --s3: 0.75rem;
  --s4: 1rem;     --s5: 1.5rem;   --s6: 2rem;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
}

a { color: var(--brand); }

/* ==========================================================================
   Thanh điều hướng
   ========================================================================== */
.navbar {
  background: var(--header);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.navbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 52px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 1.05rem; color: #fff;
  text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.nav-links a {
  color: #cbd5e1; text-decoration: none; font-size: 0.9rem;
  padding: var(--s1) var(--s3); border-radius: var(--radius-sm);
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.nav-links a.active { color: #fff; background: rgba(255, 255, 255, .16); font-weight: 600; }

/* Nhóm mục quản trị tách khỏi mục thường bằng một vạch dọc */
.nav-admin { display: flex; gap: var(--s1); flex-wrap: wrap; padding-left: var(--s3);
  margin-left: var(--s1); border-left: 1px solid rgba(255, 255, 255, .18); }
.nav-admin a { color: #93c5fd; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
.nav-user { color: #e2e8f0; font-size: 0.88rem; white-space: nowrap; }
.nav-logout { color: #fca5a5 !important; }

.tag {
  background: var(--brand); color: #fff; font-size: 0.68rem; font-weight: 700;
  padding: 1px 6px; border-radius: 4px; margin-left: var(--s1);
  vertical-align: middle; letter-spacing: .02em; white-space: nowrap;
}

/* ==========================================================================
   Khung trang, tiêu đề, breadcrumb
   ========================================================================== */
.container { max-width: 1180px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s6); }
.container-narrow { max-width: 760px; }

.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: var(--s3); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs span { margin: 0 var(--s1); }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4);
}
.page-head h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; }
.page-head .sub { color: var(--muted); font-size: 0.88rem; margin-top: var(--s1); }
.page-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

h2 { font-size: 1.1rem; margin: var(--s6) 0 var(--s3); }
h3 { font-size: 0.98rem; margin: var(--s5) 0 var(--s2); }

/* ==========================================================================
   Thẻ / panel
   ========================================================================== */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: var(--s4);
}
.panel-head {
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 0.98rem; }
.panel-body { padding: var(--s4); }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }

/* Giữ tên cũ để các trang chưa chuyển vẫn hiển thị được */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4);
  box-shadow: var(--shadow);
}
.auth-card { max-width: 380px; margin: 12vh auto; }

/* ==========================================================================
   Hàng thẻ số liệu
   ========================================================================== */
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s3); margin-bottom: var(--s4);
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s3) var(--s4); box-shadow: var(--shadow);
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.stat-card.is-good .stat-value { color: var(--ac); }
.stat-card.is-warn .stat-value { color: var(--wa); }

/* ==========================================================================
   Biểu đồ quạt (conic-gradient, không cần thư viện ngoài)
   ========================================================================== */
.pie-wrap { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.pie {
  width: 132px; height: 132px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .08);
}
.pie-legend { display: flex; flex-direction: column; gap: var(--s1); font-size: 0.87rem; min-width: 160px; }
.pie-legend div { display: flex; align-items: center; gap: var(--s2); }
.pie-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.pie-legend .n { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.chart-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: var(--s4);
}

/* ==========================================================================
   Bảng dữ liệu
   ========================================================================== */
table.list, table.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: var(--s4);
}
table.list th, table.list td,
table.data-table th, table.data-table td {
  text-align: left; padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
table.list th, table.data-table th {
  background: var(--surface-2); font-size: 0.78rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
table.list tr:last-child td, table.data-table tr:last-child td { border-bottom: none; }
table.list tbody tr:hover, table.data-table tbody tr:hover { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }

.empty { color: var(--muted); text-align: center; padding: var(--s6) var(--s4); }

/* ==========================================================================
   Nút và form
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s4); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-size: 0.88rem; font-weight: 600; cursor: pointer; text-decoration: none;
  font-family: inherit; line-height: 1.4; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--wa); border-color: #fecaca; }
.btn-danger:hover { background: var(--wa-bg); }
.btn-sm { padding: var(--s1) var(--s2); font-size: 0.8rem; }

label { display: block; margin: var(--s3) 0; font-weight: 600; font-size: 0.87rem; }
label.checkbox { font-weight: 400; display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0; }
label.checkbox input { width: auto; margin: 0; }

input[type=text], input[type=password], input[type=number], input[type=search],
input[type=date], input[type=datetime-local], input[type=file], textarea, select {
  width: 100%; padding: var(--s2) var(--s3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 0.9rem; font-family: inherit; margin-top: var(--s1);
  background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
textarea { resize: vertical; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-top: var(--s1); }

.form-row { display: flex; gap: var(--s4); flex-wrap: wrap; }
.form-row > label { flex: 1; min-width: 200px; }
.inline-form { display: inline-block; margin: 0; }
.checkbox-inline { display: block; font-weight: 600; margin: var(--s3) 0; }
.checkbox-inline input { margin-right: var(--s2); }
.checkbox-inline .hint { display: inline; margin-left: var(--s1); }
.action-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

.filter-bar {
  display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s3) var(--s4);
  margin-bottom: var(--s4); box-shadow: var(--shadow);
}
.filter-bar label { margin: 0; font-size: 0.78rem; color: var(--muted); }
.filter-bar select, .filter-bar input { min-width: 150px; }

/* ==========================================================================
   Thông báo
   ========================================================================== */
.flash {
  padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  margin-bottom: var(--s3); font-size: 0.9rem; border: 1px solid;
}
.flash-error { background: var(--wa-bg); color: #991b1b; border-color: #fecaca; }
.flash-success { background: var(--ac-bg); color: #166534; border-color: #bbf7d0; }

/* ==========================================================================
   Nhãn: verdict, phân loại, trạng thái
   ========================================================================== */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
}
.badge-ac { background: var(--ac-bg); color: var(--ac); }
.badge-wa { background: var(--wa-bg); color: var(--wa); }
.badge-tle { background: var(--tle-bg); color: var(--tle); }
.badge-re { background: var(--re-bg); color: var(--re); }
.badge-mle { background: var(--mle-bg); color: var(--mle); }
.badge-partial { background: var(--tle-bg); color: var(--tle); }
.badge-none { background: #f1f5f9; color: var(--muted); }
.badge-draft { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.badge-hw { background: var(--brand-soft); color: var(--brand); }
.badge-today { background: var(--re-bg); color: var(--re); }
.badge-hw-done { background: var(--ac-bg); color: var(--ac); }
.badge-hw-done_late { background: var(--tle-bg); color: var(--tle); }
.badge-hw-todo { background: var(--brand-soft); color: var(--brand); }
.badge-hw-overdue { background: var(--wa-bg); color: var(--wa); }
.badge-admin-only { background: var(--re-bg); color: var(--re); }

.tag-cat {
  display: inline-block; background: var(--brand-soft); color: var(--brand-dark);
  font-size: 0.76rem; font-weight: 600; padding: 1px 8px;
  border-radius: var(--radius-sm); margin-right: var(--s1);
}
.tag-none { background: #f1f5f9; color: var(--muted); }
.tag-diff {
  display: inline-block; background: #f1f5f9; color: var(--muted);
  font-size: 0.76rem; font-weight: 600; padding: 1px 8px; border-radius: var(--radius-sm);
}
.tag-diff-Dễ { background: var(--ac-bg); color: var(--ac); }
.tag-diff-Trung-bình { background: var(--tle-bg); color: var(--tle); }
.tag-diff-Khó { background: var(--wa-bg); color: var(--wa); }

/* ==========================================================================
   Trang bài: 2 cột
   ========================================================================== */
.problem-layout { display: flex; gap: var(--s5); align-items: flex-start; }
.problem-main { flex: 1 1 0; min-width: 0; }
.problem-side { flex: 0 0 268px; position: sticky; top: 68px; }
@media (max-width: 900px) {
  .problem-layout { flex-direction: column; }
  .problem-side { flex: 1 1 auto; width: 100%; position: static; }
}

.statement { white-space: pre-wrap; word-wrap: break-word; line-height: 1.65; }
.meta-row { display: flex; gap: var(--s4); flex-wrap: wrap; color: var(--muted); font-size: 0.85rem; }

/* Khối input/output — dùng cho cả ví dụ lẫn kết quả chấm */
.io-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s3); margin: var(--s3) 0;
}
.io-box { min-width: 0; }
.io-label {
  font-size: 0.74rem; color: var(--muted); font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: var(--s1);
}
.io-box pre, pre.tc-cell, pre.code-view {
  background: #0f172a; color: #e2e8f0; padding: var(--s3);
  border-radius: var(--radius-sm); overflow-x: auto; margin: 0;
  font-size: 0.84rem; font-family: var(--mono); white-space: pre;
  line-height: 1.5;
}
.io-box pre { max-height: 220px; overflow: auto; }
pre.tc-cell { max-width: 240px; max-height: 120px; overflow: auto; font-size: 0.78rem; }
pre.code-view { padding: var(--s4); font-size: 0.86rem; }

/* Cũ — vài trang còn dùng */
.sample { display: flex; gap: var(--s4); margin: var(--s3) 0; flex-wrap: wrap; }
.sample-col { flex: 1; min-width: 190px; }
.sample-label { font-size: 0.74rem; color: var(--muted); font-weight: 700; margin-bottom: var(--s1); }
.sample pre { background: #0f172a; color: #e2e8f0; padding: var(--s3);
  border-radius: var(--radius-sm); overflow-x: auto; margin: 0;
  font-size: 0.84rem; font-family: var(--mono); white-space: pre; }

/* ==========================================================================
   Kết quả chấm — THẺ chiếm trọn chiều ngang
   (trước đây nhét vào một ô của bảng nên bị bóp lại, thừa khoảng trống)
   ========================================================================== */
.verdict-banner {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s4); border-radius: var(--radius); margin-bottom: var(--s4);
  font-weight: 700; border: 1px solid;
}
.verdict-banner .big { font-size: 1.15rem; }
.verdict-banner .score { margin-left: auto; font-weight: 600; font-size: 0.92rem; }
.verdict-AC { background: var(--ac-bg); color: var(--ac); border-color: #bbf7d0; }
.verdict-WA { background: var(--wa-bg); color: var(--wa); border-color: #fecaca; }
.verdict-TLE { background: var(--tle-bg); color: var(--tle); border-color: #fde68a; }
.verdict-RE { background: var(--re-bg); color: var(--re); border-color: #ddd6fe; }
.verdict-MLE { background: var(--mle-bg); color: var(--mle); border-color: #a5f3fc; }
.verdict-PARTIAL { background: var(--tle-bg); color: var(--tle); border-color: #fde68a; }

.test-list { display: flex; flex-direction: column; gap: var(--s2); }
.test-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.test-card.is-fail { border-color: #fecaca; }
.test-card.is-admin-only { border-color: #ddd6fe; }
.test-card-head {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  padding: var(--s3) var(--s4); background: var(--surface-2);
}
.test-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.test-msg { color: var(--ink-2); font-size: 0.87rem; }
.test-mem { margin-left: auto; color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.test-card-body { padding: var(--s3) var(--s4) var(--s4); border-top: 1px solid var(--border); }

.vis-example { color: var(--ac); font-weight: 700; font-size: 0.78rem; }
.vis-public  { color: var(--brand); font-weight: 700; font-size: 0.78rem; }
.vis-hidden  { color: var(--muted); font-weight: 700; font-size: 0.78rem; }
.vis-legend { margin: 0 0 var(--s3); padding-left: var(--s5); color: var(--muted); font-size: 0.85rem; }
.vis-legend li { margin: 2px 0; }

/* ==========================================================================
   Cột phải trang bài
   ========================================================================== */
.side-panel { margin-bottom: var(--s3); }
.side-panel .panel-head { padding: var(--s2) var(--s3); }
.side-panel .panel-head h3 { font-size: 0.85rem; }
.side-panel .panel-body { padding: var(--s2); }
.sub-list { max-height: 290px; overflow-y: auto; }
.sub-row {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s2);
  border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); font-size: 0.82rem;
}
.sub-row:hover { background: var(--brand-soft); }
.sub-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-time { margin-left: auto; color: var(--muted); font-size: 0.74rem; white-space: nowrap; }
.sub-user { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Trình soạn code
   ========================================================================== */
.editor-wrap {
  display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius);
  overflow: hidden; background: #0f172a; margin-top: var(--s2);
}
.line-numbers {
  padding: var(--s3) var(--s2); text-align: right; color: #64748b;
  background: #0b1120; font-family: var(--mono); font-size: 0.86rem;
  line-height: 1.55; user-select: none; white-space: pre; min-width: 2.6rem;
}
.editor-wrap textarea {
  flex: 1; border: none; border-radius: 0; margin: 0; min-height: 260px;
  padding: var(--s3); background: #0f172a; color: #e2e8f0;
  font-family: var(--mono); font-size: 0.86rem; line-height: 1.55;
  white-space: pre; overflow-wrap: normal; tab-size: 4;
}
.editor-wrap textarea:focus { outline: none; box-shadow: none; }

/* ==========================================================================
   Chip gợi ý chủ đề
   ========================================================================== */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.chip {
  border: 1px solid var(--border-strong); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 2px 11px; font-size: 0.78rem;
  cursor: pointer; font-family: inherit;
}
.chip:hover { background: var(--surface-2); }
.chip-active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ==========================================================================
   Contest, BTVN, các phần còn lại
   ========================================================================== */
.contest-banner {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: var(--brand-soft); border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: var(--s3) var(--s4); margin-bottom: var(--s4);
}
.countdown { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.row-pin-hw { background: var(--brand-soft) !important; }
.row-pin-today { background: #faf5ff !important; }

.publish-box { border-color: #fde68a; background: var(--warn-bg); }

.ai-card { border-color: #ddd6fe; background: #faf5ff; }
.ai-card h2 { color: var(--re); }

.preview-banner {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--brand-soft); border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: var(--s3) var(--s4); margin-bottom: var(--s4);
  color: var(--ink-2);
}
.warning-list { margin: 0 0 var(--s2); padding-left: var(--s5); color: var(--warn); }
.warning-list li { margin: 2px 0; }

.quick-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }

.brand-class { font-weight: 500; color: #cbd5e1; font-size: 0.9em; }

.backup-list td.backup-name { font-family: var(--mono, monospace); font-size: 0.85rem; }
.settings-section { margin-bottom: var(--s5); }

.student-picker {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5);
  padding: var(--s3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); margin-bottom: var(--s3);
}
.student-picker .checkbox { margin: 0; }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: var(--s2) 0; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: none; }

.muted { color: var(--muted); font-size: 0.87rem; }
.danger-zone { border-color: #fecaca; }
.mono { font-family: var(--mono); font-size: 0.85rem; }

@media (max-width: 640px) {
  .container { padding: var(--s4) var(--s3) var(--s5); }
  .page-head h1 { font-size: 1.25rem; }
  .nav-admin { border-left: none; padding-left: 0; margin-left: 0; }
  .navbar-inner { gap: var(--s3); }
}

/* ==========================================================================
   Hộp báo "vừa online" — góc phải dưới, dành cho giáo viên
   ========================================================================== */
.toast-khung {
  position: fixed;
  right: var(--s4);
  bottom: var(--s4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  align-items: flex-end;
  pointer-events: none;   /* khung chỉ để xếp chỗ, không chắn chuột */
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--ac);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  font-size: .9rem;
  color: var(--ink);
  max-width: min(20rem, calc(100vw - 2 * var(--s4)));
  animation: toast-vao .25s ease-out;
}

.toast-chu { flex: 1; }

.toast-dong {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 var(--s1);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.toast-dong:hover { color: var(--ink); background: var(--surface-2); }

/* Trượt vào từ bên phải */
@keyframes toast-vao {
  from { opacity: 0; transform: translateX(1.5rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Hết giờ: thụt ngược về bên phải */
.toast-thut-ra {
  animation: toast-ra .35s ease-in forwards;
}
@keyframes toast-ra {
  to { opacity: 0; transform: translateX(120%); }
}

/* Bấm ×: mờ dần tại chỗ, không trượt */
.toast-mo-dan {
  animation: toast-mo .3s ease-out forwards;
}
@keyframes toast-mo {
  to { opacity: 0; }
}

/* Người đặt hệ thống ở chế độ giảm chuyển động thì bỏ trượt, chỉ mờ. */
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .toast-thut-ra, .toast-mo-dan { animation: toast-mo .2s ease-out forwards; }
}
