/* xeko.css — bang mau + thanh phan dung chung cho CA trang gioi thieu lan trang docs.
   Gom: (1) bien mau/khoang cach, (2) nen-tang chu, (3) thanh phan lap lai (nut, the,
        header, footer, khung chat).
   Quan he: index.html va docs.html deu chi nap DUY NHAT file nay - khong file css nao khac.

   Mau lay dung tu app that (app/lib/ui/app_theme.dart) de web va app khong lech nhau:
     tim chu dao #6D4AA7 - muc tim #2A1A47 - cam meo #DB8B00
     den 3 muc: xanh #2E9E5B - vang #B78A00 - cam #D9601A
*/

:root {
  --tim: #6D4AA7;
  --tim-dam: #55388A;
  --tim-nhat: #F2EDFA;
  --muc-tim: #2A1A47;

  --den-xanh: #2E9E5B;
  --den-vang: #B78A00;
  --den-cam: #D9601A;
  --cam-meo: #DB8B00;

  --chu: #1C1A22;
  --chu-nhat: #5C5867;
  --chu-mo: #8A8695;

  --nen: #FFFFFF;
  --nen-2: #F7F5FB;
  --nen-3: #EFECF6;
  --vien: #E3DFEC;

  --bk-sm: 8px;
  --bk: 12px;
  --bk-lg: 18px;

  --rong: 1100px;
  --rong-hep: 760px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ma: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tim: #A88BD9;
    --tim-dam: #C2AAEA;
    --tim-nhat: #241B36;
    --muc-tim: #EDE7F8;

    --den-xanh: #4CC47B;
    --den-vang: #D9AE2E;
    --den-cam: #F0813E;

    --chu: #ECE9F2;
    --chu-nhat: #B0AABF;
    --chu-mo: #837D93;

    --nen: #14111C;
    --nen-2: #1B1726;
    --nen-3: #241F31;
    --vien: #322B42;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--chu);
  background: var(--nen);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.3; color: var(--chu); margin: 0 0 12px; }
h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.5px; }
h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.3px; }
h3 { font-size: 21px; font-weight: 700; }
h4 { font-size: 18px; font-weight: 600; }

p { margin: 0 0 16px; }
a { color: var(--tim); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-ma);
  font-size: 0.9em;
  background: var(--nen-3);
  padding: 2px 6px;
  border-radius: var(--bk-sm);
}

img { max-width: 100%; height: auto; display: block; }

/* --- Bo cuc --- */
.bao { max-width: var(--rong); margin: 0 auto; padding: 0 24px; }
.bao-hep { max-width: var(--rong-hep); margin: 0 auto; padding: 0 24px; }
.khoang { padding: 72px 0; }
.khoang-nho { padding: 44px 0; }
.nen-phu { background: var(--nen-2); }

/* --- Header --- */
.dau-trang {
  position: sticky; top: 0; z-index: 50;
  background: var(--nen);
  border-bottom: 1px solid var(--vien);
}
.dau-trang .bao { display: flex; align-items: center; gap: 20px; height: 66px; }
.hieu { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--chu); }
.hieu:hover { text-decoration: none; }
.hieu-dau {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--tim); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px;
}
.dieu-huong { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.dieu-huong a { color: var(--chu-nhat); font-size: 15px; font-weight: 500; }
.dieu-huong a:hover { color: var(--tim); text-decoration: none; }

/* --- Nut --- */
.nut {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  border-radius: var(--bk);
  font-size: 16px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity .15s, background .15s;
}
.nut:hover { text-decoration: none; opacity: .88; }
.nut-chinh { background: var(--tim); color: #fff; }
.nut-phu { background: transparent; color: var(--chu); border-color: var(--vien); }
.nut-phu:hover { background: var(--nen-2); opacity: 1; }
.nut[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* --- The --- */
.the {
  background: var(--nen);
  border: 1px solid var(--vien);
  border-radius: var(--bk-lg);
  padding: 26px;
}
.luoi { display: grid; gap: 20px; }
.luoi-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.luoi-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* --- Den 3 mau (dung o ca 2 trang) --- */
.den { display: inline-block; width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; }
.den-xanh { background: var(--den-xanh); }
.den-vang { background: var(--den-vang); }
.den-cam  { background: var(--den-cam); }

/* --- Vien thiet bi (khung dien thoai boc anh chup app) --- */
.dien-thoai {
  border: 8px solid var(--muc-tim);
  border-radius: 30px;
  overflow: hidden;
  background: var(--muc-tim);
  max-width: 270px;
  box-shadow: 0 12px 40px rgba(42, 26, 71, .18);
}
.dien-thoai img { border-radius: 22px; }

/* --- Footer --- */
.chan-trang {
  border-top: 1px solid var(--vien);
  background: var(--nen-2);
  padding: 40px 0;
  font-size: 15px;
  color: var(--chu-nhat);
}
.chan-trang a { color: var(--chu-nhat); }
.chan-trang a:hover { color: var(--tim); }

/* --- Khung chat bot (nut noi goc phai duoi) --- */
.bot-nut {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--tim); color: #fff;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 22px rgba(109, 74, 167, .4);
}
.bot-khung {
  position: fixed; right: 22px; bottom: 90px; z-index: 100;
  width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 130px);
  background: var(--nen);
  border: 1px solid var(--vien);
  border-radius: var(--bk-lg);
  box-shadow: 0 16px 50px rgba(42, 26, 71, .22);
  display: none; flex-direction: column; overflow: hidden;
}
.bot-khung.mo { display: flex; }
.bot-dau {
  padding: 14px 18px; border-bottom: 1px solid var(--vien);
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 16px;
}
.bot-than { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bot-loi { max-width: 85%; padding: 10px 14px; border-radius: var(--bk); font-size: 15px; line-height: 1.6; }
.bot-loi-nguoi { align-self: flex-end; background: var(--tim); color: #fff; }
.bot-loi-may { align-self: flex-start; background: var(--nen-3); color: var(--chu); }
.bot-chan { padding: 12px; border-top: 1px solid var(--vien); display: flex; gap: 8px; }
.bot-chan input {
  flex: 1; padding: 11px 14px; font-size: 15px; font-family: var(--font);
  border: 1px solid var(--vien); border-radius: var(--bk);
  background: var(--nen); color: var(--chu);
}
.bot-chan input:focus { outline: 2px solid var(--tim); outline-offset: -1px; }
.bot-chan button {
  padding: 11px 18px; border-radius: var(--bk);
  background: var(--tim); color: #fff; border: none;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.bot-chan button:disabled { opacity: .5; cursor: not-allowed; }

/* --- Docs: bo cuc 2 cot --- */
.docs-khung { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 44px; align-items: start; }
.docs-le {
  position: sticky; top: 90px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  padding-bottom: 20px;
}
.docs-le h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--chu-mo); margin: 22px 0 8px; }
.docs-le h4:first-child { margin-top: 0; }
.docs-le a {
  display: block; padding: 7px 12px; margin-bottom: 2px;
  border-radius: var(--bk-sm);
  font-size: 15px; color: var(--chu-nhat);
}
.docs-le a:hover { background: var(--nen-2); text-decoration: none; }
.docs-le a.dang-xem { background: var(--tim-nhat); color: var(--tim); font-weight: 600; }
.docs-bai { min-width: 0; }
.docs-bai section { scroll-margin-top: 90px; padding-bottom: 40px; }

.o-tim {
  width: 100%; padding: 11px 14px; font-size: 15px; font-family: var(--font);
  border: 1px solid var(--vien); border-radius: var(--bk);
  background: var(--nen); color: var(--chu); margin-bottom: 14px;
}
.o-tim:focus { outline: 2px solid var(--tim); outline-offset: -1px; }
.khong-thay { color: var(--chu-mo); font-size: 15px; padding: 8px 12px; display: none; }

@media (max-width: 860px) {
  h1 { font-size: 31px; }
  h2 { font-size: 24px; }
  .khoang { padding: 48px 0; }
  .docs-khung { grid-template-columns: 1fr; gap: 24px; }
  .docs-le { position: static; max-height: none; }
  .dieu-huong { gap: 14px; }
  .dieu-huong a { font-size: 14px; }
  .bot-khung { right: 12px; left: 12px; width: auto; bottom: 84px; }
}
