/* ==========================================================================
   DEEPDROP / CUSTOMER FAQ & KNOWLEDGE HUB
   Theme: Apple Inc. (Fluidity, Inset Grouped, Precision)
          + Tactical Dark (Resident Evil / Evil Dead, Zero Neon)
   UX Guidelines: Jakob's Law, Instant Search, Touch Target >= 48px, Zero Floating
   ========================================================================== */

/* Outer Page Wrap */
.ah-faq-page-wrap {
  width: min(860px, 100%);
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(20px, 3.5vw, 40px) clamp(14px, 3vw, 24px) calc(84px + env(safe-area-inset-bottom, 20px));
  box-sizing: border-box;
}

/* Master Chassis Plate (Anchored Grounding, Anti-Floating) */
.ah-faq-chassis {
  background: linear-gradient(180deg, rgba(20, 22, 28, 0.92) 0%, rgba(13, 14, 18, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--tp-radius-chassis, 24px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  padding: clamp(22px, 3.5vw, 36px);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Header & Telemetry HUD
   -------------------------------------------------------------------------- */
.ah-faq-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.ah-faq-back-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--tp-radius-pill, 980px);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--tp-text-primary, #F5F5F7);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.ah-faq-back-capsule:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  transform: translateX(-2px);
}

.ah-faq-hud-badge {
  font-family: var(--ah-mono, ui-monospace, monospace);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--tp-status-success, #7A9374);
  background: rgba(122, 147, 116, 0.1);
  border: 1px solid rgba(122, 147, 116, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
  user-select: none;
}

.ah-faq-hero {
  margin-bottom: 28px;
}

.ah-faq-hero-title {
  font-family: var(--ah-display, 'IBM Plex Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif);
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tp-text-primary, #F5F5F7);
  margin: 0 0 10px;
  line-height: 1.25;
}

.ah-faq-hero-subtitle {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--tp-text-secondary, #B8B6AA);
  margin: 0;
  max-width: 680px;
}

/* --------------------------------------------------------------------------
   Apple Support Instant Search Bar (Jakob's Law)
   -------------------------------------------------------------------------- */
.ah-faq-search-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.ah-faq-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(14, 16, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--tp-radius-control, 14px);
  padding: 2px 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ah-faq-search-box:focus-within {
  border-color: var(--tp-status-success, #7A9374);
  box-shadow: 0 0 0 3px rgba(122, 147, 116, 0.18), inset 0 2px 4px rgba(0, 0, 0, 0.5);
  background: rgba(16, 19, 24, 0.95);
}

.ah-faq-search-icon {
  width: 18px;
  height: 18px;
  color: var(--tp-text-muted, #7E7D75);
  flex-shrink: 0;
  margin-right: 12px;
  transition: color 0.2s ease;
}

.ah-faq-search-box:focus-within .ah-faq-search-icon {
  color: var(--tp-status-success, #7A9374);
}

.ah-faq-search-input {
  width: 100%;
  height: 48px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--tp-text-primary, #F5F5F7);
  font-family: inherit;
  font-size: 15px;
}

.ah-faq-search-input::placeholder {
  color: var(--tp-text-muted, #7E7D75);
  font-size: 14.5px;
}

.ah-faq-search-clear {
  display: none;
  background: transparent;
  border: none;
  color: var(--tp-text-secondary, #B8B6AA);
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: -6px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.ah-faq-search-clear-inner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}

.ah-faq-search-clear:hover .ah-faq-search-clear-inner {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

.ah-faq-search-clear.is-visible {
  display: inline-flex;
}

/* --------------------------------------------------------------------------
   Apple Segmented Category Grid (Symmetrical Inset Control)
   -------------------------------------------------------------------------- */
.ah-faq-segment-tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 6px;
  margin-bottom: 32px;
  background: rgba(10, 11, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--tp-radius-card, 16px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.ah-faq-segment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: var(--tp-radius-control, 10px);
  background: transparent;
  border: 1px solid transparent;
  color: var(--tp-text-secondary, #B8B6AA);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none;
  box-sizing: border-box;
  width: 100%;
  text-align: center;
}

.ah-faq-segment-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ah-faq-segment-btn svg {
  width: 15px;
  height: 15px;
  color: inherit;
  flex-shrink: 0;
}

.ah-faq-segment-btn:hover {
  color: var(--tp-text-primary, #F5F5F7);
  background: rgba(255, 255, 255, 0.04);
}

.ah-faq-segment-btn.is-active {
  background: rgba(122, 147, 116, 0.18);
  border-color: rgba(122, 147, 116, 0.4);
  color: #E2ECE0;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ah-faq-segment-btn.is-active svg {
  color: var(--tp-status-success, #7A9374);
}

/* --------------------------------------------------------------------------
   Category Inset Grouped Panels (Apple iOS Inset Style)
   -------------------------------------------------------------------------- */
.ah-faq-group {
  margin-bottom: 32px;
  transition: opacity 0.2s ease;
}

.ah-faq-group.is-hidden {
  display: none !important;
}

.ah-faq-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.ah-faq-group-icon {
  width: 18px;
  height: 18px;
  color: var(--tp-status-success, #7A9374);
}

.ah-faq-group-title {
  font-family: var(--ah-mono, ui-monospace, monospace);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tp-text-primary, #F5F5F7);
  margin: 0;
}

.ah-faq-group-count {
  font-size: 11.5px;
  color: var(--tp-text-muted, #7E7D75);
  font-family: var(--ah-mono, monospace);
  font-weight: 500;
  margin-left: auto;
}

/* Inset Group Card Container */
.ah-faq-inset-group {
  background: rgba(16, 18, 23, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--tp-radius-card, 18px);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Individual Accordion Item */
.ah-faq-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background-color 0.2s ease;
}

.ah-faq-item:last-child {
  border-bottom: none;
}

.ah-faq-item.is-filtered-out {
  display: none !important;
}

.ah-faq-item[open] {
  background: rgba(22, 26, 32, 0.55);
}

/* Summary Trigger */
.ah-faq-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  min-height: 48px; /* Touch target compliant */
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--tp-text-primary, #F5F5F7);
  line-height: 1.45;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.ah-faq-summary > span {
  flex: 1;
}

.ah-faq-summary::-webkit-details-marker {
  display: none;
}

.ah-faq-summary:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.025);
}

.ah-faq-summary:focus-visible {
  outline: 2px solid var(--tp-status-success, #7A9374);
  outline-offset: -2px;
}

/* Apple Spring Chevron */
.ah-faq-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--tp-text-muted, #7E7D75);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.ah-faq-item[open] .ah-faq-chevron {
  transform: rotate(180deg);
  color: var(--tp-status-success, #7A9374);
}

/* Accordion Content Body */
.ah-faq-content {
  padding: 0 20px 20px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--tp-text-secondary, #B8B6AA);
  box-sizing: border-box;
}

.ah-faq-content p {
  margin: 0 0 12px;
}

.ah-faq-content p:last-child {
  margin-bottom: 0;
}

.ah-faq-content ul {
  margin: 8px 0 12px 18px;
  padding: 0;
}

.ah-faq-content li {
  margin-bottom: 6px;
  position: relative;
}

.ah-faq-content strong {
  color: var(--tp-text-primary, #F5F5F7);
  font-weight: 600;
}

/* Tactical Highlights */
.ah-faq-highlight-badge {
  display: inline-block;
  font-family: var(--ah-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(122, 147, 116, 0.15);
  color: var(--tp-status-success, #7A9374);
  border: 1px solid rgba(122, 147, 116, 0.3);
  margin: 0 2px;
}

/* --------------------------------------------------------------------------
   Search Empty State
   -------------------------------------------------------------------------- */
.ah-faq-empty-state {
  display: none;
  text-align: center;
  padding: 48px 24px;
  background: rgba(16, 18, 23, 0.6);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--tp-radius-card, 18px);
  margin-bottom: 32px;
}

.ah-faq-empty-state.is-visible {
  display: block;
}

.ah-faq-empty-icon {
  width: 42px;
  height: 42px;
  color: var(--tp-text-muted, #7E7D75);
  margin-bottom: 14px;
}

.ah-faq-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--tp-text-primary, #F5F5F7);
  margin: 0 0 8px;
}

.ah-faq-empty-desc {
  font-size: 13.5px;
  color: var(--tp-text-secondary, #B8B6AA);
  margin: 0 0 18px;
}

.ah-faq-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--tp-radius-pill, 980px);
  color: var(--tp-text-primary, #F5F5F7);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ah-faq-reset-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

/* --------------------------------------------------------------------------
   Tactical Dispatch Support Tile (Symmetrical, Non-floating)
   -------------------------------------------------------------------------- */
.ah-faq-contact-tile {
  margin-top: 40px;
  padding: clamp(20px, 3vw, 28px);
  border-radius: var(--tp-radius-card, 18px);
  background: linear-gradient(180deg, rgba(22, 26, 32, 0.9) 0%, rgba(15, 17, 22, 0.95) 100%);
  border: 1px solid rgba(122, 147, 116, 0.25);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
}

.ah-faq-contact-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ah-faq-contact-hud {
  font-family: var(--ah-mono, monospace);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--tp-status-success, #7A9374);
  font-weight: 700;
}

.ah-faq-contact-heading {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--tp-text-primary, #F5F5F7);
  margin: 0;
  line-height: 1.35;
}

.ah-faq-contact-desc {
  font-size: 13.5px;
  color: var(--tp-text-secondary, #B8B6AA);
  margin: 0;
  line-height: 1.5;
}

.ah-faq-contact-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ah-faq-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: var(--tp-radius-control, 12px);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  white-space: nowrap;
}

.ah-faq-action-btn--primary {
  background: var(--tp-status-success, #7A9374);
  color: #0A0D0B;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(122, 147, 116, 0.25);
}

.ah-faq-action-btn--primary:hover {
  background: #8FA989;
  color: #050705;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(122, 147, 116, 0.35);
}

.ah-faq-action-btn--secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--tp-text-primary, #F5F5F7);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ah-faq-action-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Responsive Adaptations (Mobile & Tablet)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .ah-faq-page-wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  .ah-faq-chassis {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .ah-faq-header-bar {
    margin-bottom: 18px;
  }

  .ah-faq-hero {
    margin-bottom: 22px;
  }

  .ah-faq-segment-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 24px;
    border-radius: var(--tp-radius-pill, 980px);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 16px, black calc(100% - 16px), transparent);
  }

  .ah-faq-segment-tray::-webkit-scrollbar {
    display: none;
  }

  .ah-faq-segment-btn {
    flex-shrink: 0;
    scroll-snap-align: start;
    width: auto;
    white-space: nowrap;
    min-height: 44px;
    font-size: 13px;
    padding: 8px 16px;
    gap: 6px;
  }

  .ah-faq-summary {
    padding: 15px 16px;
    font-size: 14.5px;
  }

  .ah-faq-content {
    padding: 0 16px 18px;
    font-size: 13.8px;
  }

  .ah-faq-contact-tile {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px 16px;
  }

  .ah-faq-contact-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    width: 100%;
    gap: 10px;
  }

  .ah-faq-action-btn {
    width: 100%;
    padding: 0 12px;
    font-size: 13px;
  }
}

@media (max-width: 400px) {
  .ah-faq-header-bar {
    flex-wrap: wrap;
    gap: 10px;
  }

  .ah-faq-hud-badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  .ah-faq-contact-actions {
    grid-template-columns: 1fr;
  }
}
