/* x.css — bang mau + thanh phan dung chung cho toan bo tester.alphavn.online.
   Lay dung token tu He Thiet Ke X (accent teal #0B6B7A, khong dung mau tim
   cua Xeko rieng - day la trang CHUONG TRINH chung, khong phai app rieng).
*/

:root {
  --bg-page: #F4F5F6;
  --surface: #FFFFFF;
  --surface-2: #F4F5F6;
  --text-1: #111418;
  --text-2: #5B6672;
  --line: #E2E6EA;

  --success: #12805C;
  --warning: #B25E00;
  --error: #C0362C;

  --accent: #0B6B7A;
  --accent-soft: #0F8EA3;
  --on-accent: #FFFFFF;
  --accent-wash: rgba(11, 107, 122, .1);

  --font-sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --shadow-1: 0 1px 2px rgba(16,24,32,.06), 0 2px 6px rgba(16,24,32,.05);
  --shadow-2: 0 2px 4px rgba(16,24,32,.07), 0 8px 18px rgba(16,24,32,.08);
  --shadow-3: 0 6px 12px rgba(16,24,32,.10), 0 18px 40px rgba(16,24,32,.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0D1417; --surface: #131F24; --surface-2: #0D1417;
    --text-1: #E8EEF1; --text-2: #93A3AC; --line: #22323A;
    --success: #3DD6A0; --warning: #F0A73C; --error: #FF7A6E;
    --accent-wash: rgba(15, 142, 163, .18);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-page); color: var(--text-1); font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased; padding-bottom: 96px;
  /* [3/9] 96px chua cho nut chat noi (cao 52px + margin 16px) khong de len
     noi dung/nut bam cuoi trang - da bat gap that luc kiem bang mat. */
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-soft); }
img { max-width: 100%; }

.wrap { max-width: 520px; margin: 0 auto; padding: 0 20px; }

/* === header === */
.dau-trang {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
@media (prefers-color-scheme: dark) { .dau-trang { background: rgba(13,20,23,.85); } }
.dau-trang .bao { max-width: 520px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 10px; }
.hieu-x {
  width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.dau-trang .ten { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.dau-trang .ten b { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dau-trang .ten span { font-size: 13px; color: var(--text-2); }
.nut-ve-trang-chu {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px;
  border-radius: var(--radius-sm); background: transparent; border: none; color: var(--text-1);
  font-family: var(--font-sans); font-size: 14px; font-weight: 500; white-space: nowrap; cursor: pointer;
}
.nut-ve-trang-chu:hover { background: var(--surface-2); }

/* === typography === */
h1 { font-size: 30px; line-height: 1.2; font-weight: 700; margin: 0 0 12px; letter-spacing: -.02em; }
h2 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
h3 { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
p { margin: 0; }
.mo-ta { font-size: 15px; color: var(--text-2); margin: 0 0 16px; }
@media (max-width: 640px) { h1 { font-size: 26px; } }

/* === button === */
.nut {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px; border-radius: var(--radius-sm); border: none;
  font-family: var(--font-sans); font-size: 16px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; transition: transform .12s, opacity .12s;
}
.nut:hover { opacity: .92; }
.nut:active { transform: scale(.98); }
.nut:disabled { opacity: .4; cursor: not-allowed; }
.nut-phu {
  background: var(--surface); color: var(--text-1); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.nut-nho { height: 44px; font-size: 15px; }

/* === badge / chip === */
.nhan {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: var(--radius-full); font-size: 13px; font-weight: 600;
}
.nhan-tim { background: var(--accent-wash); color: var(--accent); }
.nhan-trung { background: var(--surface-2); color: var(--text-2); }
.nhan-canh-bao { background: rgba(178,94,0,.12); color: var(--warning); }
.nhan-thanh-cong { background: rgba(18,128,92,.12); color: var(--success); }

.chip {
  display: inline-flex; align-items: center; height: 36px; padding: 0 14px;
  border-radius: var(--radius-full); border: 1px solid var(--line); background: var(--surface);
  color: var(--text-1); font-family: var(--font-sans); font-size: 14px; font-weight: 500; cursor: pointer;
}
.chip.dang-chon { background: var(--accent); border-color: var(--accent); color: #fff; }

/* === card === */
.the {
  background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-1); padding: 16px;
}
.the-vien { background: var(--surface); border-radius: var(--radius-md); border: 1px solid var(--line); padding: 16px; }
.the-nhan { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }

/* === icon vien tron === */
.icon-tron {
  width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--surface-2);
  color: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-tron svg { width: 20px; height: 20px; }

/* === icon outline chuan (stroke, khong to dac - khong dung emoji) === */
.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: -3px; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }

/* === so thu tu === */
.so-buoc {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; flex-shrink: 0;
}

/* === form === */
label.nhan-o { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 8px; }
input[type="text"], input[type="email"], textarea {
  width: 100%; box-sizing: border-box; height: 48px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface);
  font-family: var(--font-sans); font-size: 16px; color: var(--text-1);
}
textarea { height: auto; padding: 14px; line-height: 1.55; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.trg-gop-y { font-size: 13px; color: var(--text-2); margin-top: 8px; }
.o-nhap { display: flex; flex-direction: column; gap: 18px; }

/* === thanh tien do === */
.thanh-nen { height: 8px; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden; }
.thanh-day { height: 100%; border-radius: var(--radius-full); background: var(--accent); }
.thanh-day.xanh { background: var(--success); }
.thanh-chu { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }

/* === khoi nhac === */
.khoi-nhac {
  border: 1px solid var(--accent); background: var(--accent-wash); border-radius: var(--radius-md); padding: 16px; margin: 20px 0;
}
.khoi-canh-bao {
  border: 1px solid var(--warning); border-radius: var(--radius-md); padding: 16px; background: var(--surface);
}

/* === khung chat noi (bot cua chuong trinh) === */
.bot-nut {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px;
  border-radius: var(--radius-full); border: none; background: var(--accent); color: #fff;
  font-family: var(--font-sans); font-size: 16px; font-weight: 600; box-shadow: var(--shadow-2); cursor: pointer;
}
.bot-khung {
  position: fixed; right: 16px; bottom: 80px; z-index: 40;
  width: 340px; max-width: calc(100vw - 32px); height: 460px; max-height: calc(100vh - 140px);
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  border: 1px solid var(--line); display: none; flex-direction: column; overflow: hidden;
}
.bot-khung.mo { display: flex; }
.bot-dau { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bot-tieu-de { font-size: 16px; font-weight: 600; flex: 1; }
.bot-dong { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-2); padding: 0 4px; }
.bot-than { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bot-loi { max-width: 86%; padding: 12px 16px; font-size: 15px; line-height: 1.6; border-radius: 16px; white-space: pre-wrap; }
.bot-loi-nguoi { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 16px 16px 6px 16px; }
.bot-loi-may { align-self: flex-start; background: var(--surface-2); color: var(--text-1); border-radius: 16px 16px 16px 6px; }
.bot-dang-go { display: flex; align-items: center; gap: 8px; }
.bot-logo-xoay { flex-shrink: 0; animation: xekoXoay 1.1s linear infinite; }
@keyframes xekoXoay { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .bot-logo-xoay { animation: none; } }
.bot-chan { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.bot-chan input { flex: 1; height: 40px; }
.bot-chan button {
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: none;
  background: var(--accent); color: #fff; font-family: var(--font-sans); font-weight: 600; cursor: pointer;
}

summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; flex: 0 0 20px; width: 12px; height: 12px; margin-left: auto;
  border-right: 2px solid var(--text-2); border-bottom: 2px solid var(--text-2);
  transform: rotate(45deg); transition: transform .15s;
}
details[open] summary::after { transform: rotate(-135deg); }

footer.chan-trang { padding: 32px 0 8px; border-top: 1px solid var(--line); margin-top: 32px; }
footer.chan-trang .ten { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
footer.chan-trang p { font-size: 14px; line-height: 1.6; color: var(--text-2); margin: 0 0 12px; }
