/* Abang Sukan AI - floating help assistant. Markup is built by
   static/js/abang-sukan.js; the include is templates/includes/ai_help_chat.html. */

#abangSukan {
  --as-blue: #1e4fd8;
  --as-blue-dark: #1a3fa8;
  --as-green: #16a34a;
  --as-surface: #ffffff;
  --as-surface-2: #f4f7fb;
  --as-text: #0f172a;
  --as-muted: #64748b;
  --as-border: #e2e8f0;
  --as-bot-bubble: #ffffff;
  --as-user-bubble: #1e4fd8;
  --as-chip: #eef3ff;
  --as-chip-text: #1e3a8a;
  --as-shadow: 0 18px 50px -12px rgba(15, 23, 42, .35), 0 4px 14px rgba(15, 23, 42, .08);
  position: fixed;
  /* The corner the floating WhatsApp button used: the assistant replaces it
     (its Contact tab opens WhatsApp), and the include hides that button. */
  right: 18px;
  bottom: calc(18px + var(--safe-area-bottom, 0px) + var(--wa-float-lift, 0px));
  z-index: 10500;
  font-family: inherit;
}
[data-bs-theme="dark"] #abangSukan {
  --as-surface: #111827;
  --as-surface-2: #0b1220;
  --as-text: #e5e7eb;
  --as-muted: #94a3b8;
  --as-border: #1f2937;
  --as-bot-bubble: #1f2937;
  --as-user-bubble: #2563eb;
  --as-chip: #1e293b;
  --as-chip-text: #bfdbfe;
}
#abangSukan[hidden] { display: none; }
/* Public club sites style their headings with display fonts; keep ours plain. */
#abangSukan h2, #abangSukan h3, #abangSukan button, #abangSukan input, #abangSukan textarea,
#abangSukan select { font-family: inherit; text-transform: none; letter-spacing: normal; }
#abangSukan .as-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Launcher ------------------------------------------------------- */
#abangSukan .as-launcher {
  width: 64px; height: 64px; padding: 0; border: 3px solid #fff; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fef3c7, #bbf7d0 60%, #86efac);
  box-shadow: 0 10px 26px rgba(30, 79, 216, .35);
  cursor: grab; touch-action: none; overflow: hidden; display: block;
  transition: transform .18s ease, box-shadow .18s ease;
}
#abangSukan .as-launcher img {
  width: 100%; height: 100%; display: block; pointer-events: none;
  transform-origin: 50% 90%;
  animation: as-breathe 3.6s ease-in-out infinite;
}
#abangSukan .as-launcher:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 14px 30px rgba(30, 79, 216, .45); }
#abangSukan .as-launcher:focus-visible { outline: 3px solid #f59e0b; outline-offset: 3px; }
#abangSukan.is-dragging .as-launcher { cursor: grabbing; }
#abangSukan .as-wa-badge {
  position: absolute; right: -3px; bottom: -3px; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  background: #25d366; color: #fff; font-size: 14px; border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, .25);
}
#abangSukan.is-open .as-wa-badge { display: none; }

/* Hide: a small x on the button (on hover with a mouse, always on touch
   screens) tucks it into a slim tab on the right edge. */
#abangSukan .as-hide {
  position: absolute; top: -6px; left: -6px; width: 24px; height: 24px; padding: 0;
  border-radius: 50%; border: 2px solid #fff; background: #334155; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .3); opacity: 0; transition: opacity .15s ease;
}
#abangSukan:hover .as-hide, #abangSukan .as-hide:focus-visible { opacity: 1; }
@media (hover: none) { #abangSukan .as-hide { opacity: .9; } }
#abangSukan.is-open .as-hide,
#abangSukan.is-hidden .as-hide, #abangSukan.is-hidden .as-launcher, #abangSukan.is-hidden .as-wa-badge { display: none; }
#abangSukan .as-peek {
  position: fixed; right: 0; bottom: calc(110px + var(--safe-area-bottom, 0px) + var(--wa-float-lift, 0px));
  width: 38px; height: 52px; padding: 0 0 0 6px; border: 0; border-radius: 26px 0 0 26px;
  background: linear-gradient(135deg, var(--as-blue), var(--as-blue-dark));
  box-shadow: -2px 4px 14px rgba(30, 79, 216, .35); display: flex; align-items: center; cursor: pointer;
}
#abangSukan .as-peek[hidden] { display: none; }
#abangSukan .as-peek img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: #bbf7d0; }
#abangSukan .as-peek:hover { width: 44px; }
#abangSukan .as-peek:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
@media (max-width: 576px) { #abangSukan .as-wa-badge { width: 22px; height: 22px; font-size: 12px; } }
#abangSukan.is-open .as-launcher { box-shadow: 0 0 0 4px rgba(30, 79, 216, .25); }
@keyframes as-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* ---- Panel ---------------------------------------------------------- */
#abangSukan .as-panel {
  position: fixed; right: 24px; bottom: 24px;
  width: 424px; max-width: calc(100vw - 16px);
  height: 640px; max-height: calc(100vh - 16px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--as-surface); color: var(--as-text);
  border-radius: 20px; box-shadow: var(--as-shadow);
  border: 1px solid var(--as-border);
  animation: as-in .18s ease-out;
}
#abangSukan .as-panel[hidden] { display: none; }
@keyframes as-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
#abangSukan .as-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); }
#abangSukan .as-backdrop[hidden] { display: none; }

#abangSukan .as-header {
  display: flex; align-items: center; gap: 4px; padding: 12px 8px 12px 12px;
  background: linear-gradient(135deg, var(--as-blue), var(--as-blue-dark)); color: #fff;
  border-bottom: 4px solid var(--as-green); /* the retro jersey stripe */
}
#abangSukan .as-header-avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0; margin-inline-end: 6px;
  background: radial-gradient(circle at 30% 25%, #fef3c7, #86efac); border: 2px solid #fff;
}
#abangSukan .as-header-text { flex: 1; min-width: 0; }
#abangSukan .as-header-text h2 {
  margin: 0; font-size: .92rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#abangSukan .as-header-text p { margin: 1px 0 0; font-size: .74rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#abangSukan .as-icon-btn {
  width: 34px; height: 36px; flex-shrink: 0; border: 0; border-radius: 10px;
  background: transparent; color: #fff; font-size: 1.05rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
#abangSukan .as-icon-btn:hover { background: rgba(255, 255, 255, .15); }
#abangSukan .as-icon-btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

#abangSukan .as-tabs {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
  padding: 8px 10px; border-bottom: 1px solid var(--as-border); background: var(--as-surface);
}
#abangSukan [role="tab"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0;
  border: 0; border-radius: 999px; padding: 7px 8px; min-height: 38px;
  background: transparent; color: var(--as-muted); font-size: .8rem; font-weight: 600; cursor: pointer;
}
#abangSukan [role="tab"] span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#abangSukan [role="tab"] i { flex-shrink: 0; }
#abangSukan [role="tab"][aria-selected="true"] { background: var(--as-chip); color: var(--as-blue); }
[data-bs-theme="dark"] #abangSukan [role="tab"][aria-selected="true"] { color: #93c5fd; }
#abangSukan [role="tab"]:focus-visible { outline: 2px solid var(--as-blue); outline-offset: 1px; }
#abangSukan .as-lang { position: relative; margin: 0; flex-direction: column; gap: 0; line-height: 1; }
#abangSukan .as-lang-code { font-size: .5rem; font-weight: 800; letter-spacing: .04em; margin-top: 1px; }
#abangSukan .as-lang select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  font-size: 16px; /* keeps iOS from zooming when the picker opens */
}
#abangSukan .as-lang:focus-within { outline: 2px solid #fff; outline-offset: -2px; }
#abangSukan .as-lang select option { color: #0f172a; }

#abangSukan .as-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--as-surface-2); }
#abangSukan .as-pane[hidden] { display: none; }
#abangSukan .as-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; overscroll-behavior: contain; }

/* ---- Welcome / chips / quick actions -------------------------------- */
#abangSukan .as-welcome { text-align: center; padding: 4px 4px 10px; }
#abangSukan .as-welcome-img { width: 124px; height: 124px; }
#abangSukan .as-welcome-text { margin: 6px auto 4px; max-width: 300px; font-weight: 600; font-size: .95rem; }
#abangSukan .as-section-title {
  margin: 14px 0 8px; font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--as-muted); text-align: start;
}
#abangSukan .as-chips { display: flex; flex-wrap: wrap; gap: 6px; }
#abangSukan .as-chip {
  border: 1px solid transparent; border-radius: 999px; padding: 7px 12px; min-height: 36px;
  background: var(--as-chip); color: var(--as-chip-text); font-size: .8rem; text-align: start; cursor: pointer;
}
#abangSukan .as-chip:hover { border-color: var(--as-blue); }
#abangSukan .as-chip-sm { padding: 4px 9px; min-height: 30px; font-size: .74rem; }
#abangSukan .as-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#abangSukan .as-action {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  border-radius: 12px; background: var(--as-surface); border: 1px solid var(--as-border);
  color: var(--as-text); text-decoration: none; font-size: .74rem; font-weight: 600; text-align: center; line-height: 1.2;
}
#abangSukan .as-action i { font-size: 1.2rem; color: var(--as-blue); }
[data-bs-theme="dark"] #abangSukan .as-action i { color: #93c5fd; }
#abangSukan .as-action:hover { border-color: var(--as-blue); color: var(--as-text); }

/* ---- Messages ------------------------------------------------------- */
#abangSukan .as-msg { display: flex; gap: 8px; margin: 10px 0; align-items: flex-end; }
#abangSukan .as-msg-user { justify-content: flex-end; }
#abangSukan .as-msg-col { min-width: 0; max-width: 84%; }
#abangSukan .as-msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #fef3c7, #bbf7d0);
}
#abangSukan .as-msg-avatar img { width: 100%; height: 100%; display: block; }
/* Full-body pose: show twice the size, framed on the head. */
#abangSukan .as-msg-avatar.is-pose img { width: 220%; height: 220%; max-width: none; margin: -6% 0 0 -60%; }
#abangSukan .as-bubble {
  padding: 9px 12px; border-radius: 16px; font-size: .88rem; line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
#abangSukan .as-msg-user .as-bubble { max-width: 84%; background: var(--as-user-bubble); color: #fff; border-end-end-radius: 4px; }
#abangSukan .as-msg-bot .as-bubble { background: var(--as-bot-bubble); border: 1px solid var(--as-border); border-end-start-radius: 4px; }
#abangSukan .as-msg-error .as-bubble { border-color: #fca5a5; }
#abangSukan .as-bubble a { color: var(--as-blue); font-weight: 600; }
[data-bs-theme="dark"] #abangSukan .as-bubble a { color: #93c5fd; }
#abangSukan .as-sources { margin-top: 4px; font-size: .72rem; color: var(--as-muted); }
#abangSukan .as-sources a { color: inherit; text-decoration: underline; margin-inline-end: 8px; }
#abangSukan .as-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 4px; }
#abangSukan .as-fb-btn {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent;
  color: var(--as-muted); cursor: pointer;
}
#abangSukan .as-fb-btn:hover { background: var(--as-chip); }
#abangSukan .as-fb-btn[aria-pressed="true"] { color: var(--as-blue); background: var(--as-chip); }
#abangSukan .as-fb-note { font-size: .72rem; color: var(--as-green); }
#abangSukan .as-fb-reasons { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; width: 100%; font-size: .74rem; color: var(--as-muted); }
#abangSukan .as-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
#abangSukan .as-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--as-muted); animation: as-dot 1.2s infinite ease-in-out; }
#abangSukan .as-dots i:nth-child(2) { animation-delay: .15s; }
#abangSukan .as-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes as-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

#abangSukan .as-input {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 6px;
  background: var(--as-surface); border-top: 1px solid var(--as-border); margin: 0;
}
#abangSukan .as-input textarea {
  flex: 1; resize: none; border: 1px solid var(--as-border); border-radius: 18px; padding: 9px 14px;
  font: inherit; font-size: .9rem; line-height: 1.35; max-height: 120px;
  background: var(--as-surface-2); color: var(--as-text); outline: none;
}
#abangSukan .as-input textarea:focus { border-color: var(--as-blue); box-shadow: 0 0 0 3px rgba(30, 79, 216, .15); }
#abangSukan .as-send {
  width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 50%;
  background: var(--as-blue); color: #fff; cursor: pointer; font-size: 1rem;
}
#abangSukan .as-send:disabled { opacity: .5; cursor: not-allowed; }
#abangSukan .as-send:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }
[dir="rtl"] #abangSukan .as-send i, #abangSukan [dir="rtl"] .as-send i { transform: scaleX(-1); }
#abangSukan .as-notice { margin: 0; padding: 0 14px 10px; font-size: .68rem; color: var(--as-muted); background: var(--as-surface); text-align: center; }

/* ---- Help tab -------------------------------------------------------- */
#abangSukan .as-pane-intro { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
#abangSukan .as-pane-intro img { width: 84px; height: 84px; flex-shrink: 0; }
#abangSukan .as-pane-intro p { margin: 0; font-size: .8rem; color: var(--as-muted); }
#abangSukan .as-search {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 0 12px;
  border: 1px solid var(--as-border); border-radius: 12px; background: var(--as-surface); color: var(--as-muted);
}
#abangSukan .as-search input { flex: 1; border: 0; background: transparent; color: var(--as-text); padding: 10px 0; font-size: .88rem; outline: none; min-width: 0; }
#abangSukan .as-guides { display: flex; flex-direction: column; gap: 6px; }
#abangSukan .as-guide, #abangSukan .as-result {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px;
  background: var(--as-surface); border: 1px solid var(--as-border); color: var(--as-text); text-decoration: none;
}
#abangSukan .as-result { flex-direction: column; gap: 2px; margin-bottom: 6px; }
#abangSukan .as-guide i { font-size: 1.25rem; color: var(--as-blue); margin-top: 2px; }
#abangSukan .as-guide span { display: flex; flex-direction: column; min-width: 0; }
#abangSukan .as-guide strong, #abangSukan .as-result strong { font-size: .86rem; }
#abangSukan .as-guide small, #abangSukan .as-result small { font-size: .74rem; color: var(--as-muted); }
#abangSukan .as-guide:hover, #abangSukan .as-result:hover { border-color: var(--as-blue); color: var(--as-text); }
#abangSukan .as-empty { color: var(--as-muted); font-size: .82rem; text-align: center; margin: 10px 0; }

/* ---- Contact tab ----------------------------------------------------- */
#abangSukan .as-contact { text-align: center; padding-top: 22px; }
#abangSukan .as-contact-img { width: 136px; height: 136px; }
#abangSukan .as-contact h3 { font-size: 1rem; font-weight: 700; margin: 8px 0 6px; color: var(--as-text); }
#abangSukan .as-contact p { font-size: .85rem; color: var(--as-muted); max-width: 300px; margin: 0 auto 14px; }
#abangSukan .as-contact .as-notice { background: transparent; padding: 0; }
#abangSukan .as-contact-card {
  margin: 0 0 10px; padding: 14px 12px 4px; border-radius: 14px;
  background: var(--as-surface); border: 1px solid var(--as-border);
}
#abangSukan .as-contact-card h3 { margin-top: 0; }
#abangSukan .as-wa-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 22px;
  border-radius: 999px; background: #25d366; color: #fff; font-weight: 700; text-decoration: none; margin-bottom: 12px;
}
#abangSukan .as-wa-btn:hover { background: #1ebe5a; color: #fff; }

/* ---- History overlay ------------------------------------------------- */
#abangSukan .as-history {
  position: absolute; inset: 72px 0 0 0; /* below the header, over the tabs */ display: flex; flex-direction: column;
  background: var(--as-surface-2); z-index: 2;
}
#abangSukan .as-history[hidden] { display: none; }
#abangSukan .as-history-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--as-border); background: var(--as-surface); }
#abangSukan .as-history-head h3 { margin: 0; font-size: .9rem; font-weight: 700; }
#abangSukan .as-link-btn { border: 0; background: transparent; color: var(--as-blue); font-weight: 600; font-size: .82rem; cursor: pointer; min-height: 36px; }
#abangSukan .as-history-item {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: start; margin-bottom: 6px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--as-border); background: var(--as-surface); color: var(--as-text); cursor: pointer;
}
#abangSukan .as-history-item.is-current { border-color: var(--as-blue); }
#abangSukan .as-history-item strong { font-size: .84rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#abangSukan .as-history-item small { font-size: .72rem; color: var(--as-muted); }

/* ---- Mobile: compact launcher, bottom sheet -------------------------- */
@media (max-width: 576px) {
  #abangSukan { right: 14px; bottom: calc(14px + var(--safe-area-bottom, 0px) + var(--wa-float-lift, 0px)); }
  #abangSukan .as-launcher { width: 56px; height: 56px; }
  #abangSukan .as-panel {
    left: 0 !important; right: 0; top: auto !important; bottom: 0;
    width: 100%; max-width: 100%; height: 88vh; height: 88dvh; max-height: none;
    border-radius: 20px 20px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #abangSukan .as-header-text p { display: none; }
  #abangSukan [role="tab"] { font-size: .76rem; padding: 7px 4px; }
}

@media (max-width: 400px) {
  #abangSukan [role="tab"] i { display: none; }
}

/* Platform landing page (static/landing/welcome.css): sit where its WhatsApp
   pill was - below the back-to-top button, and above the sticky "Get
   Started" bar on phones once that bar slides in. */
#abangSukan.as-site-system { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 639px) {
  body.has-mobile-cta #abangSukan.as-site-system { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  #abangSukan .as-launcher img, #abangSukan .as-dots i, #abangSukan .as-panel { animation: none; }
  #abangSukan .as-launcher { transition: none; }
}
@media print { #abangSukan { display: none !important; } }
