@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════════════
   bcel-toolkit — shared theme  "ແດງ-ຂາວ" (Lao Red & White, LIGHT)
   Bootstrap 5 light theme + FontAwesome + SweetAlert2
   สีหลัก: แดงธนาคาร BCEL (#C62828) + ขาว + ทองลาว (#E0A800) เป็นสีเน้น
   ═══════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Noto Sans Lao Looped';
  src: url('/fonts/lao.woff2') format('woff2');
  font-display: swap;
}

:root {
  --lao-red: #c62828;
  --lao-red-2: #b71c1c;
  --lao-red-dark: #8e1414;
  --lao-gold: #e0a800;
  --lao-gold-2: #c9a227;
  --brand-1: var(--lao-red);
  --brand-2: var(--lao-gold);
  --tk-green: #1f9d55;
  --tk-yellow: #d98e00;
  --tk-red: #d32f2f;

  --bs-body-bg: #ffffff;
  --bs-body-color: #33201f;
  --bs-body-color-rgb: 51, 32, 31;
  --bs-emphasis-color: #1f1414;
  --bs-secondary-color: #8a6a6a;
  --bs-heading-color: #241717;
  --bs-border-color: #f0d3d3;
  --bs-border-color-translucent: rgba(198, 40, 40, .18);
  --bs-primary: var(--lao-red);
  --bs-primary-rgb: 198, 40, 40;
  --bs-link-color: var(--lao-red-2);
  --bs-link-hover-color: #8e1414;
  --bs-tertiary-bg: #fdf4f4;
  --bs-secondary-bg: #fbecec;
}

body {
  min-height: 100dvh;
  font-family: 'Noto Sans Thai', 'Noto Sans Lao Looped', 'Noto Sans Lao', system-ui, sans-serif;
  background:
    radial-gradient(900px 460px at 90% -10%, rgba(224, 168, 0, .10), transparent 60%),
    radial-gradient(900px 520px at -5% 0%, rgba(198, 40, 40, .10), transparent 55%),
    #ffffff;
  color: var(--bs-body-color);
}

/* ── brand / navbar ──────────────────────────────────────── */
.tk-brand:not(.navbar-brand) {
  font-weight: 800;
  background: linear-gradient(92deg, var(--lao-red-2), #e05252 60%, var(--lao-gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: .2px;
}
.navbar {
  background: #ffffff !important;
  border-bottom: 1px solid var(--bs-border-color) !important;
  box-shadow: 0 2px 10px rgba(198, 40, 40, .05);
}
.navbar-brand.tk-brand, a.navbar-brand { font-weight: 800; color: var(--lao-red-2) !important; -webkit-text-fill-color: var(--lao-red-2); }
.navbar .nav-link { color: #6b4a4a; border-radius: 8px; padding: .35rem .65rem; }
.navbar .nav-link:hover { color: var(--lao-red-2); background: #fdeeee; }
.navbar .nav-link.active { color: #fff; background: var(--lao-red); }

.tk-shell { max-width: 860px; margin: 0 auto; }

.tk-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 22px rgba(198, 40, 40, .06);
}

.tk-icon-badge {
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fdecec, #fff6e0);
  color: var(--lao-red-2);
  border: 1px solid #f3d6d6;
}

/* ── buttons ─────────────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg: var(--lao-red);
  --bs-btn-border-color: var(--lao-red);
  --bs-btn-hover-bg: var(--lao-red-2);
  --bs-btn-hover-border-color: var(--lao-red-2);
  --bs-btn-active-bg: var(--lao-red-dark);
  --bs-btn-active-border-color: var(--lao-red-dark);
  --bs-btn-disabled-bg: #e7b4b4;
  --bs-btn-disabled-border-color: #e7b4b4;
  --bs-btn-color: #fff;
}
.btn-outline-primary {
  --bs-btn-color: var(--lao-red-2);
  --bs-btn-border-color: #e6b6b6;
  --bs-btn-hover-bg: var(--lao-red);
  --bs-btn-hover-border-color: var(--lao-red);
  --bs-btn-hover-color: #fff;
}
.btn-gold {
  --bs-btn-color: #4a3400;
  --bs-btn-bg: #ffcf3f;
  --bs-btn-border-color: #f0c02f;
  --bs-btn-hover-bg: #ffd964;
  --bs-btn-hover-border-color: #ffd964;
  --bs-btn-hover-color: #4a3400;
  font-weight: 700;
}
.btn-success { --bs-btn-bg: #1f9d55; --bs-btn-border-color: #1f9d55; --bs-btn-hover-bg: #188a49; --bs-btn-hover-border-color: #188a49; }

/* ── forms ───────────────────────────────────────────────── */
.form-control, .form-select {
  background-color: #fff;
  border-color: #e6c9c9;
  color: var(--bs-body-color);
}
.form-control:focus, .form-select:focus {
  background-color: #fff;
  border-color: var(--lao-red);
  box-shadow: 0 0 0 .2rem rgba(198, 40, 40, .14);
  color: #1f1414;
}
.form-control::placeholder { color: #b79595; }
.form-label { color: #5a3c3c; font-weight: 600; }

/* ── tables ──────────────────────────────────────────────── */
.table { --bs-table-bg: transparent; --bs-table-color: var(--bs-body-color); --bs-table-border-color: #f3dede; }
.table thead th { color: var(--lao-red-2); border-bottom-color: #eccaca !important; }
.table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #fdf3f3; }

/* ── badges ──────────────────────────────────────────────── */
.text-bg-primary, .badge.bg-primary { background-color: var(--lao-red) !important; color: #fff !important; }
.text-bg-gold { background: #ffcf3f; color: #4a3400; }
.text-bg-danger { background-color: #d32f2f !important; }

/* ── stepper / progress / log (เผื่อใช้) ─────────────────── */
.tk-stepper { display: flex; justify-content: center; align-items: center; gap: 6px; }
.tk-stepper .dot { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; border: 2px solid var(--bs-border-color); color: var(--bs-secondary-color); background: transparent; }
.tk-stepper .dot.active { border-color: var(--lao-red); color: var(--lao-red-2); background: #fdeeee; }
.tk-stepper .dot.done { border-color: var(--tk-green); color: #fff; background: var(--tk-green); }
.tk-stepper .dot-line { width: 22px; height: 2px; background: var(--bs-border-color); border-radius: 1px; }

.tk-log {
  background: #fff8f8; border: 1px solid #f0d3d3; border-radius: 10px;
  padding: 12px; font-family: Consolas, "Courier New", monospace; font-size: 11.5px;
  color: #7a4a1a; max-height: 240px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.tk-otp { text-align: center; font-size: 26px; letter-spacing: 10px; font-weight: 700; }
.tk-mono { font-family: Consolas, "Courier New", monospace; }
.tk-nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-hint { font-size: .78rem; color: var(--bs-secondary-color); }

.tk-spinner { width: 26px; height: 26px; border: 3px solid #f0d3d3; border-top-color: var(--lao-red); border-radius: 50%; animation: tk-spin .8s linear infinite; }
@keyframes tk-spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   ส่วนของแดชบอร์ดสมาชิก/แอดมิน (โทนแดง-ขาว)
   ═══════════════════════════════════════════════════════════ */
.tk-hero {
  border-radius: 18px; padding: 20px;
  background: linear-gradient(135deg, #b71c1c, #c62828 60%, #d84a4a);
  border: 1px solid #e0b0b0;
  box-shadow: 0 12px 30px rgba(198, 40, 40, .22);
  color: #fff;
}
.tk-balance { font-size: 2.1rem; font-weight: 800; color: var(--lao-red-2); line-height: 1.1; }
.tk-balance small { font-size: .95rem; color: var(--lao-gold-2); font-weight: 700; }

.tk-stat {
  border-radius: 14px; padding: 14px 16px; height: 100%;
  background: #ffffff; border: 1px solid var(--bs-border-color);
  box-shadow: 0 4px 16px rgba(198, 40, 40, .05);
}
.tk-stat .v { font-size: 1.35rem; font-weight: 800; color: var(--lao-red-2); }
.tk-stat .l { font-size: .78rem; color: var(--bs-secondary-color); }

.tk-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 576px) { .tk-menu { grid-template-columns: repeat(3, 1fr); gap: 8px; } }
.tk-menu a, .tk-menu button {
  text-decoration: none; color: var(--bs-body-color); text-align: center;
  border-radius: 14px; padding: 14px 8px; display: flex; flex-direction: column; gap: 8px; align-items: center;
  background: #fff; border: 1px solid var(--bs-border-color); transition: .15s; width: 100%; cursor: pointer;
}
.tk-menu a:hover, .tk-menu button:hover { border-color: var(--lao-red); box-shadow: 0 6px 16px rgba(198,40,40,.12); color: var(--lao-red-2); }
.tk-menu i { font-size: 1.35rem; color: var(--lao-red); }
.tk-menu span { font-size: .8rem; font-weight: 600; }

.tk-key {
  font-family: Consolas, monospace; background: #fff5f5; color: var(--lao-red-2);
  border: 1px dashed #e0a3a3; border-radius: 10px; padding: 10px 12px;
  word-break: break-all; font-size: .82rem;
}
.tk-pill { border-radius: 999px; padding: .2rem .6rem; font-size: .72rem; font-weight: 700; border: 1px solid #e6c9c9; background: #fdf3f3; color: #8a6a6a; }
.tk-pill.active { background: #e8f8ee; color: #157347; border-color: #b6e6c9; }
.tk-pill.expired, .tk-pill.revoked, .tk-pill.suspended { background: #fdecea; color: #b02a2a; border-color: #f0c0bb; }

.tk-section-title { font-weight: 800; color: var(--lao-red-2); display: flex; align-items: center; gap: 8px; }

.tk-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tk-tabs button { white-space: nowrap; border: 1px solid #e6c9c9; background: #fff; color: #7a5a5a; border-radius: 999px; padding: .35rem .9rem; font-size: .82rem; font-weight: 600; }
.tk-tabs button.active { background: var(--lao-red); color: #fff; border-color: var(--lao-red); }

.modal-content { background: #fff; border: 1px solid var(--bs-border-color); }
.modal-header, .modal-footer { border-color: var(--bs-border-color); }

.tk-muted { color: var(--bs-secondary-color); }
.tk-empty { text-align: center; padding: 26px 10px; color: var(--bs-secondary-color); }
.tk-flag { display:inline-block; width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(180deg, #c62828 0 33%, #1c3f94 33% 66%, #c62828 66% 100%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08) inset; vertical-align: -2px; }

/* ═══════════════════════════════════════════════════════════
   Layout แบบมี "สไลด์บาร์" (sidebar) — แดชบอร์ดลูกค้า
   ═══════════════════════════════════════════════════════════ */
.tk-app { min-height: 100dvh; }

.tk-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 252px; z-index: 1045;
  background: #ffffff;
  border-right: 1px solid var(--bs-border-color);
  box-shadow: 2px 0 20px rgba(198, 40, 40, .06);
  transform: translateX(-100%); transition: transform .2s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
.tk-sidebar.open { transform: translateX(0); }
.tk-side-brand {
  padding: 16px 18px; border-bottom: 1px solid #f6e3e3;
  display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--lao-red-2);
}
.tk-side-user { padding: 12px 18px; border-bottom: 1px solid #f8eaea; }
.tk-side-menu { list-style: none; margin: 0; padding: 8px 0; flex: 1; }
.tk-side-menu a, .tk-side-menu button {
  display: flex; align-items: center; gap: 11px; width: calc(100% - 20px);
  margin: 3px 10px; padding: .58rem .85rem; border: 0; background: transparent; text-align: left;
  color: #5b3a3a; border-radius: 11px; font-size: .92rem; text-decoration: none; cursor: pointer;
}
.tk-side-menu a:hover, .tk-side-menu button:hover { background: #fdeeee; color: var(--lao-red-2); }
.tk-side-menu a.active, .tk-side-menu button.active { background: var(--lao-red); color: #fff; }
.tk-side-menu a.active i, .tk-side-menu button.active i { color: #fff; }
.tk-side-menu i { width: 20px; text-align: center; color: var(--lao-red); font-size: .98rem; }
.tk-side-foot { padding: 12px; border-top: 1px solid #f8eaea; font-size: .72rem; color: #b19595; }

.tk-backdrop { position: fixed; inset: 0; background: rgba(60, 20, 20, .35); z-index: 1044; display: none; }
.tk-backdrop.open { display: block; }

.tk-main { min-width: 0; }
.tk-topbar {
  position: sticky; top: 0; z-index: 1030;
  background: linear-gradient(180deg, #c62828, #b71c1c);
  color: #fff;
  border-bottom: 1px solid #a01818;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
}
.tk-topbar .tk-pill { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.35); }
.tk-topbar .tk-pill.active { background: rgba(255,255,255,.30); color: #fff; }
.tk-topbar .tk-pill.expired { background: rgba(0,0,0,.22); color: #ffe0e0; border-color: rgba(255,255,255,.25); }
.tk-burger {
  border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.12); color: #fff;
  border-radius: 10px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.tk-main-inner { max-width: 960px; margin: 0 auto; padding: 16px 14px 60px; }

@media (min-width: 992px) {
  .tk-sidebar { transform: translateX(0); }
  .tk-backdrop { display: none !important; }
  .tk-main { margin-left: 252px; }
  .tk-burger { display: none; }
  .tk-main-inner { padding: 20px 22px 70px; }
}

/* การ์ดขั้นตอนในเมนูผูกบัญชี */
.tk-step { display: flex; gap: 12px; align-items: flex-start; }
.tk-step .n {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; font-size: .78rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lao-red); color: #fff;
}

/* Motion system: short, quiet transitions instead of decorative overload. */
@keyframes tk-fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes tk-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes tk-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(31,157,85,.18); } 50% { box-shadow: 0 0 0 6px rgba(31,157,85,0); } }
.public-hero .public-kicker, .public-hero h1, .public-hero .lede, .public-hero .btn { animation: tk-fade-up .65s both; }
.public-hero h1 { animation-delay: .08s; }.public-hero .lede { animation-delay: .16s; }.public-hero .btn { animation-delay: .24s; }
.public-code { animation: tk-fade-up .7s .18s both, tk-float 5s 1s ease-in-out infinite; }
.service-card, .problem, .plan { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.service-card:hover, .problem:hover, .plan:hover { transform: translateY(-4px); box-shadow: 0 15px 30px rgba(105,32,32,.1); }
.public-code .tk-pill.active { animation: tk-pulse 2s infinite; }
.reveal { animation: tk-fade-up .6s both; }
.view { animation: tk-fade-up .28s ease-out both; }
.tk-sidebar li { animation: tk-fade-up .28s both; }
.tk-sidebar li:nth-child(2) { animation-delay:.02s; }.tk-sidebar li:nth-child(3) { animation-delay:.04s; }.tk-sidebar li:nth-child(4) { animation-delay:.06s; }
.tk-sidebar li:nth-child(5) { animation-delay:.08s; }.tk-sidebar li:nth-child(6) { animation-delay:.1s; }.tk-sidebar li:nth-child(7) { animation-delay:.12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Product UI polish: fewer containers, clearer hierarchy, tighter controls. */
body { letter-spacing: -.01em; }
.navbar { min-height: 58px; }
.navbar-brand { letter-spacing: -.035em; }
.tk-main-inner { max-width: 1040px; }
.tk-card { box-shadow: 0 4px 18px rgba(74, 28, 28, .045); }
.tk-card.p-4 { padding: 1.35rem !important; }
.tk-section-title { letter-spacing: -.03em; }
.tk-stat .v { letter-spacing: -.045em; }
.btn { border-radius: 8px; font-weight: 650; }
.form-control, .form-select { border-radius: 8px; min-height: 42px; }
.table > :not(caption) > * > * { padding: .75rem .65rem; }
.tk-sidebar { width: 238px; }
.tk-main { margin-left: 238px; }
.tk-side-brand { font-size: 1.05rem; }
.tk-side-menu a, .tk-side-menu button { padding: .54rem .75rem; font-size: .88rem; }
.tk-topbar { padding: 9px 16px; }
@media (min-width: 992px) { .tk-main { margin-left: 238px; } }
@media (max-width: 991px) { .tk-main { margin-left: 0; } }


/* ── หน้าเช่าแพ็คเกจ (shop) ─────────────────────────────── */
.shop-wallet {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem; border-radius: 14px;
  background: linear-gradient(135deg, #fff5f5, #fffaf0);
  border: 1px solid var(--bs-border-color);
}
.shop-wallet-ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lao-red); color: #fff; font-size: 1.1rem;
}
.shop-wallet-label { font-size: .8rem; color: var(--bs-secondary-color); }
.shop-wallet-amt { font-size: 1.35rem; font-weight: 700; color: var(--bs-heading-color); line-height: 1.2; font-variant-numeric: tabular-nums; }
.shop-wallet-amt small { font-size: .8rem; font-weight: 600; color: var(--lao-gold-2); }

.shop-pkg {
  position: relative; height: 100%;
  display: flex; flex-direction: column;
  padding: 1.35rem 1.25rem 1.25rem;
  background: #fff; border: 1px solid var(--bs-border-color); border-radius: 16px;
  box-shadow: 0 4px 18px rgba(74, 28, 28, .05);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.shop-pkg:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(198, 40, 40, .12); border-color: #e8b4b4; }
.shop-pkg.is-best { border: 2px solid var(--lao-red); box-shadow: 0 10px 30px rgba(198, 40, 40, .16); }
.shop-ribbon {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  padding: .2rem .8rem; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(135deg, var(--lao-red), var(--lao-red-2));
  color: #fff; font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 4px 10px rgba(198, 40, 40, .3);
}
.shop-ribbon i { color: var(--lao-gold); }
.shop-pkg-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.shop-pkg-name { font-weight: 700; font-size: 1.05rem; color: var(--bs-heading-color); }
.shop-days {
  flex: none; padding: .15rem .6rem; border-radius: 999px;
  background: var(--bs-secondary-bg); color: var(--lao-red-2);
  font-size: .75rem; font-weight: 700;
}
.shop-price { font-size: 2.1rem; font-weight: 800; color: var(--lao-red); line-height: 1.1; font-variant-numeric: tabular-nums; }
.shop-price small { font-size: .85rem; font-weight: 600; color: var(--lao-gold-2); margin-left: .35rem; }
.shop-perday { font-size: .82rem; color: var(--bs-secondary-color); margin-top: .25rem; min-height: 1.4em; }
.shop-save {
  display: inline-block; margin-left: .25rem; padding: .05rem .45rem; border-radius: 6px;
  background: #e7f6ee; color: var(--tk-green); font-weight: 700; font-size: .75rem;
}
.shop-feat { list-style: none; padding: 1rem 0 0; margin: 1rem 0 0; border-top: 1px dashed var(--bs-border-color); }
.shop-feat li { display: flex; align-items: flex-start; gap: .6rem; font-size: .9rem; padding: .28rem 0; color: var(--bs-body-color); }
.shop-feat li i { width: 18px; text-align: center; margin-top: .2rem; color: var(--lao-red); font-size: .85rem; }
.shop-feat li b { color: var(--bs-heading-color); }
.shop-desc { margin-top: .6rem; padding: .6rem .75rem; border-radius: 10px; background: var(--bs-tertiary-bg); font-size: .82rem; color: var(--bs-secondary-color); line-height: 1.5; }
.shop-btn { padding: .6rem 1rem; font-weight: 700; border-radius: 10px; }
.shop-confirm > div { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid #f3e3e3; }
.shop-confirm > div:last-child { border-bottom: 0; }
.shop-confirm span { color: #8a6a6a; }
@media (max-width: 575.98px) {
  .shop-price { font-size: 1.8rem; }
  .shop-wallet { flex-wrap: wrap; }
}

.shop-saveamt { margin-top: .6rem; padding: .4rem .65rem; border-radius: 8px; background: #e7f6ee; color: #17784a; font-size: .8rem; }
.shop-saveamt b { color: #0f5f39; }
.shop-pkg.is-best .shop-saveamt { background: #d9f2e4; }
