/* WorkCamp Market — Help Page Styles
   Page-specific CSS for help/index.php (Smart Form layout).
   Loaded separately, not through Tailwind build.
*/

/* ============================================================
   Page Layout
   ============================================================ */

.help-page {
  max-width: 750px;
  margin: 0 auto;
  padding: var(--market-space-8) var(--market-space-4) var(--market-space-16);
}

@media (min-width: 640px) {
  .help-page {
    padding-left: var(--market-space-6);
    padding-right: var(--market-space-6);
  }
}

/* ============================================================
   Page Header
   ============================================================ */

.help-header {
  text-align: center;
  margin-bottom: var(--market-space-8);
}

.help-header h1 {
  font-size: var(--market-font-3xl);
  font-weight: var(--market-weight-extrabold);
  color: var(--market-primary);
  margin: 0 0 var(--market-space-2);
}

.help-header p {
  font-size: var(--market-font-base);
  color: var(--market-text-muted);
  margin: 0;
}

@media (max-width: 639px) {
  .help-header h1 {
    font-size: var(--market-font-2xl);
  }
}

/* ============================================================
   Topic Picker Cards
   ============================================================ */

.help-topic-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--market-space-3);
  margin-bottom: var(--market-space-8);
}

@media (max-width: 639px) {
  .help-topic-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.help-topic-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--market-space-2);
  padding: var(--market-space-4);
  min-height: 110px;
  background: var(--market-bg-white);
  border: 2px solid var(--market-border);
  border-radius: var(--market-radius-md);
  cursor: pointer;
  transition: border-color var(--market-transition-fast),
              box-shadow var(--market-transition-fast),
              transform var(--market-transition-fast),
              background-color var(--market-transition-fast);
  position: relative;
  text-align: center;
  /* Reset button styles */
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.help-topic-card:hover {
  border-color: var(--market-accent);
  box-shadow: var(--market-shadow-sm);
}

.help-topic-card:active {
  transform: scale(0.98);
}

/* Focus (keyboard) */
.help-topic-card:focus-visible {
  outline: 2px solid var(--market-accent);
  outline-offset: 2px;
}

/* Selected state */
.help-topic-card.is-selected {
  border-color: var(--market-accent);
  background: rgba(212, 113, 42, 0.06);
  box-shadow: 0 0 0 1px var(--market-accent);
}

/* Checkmark (top-right corner, only visible when selected) */
.help-topic-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--market-accent);
  color: var(--market-bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity var(--market-transition-fast), transform var(--market-transition-fast);
}

.help-topic-card.is-selected .help-topic-check {
  opacity: 1;
  transform: scale(1);
}

/* Icon */
.help-topic-icon {
  color: var(--market-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-topic-card.is-selected .help-topic-icon {
  color: var(--market-accent);
}

/* Label */
.help-topic-label {
  font-size: var(--market-font-sm);
  font-weight: var(--market-weight-semibold);
  color: var(--market-text);
  line-height: 1.3;
}

/* Mobile: smaller cards */
@media (max-width: 639px) {
  .help-topic-card {
    min-height: 90px;
    padding: var(--market-space-3);
  }

  .help-topic-label {
    font-size: 0.8125rem;
  }
}

/* ============================================================
   FAQ Deflection Panel (placeholder for Session 4)
   ============================================================ */

.help-deflection {
  margin-bottom: var(--market-space-8);
}

/* ============================================================
   Contact Form Section
   ============================================================ */

.help-form-section {
  margin-bottom: var(--market-space-12);
}

.help-form-section h2 {
  font-size: var(--market-font-xl);
  font-weight: var(--market-weight-bold);
  color: var(--market-primary);
  margin: 0 0 var(--market-space-1);
}

.help-form-subtitle {
  font-size: var(--market-font-sm);
  color: var(--market-text-muted);
  margin: 0 0 var(--market-space-6);
}

/* ── Field group ─────────────────────────────────────────── */

.help-field-group {
  margin-bottom: var(--market-space-5);
}

.help-label {
  display: block;
  font-size: var(--market-font-sm);
  font-weight: var(--market-weight-semibold);
  color: var(--market-text);
  margin-bottom: var(--market-space-1);
}

.help-required {
  color: var(--market-danger);
  margin-left: 2px;
}

/* ── Inputs ─────────────────────────────────────────────── */

.help-input,
.help-textarea,
.help-select {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;  /* prevents iOS zoom */
  font-family: var(--market-font-family);
  color: var(--market-text);
  background: var(--market-bg-white);
  border: 1px solid var(--market-border);
  border-radius: var(--market-radius-base);
  transition: border-color var(--market-transition-fast), box-shadow var(--market-transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.help-textarea {
  min-height: 120px;
  resize: vertical;
}

.help-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7B6B'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.help-input:focus,
.help-textarea:focus,
.help-select:focus {
  outline: none;
  border-color: var(--market-primary);
  box-shadow: 0 0 0 3px rgba(45, 95, 45, 0.15);
}

/* Error state */
.help-input.is-error,
.help-textarea.is-error {
  border-color: var(--market-danger-light);
}

.help-input.is-error:focus,
.help-textarea.is-error:focus {
  border-color: var(--market-danger-light);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Success state (corrected field) */
.help-input.is-success,
.help-textarea.is-success {
  border-color: var(--market-success);
}

.help-input.is-success:focus,
.help-textarea.is-success:focus {
  border-color: var(--market-success);
  box-shadow: 0 0 0 3px rgba(45, 95, 45, 0.15);
}

/* Error message */
.help-field-error {
  color: var(--market-danger-light);
  font-size: var(--market-font-xs);
  margin-top: var(--market-space-1);
}

/* ── Conditional field animation ────────────────────────── */

.help-conditional-field {
  overflow: hidden;
}

/* ── Submit area ────────────────────────────────────────── */

.help-submit-area {
  margin-top: var(--market-space-6);
}

.help-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 24px;
  font-size: var(--market-font-base);
  font-weight: var(--market-weight-bold);
  font-family: var(--market-font-family);
  color: var(--market-bg-white);
  background: var(--market-accent);
  border: 2px solid var(--market-accent);
  border-radius: var(--market-radius-base);
  cursor: pointer;
  transition: background-color var(--market-transition-fast),
              border-color var(--market-transition-fast),
              transform var(--market-transition-fast);
}

.help-submit-btn:hover {
  background: var(--market-accent-hover);
  border-color: var(--market-accent-hover);
}

.help-submit-btn:active {
  transform: scale(0.98);
}

.help-submit-btn:focus-visible {
  outline: 2px solid var(--market-accent);
  outline-offset: 2px;
}

.help-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.help-submit-btn:visited {
  color: var(--market-bg-white);
}

/* Spinner */
.help-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: help-spin 0.6s linear infinite;
}

@keyframes help-spin {
  to { transform: rotate(360deg); }
}

/* Submit text states */
.help-submit-loading,
.help-submit-success {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Success message ────────────────────────────────────── */

.help-success-message {
  display: flex;
  align-items: flex-start;
  gap: var(--market-space-3);
  padding: var(--market-space-6);
  background: rgba(45, 95, 45, 0.06);
  border: 1px solid rgba(45, 95, 45, 0.2);
  border-left: 4px solid var(--market-success);
  border-radius: var(--market-radius-md);
  color: var(--market-primary);
}

.help-success-message svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--market-success);
}

.help-success-message strong {
  display: block;
  font-size: var(--market-font-base);
  margin-bottom: var(--market-space-1);
}

.help-success-message p {
  font-size: var(--market-font-sm);
  color: var(--market-text-muted);
  margin: 0;
}

/* ============================================================
   FAQ Deflection Panel
   ============================================================ */

.help-deflection {
  margin-bottom: var(--market-space-8);
}

.help-deflection-inner {
  background: var(--market-bg-white);
  border: 1px solid var(--market-border);
  border-radius: var(--market-radius-md);
  padding: var(--market-space-6);
}

.help-deflection-title {
  font-size: var(--market-font-base);
  font-weight: var(--market-weight-bold);
  color: var(--market-primary);
  margin: 0 0 var(--market-space-4);
}

.help-deflection-cta {
  margin-top: var(--market-space-4);
  padding-top: var(--market-space-4);
  border-top: 1px solid var(--market-border);
  text-align: center;
}

.help-deflection-link {
  font-size: var(--market-font-sm);
  font-weight: var(--market-weight-semibold);
  color: var(--market-accent);
  text-decoration: underline;
}

.help-deflection-link:hover {
  color: var(--market-accent-hover);
}

/* ============================================================
   Accordion (shared by deflection + full FAQ)
   ============================================================ */

.help-defl-item,
.help-faq-item {
  border-bottom: 1px solid var(--market-border);
}

.help-defl-item:last-child,
.help-faq-item:last-child {
  border-bottom: none;
}

/* Trigger button */
.help-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--market-space-3);
  width: 100%;
  min-height: 48px;
  padding: var(--market-space-3) 0;
  background: none;
  border: none;
  font-family: var(--market-font-family);
  font-size: var(--market-font-base);
  font-weight: var(--market-weight-medium);
  color: var(--market-text);
  text-align: left;
  cursor: pointer;
  line-height: 1.5;
}

.help-accordion-trigger:hover {
  color: var(--market-primary);
}

.help-accordion-trigger:focus-visible {
  outline: 2px solid var(--market-accent);
  outline-offset: 2px;
  border-radius: var(--market-radius-sm);
}

/* Chevron rotation */
.help-chevron {
  flex-shrink: 0;
  color: var(--market-text-muted);
  transition: transform 0.25s ease-out;
}

.help-accordion-trigger[aria-expanded="true"] .help-chevron {
  transform: rotate(180deg);
}

/* Panel */
.help-accordion-panel {
  overflow: hidden;
}

.help-accordion-content {
  padding: 0 0 var(--market-space-4);
  font-size: var(--market-font-sm);
  line-height: 1.7;
  color: var(--market-text-muted);
}

/* Links inside FAQ answers */
.help-accordion-content a {
  color: var(--market-accent);
  text-decoration: underline;
}

.help-accordion-content a:hover {
  color: var(--market-accent-hover);
}

.help-accordion-content strong {
  color: var(--market-text);
  font-weight: var(--market-weight-semibold);
}

/* Expanded state: subtle left border accent */
.help-accordion-trigger[aria-expanded="true"] {
  color: var(--market-primary);
}

/* Heading resets (h3/h4 inside accordion are structural, not visual) */
.help-defl-item h4,
.help-faq-item h4 {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

/* ============================================================
   Full FAQ Section — Browse All Questions
   ============================================================ */

.help-faq-full {
  margin-top: var(--market-space-8);
}

.help-faq-full > h2 {
  font-size: var(--market-font-xl);
  font-weight: var(--market-weight-bold);
  color: var(--market-primary);
  margin: 0 0 var(--market-space-6);
}

.help-faq-category {
  margin-bottom: var(--market-space-6);
}

.help-faq-cat-title {
  font-size: var(--market-font-md);
  font-weight: var(--market-weight-bold);
  color: var(--market-primary);
  margin: 0 0 var(--market-space-2);
  padding-bottom: var(--market-space-2);
  border-bottom: 2px solid var(--market-accent);
}

/* ============================================================
   Mobile: Sticky Submit Button
   ============================================================ */

@media (max-width: 767px) {
  .help-submit-area {
    position: sticky;
    bottom: var(--market-btm-nav-height);
    background: var(--market-bg);
    padding: var(--market-space-3) 0;
    margin-top: var(--market-space-4);
    border-top: 1px solid var(--market-border);
    z-index: var(--market-z-sticky);
  }
}

/* ============================================================
   Turnstile Widget
   ============================================================ */

.cf-turnstile {
  margin-top: var(--market-space-2);
}

/* ============================================================
   Reduced Motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .help-topic-card,
  .help-topic-check,
  .help-submit-btn,
  .help-input,
  .help-textarea,
  .help-select,
  .help-chevron,
  .help-deflection,
  .help-accordion-panel {
    transition: none;
  }

  .help-topic-card:active,
  .help-submit-btn:active {
    transform: none;
  }

  .help-spinner {
    animation: none;
  }

  .help-accordion-trigger[aria-expanded="true"] .help-chevron {
    transform: rotate(180deg); /* still flip, just no animation */
  }
}
