/* ============================================================
   help.css — ปุ่ม "?" ช่วยเหลือ + กล่องอธิบายแต่ละหน้า
   ใช้ตัวแปรธีมจาก theme.css (มี fallback กันพลาด)
   ============================================================ */

/* ── ปุ่มลอย "?" มุมขวาล่าง ── */
/* layout props ใส่ !important กัน CSS ของแต่ละหน้า override จนปุ่มหาย/หลุดตำแหน่ง */
.help-fab {
  position: fixed !important;
  right: 22px !important;
  bottom: 22px !important;
  width: 46px;
  height: 46px;
  border-radius: 50% !important;
  border: none;
  cursor: pointer;
  z-index: 99990 !important;
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: 0 !important;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-on-accent, #1A1407);
  background: linear-gradient(135deg, var(--accent, #D9B45B) 0%, var(--accent-dark, #B7913C) 100%);
  box-shadow: 0 6px 20px var(--accent-glow, rgba(217, 180, 91, 0.35));
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.help-fab:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 26px var(--accent-glow, rgba(217, 180, 91, 0.45));
  filter: brightness(1.05);
}

.help-fab:active {
  transform: translateY(0) scale(0.98);
}

.help-fab:focus-visible {
  outline: 2px solid var(--accent, #D9B45B);
  outline-offset: 3px;
}

.help-fab .bi {
  font-size: 22px;
}

/* ── Standard header-right zone (shared by every page) ───────────────────────
   A frosted "control cluster" that groups the right-side header controls into one
   cohesive glass tray. Single source for botlist / hotkey / webhook / chat. */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  align-self: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  padding: 5px 7px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Help button docked into .header-right — frosted glass icon that matches the cluster
   (inherits the header's text colour so it reads correctly on every theme). */
.help-fab.help-fab--in-header {
  position: static !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  transform: none;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  font-size: 17px;
  font-weight: 800;
  color: inherit !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.06) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 8px rgba(0, 0, 0, 0.22) !important;
}

.help-fab.help-fab--in-header:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.30) 0%, rgba(255, 255, 255, 0.12) 100%) !important;
}

.help-fab.help-fab--in-header:active {
  transform: translateY(0) scale(0.95);
}

@media (max-width: 480px) {
  .header-right {
    gap: 6px;
    padding: 4px 5px;
    border-radius: 12px;
  }
}

/* ── Overlay + กล่อง modal ── */
.help-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay-modal, rgba(0, 0, 0, 0.72));
  backdrop-filter: blur(4px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.help-overlay.open {
  opacity: 1;
  visibility: visible;
}

.help-modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #16181D);
  border: 1px solid var(--accent-border, rgba(217, 180, 91, 0.22));
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.2s ease;
}

.help-overlay.open .help-modal {
  transform: translateY(0) scale(1);
}

/* ── หัวกล่อง ── */
.help-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--accent, #D9B45B) 0%, var(--accent-dark, #B7913C) 100%);
  color: var(--text-on-accent, #1A1407);
}

.help-modal-header .help-head-icon {
  font-size: 24px;
  line-height: 1;
}

.help-modal-header .help-head-text {
  flex: 1;
  min-width: 0;
}

.help-modal-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.help-modal-header .help-head-sub {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.82;
}

.help-close-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-on-accent, #1A1407);
  background: rgba(0, 0, 0, 0.12);
  transition: background 0.15s ease;
}

.help-close-btn:hover {
  background: rgba(0, 0, 0, 0.24);
}

/* ── เนื้อหา ── */
.help-modal-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
  color: var(--text-primary, #ECECEE);
}

.help-intro {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary, rgba(236, 236, 238, 0.7));
}

.help-section {
  margin-bottom: 16px;
}

.help-section:last-child {
  margin-bottom: 0;
}

.help-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-text-strong, var(--accent, #D9B45B));
}

.help-section-title .bi {
  font-size: 15px;
}

.help-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-list li {
  position: relative;
  padding: 5px 0 5px 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-primary, #ECECEE);
  border-bottom: 1px solid var(--border-muted, rgba(255, 255, 255, 0.05));
}

.help-list li:last-child {
  border-bottom: none;
}

.help-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #D9B45B);
}

.help-list li b {
  color: var(--accent-text-strong, var(--accent, #D9B45B));
  font-weight: 700;
}

.help-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary, rgba(236, 236, 238, 0.7));
  background: var(--accent-subtle, rgba(217, 180, 91, 0.1));
  border: 1px solid var(--accent-border, rgba(217, 180, 91, 0.22));
}

/* scrollbar */
.help-modal-body::-webkit-scrollbar {
  width: 8px;
}

.help-modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.help-modal-body::-webkit-scrollbar-thumb {
  background: var(--accent-border, rgba(217, 180, 91, 0.3));
  border-radius: 4px;
}

@media (max-width: 480px) {
  .help-fab {
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
}
