/* ─────────────────────────────────────────────
   Auto FAQ Schema — Admin Styles
───────────────────────────────────────────── */

/* ── Wrap ── */
.afs-wrap { max-width: 1200px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }

/* ── Header ── */
.afs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 24px;
  color: #fff;
}
.afs-header h1 { color: #fff; font-size: 22px; margin: 0 0 4px; line-height: 1.3; }
.afs-header-logo { display: flex; align-items: center; gap: 16px; }
.afs-logo-icon { font-size: 36px; line-height: 1; }
.afs-tagline { color: rgba(255,255,255,0.6); font-size: 13px; margin: 0; }
.afs-header-badges { display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }
.afs-badge {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.afs-badge-green  { background: rgba(74,222,128,0.2); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }
.afs-badge-blue   { background: rgba(96,165,250,0.2); color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }
.afs-badge-purple { background: rgba(196,181,253,0.2); color: #c4b5fd; border: 1px solid rgba(196,181,253,0.3); }

/* ── Layout ── */
.afs-layout { display: flex; gap: 24px; align-items: flex-start; }
.afs-col-main { flex: 1; min-width: 0; }
.afs-col-side { width: 340px; flex-shrink: 0; }
/* layout responsive — see responsive block below */

/* ── Cards ── */
.afs-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow: hidden;
}
.afs-card-sticky { position: sticky; top: 32px; }
.afs-card-info   { background: #f0f9ff; border-color: #bae6fd; }
.afs-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.afs-card-header h2 { font-size: 15px; font-weight: 700; margin: 0; color: #111827; }
.afs-card-icon { font-size: 18px; line-height: 1; }
.afs-card-body { padding: 20px; }

/* ── Fields ── */
.afs-field { margin-bottom: 20px; }
.afs-field:last-child { margin-bottom: 0; }
.afs-field-label {
  display: block; font-size: 13px; font-weight: 700;
  color: #374151; margin-bottom: 8px;
}
.afs-desc { font-size: 12px; color: #6b7280; margin: 5px 0 0; }
.afs-input-sm  { width: 100px; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.afs-input-full{ width: 100%; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; box-sizing: border-box; }
.afs-textarea  { width: 100%; height: 90px; padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; box-sizing: border-box; resize: vertical; }

/* ── Field Row ── */
.afs-field-row  { display: flex; gap: 20px; }
.afs-field-half { flex: 1; }

/* ── Toggle ── */
.afs-field-toggle { border-bottom: 1px solid #f3f4f6; padding-bottom: 20px; margin-bottom: 20px; }
.afs-toggle-label {
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; gap: 16px;
}
.afs-toggle-text strong { display: block; font-size: 14px; color: #111827; }
.afs-toggle-text span   { font-size: 12px; color: #6b7280; }
.afs-toggle-switch { position: relative; flex-shrink: 0; }
.afs-toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.afs-toggle-slider {
  display: block; width: 44px; height: 24px; background: #d1d5db;
  border-radius: 12px; cursor: pointer; transition: background .2s;
}
.afs-toggle-slider::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.afs-toggle-switch input:checked + .afs-toggle-slider { background: #10b981; }
.afs-toggle-switch input:checked + .afs-toggle-slider::after { transform: translateX(20px); }

/* ── Checkboxes ── */
.afs-checkboxes-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.afs-cb-label {
  display: inline-flex; align-items: center; gap: 5px;
  background: #f9fafb; border: 1px solid #e5e7eb;
  padding: 5px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.afs-cb-label:hover          { border-color: #6366f1; background: #eef2ff; }
.afs-cb-label input          { accent-color: #6366f1; }
.afs-cb-label input:checked  { accent-color: #6366f1; }

/* ── Pattern Grid ── */
.afs-pattern-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.afs-pattern-cb   {
  font-weight: 600; font-size: 12px;
  background: #f5f3ff; border-color: #ddd6fe;
}
.afs-pattern-cb:hover            { border-color: #7c3aed; background: #ede9fe; }
.afs-pattern-cb input:checked    { accent-color: #7c3aed; }
.afs-pattern-cb:has(input:checked) {
  background: #7c3aed; border-color: #7c3aed; color: #fff;
}

/* ── Actions ── */
.afs-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.afs-btn-save    { padding: 8px 22px !important; font-size: 14px !important; }
.afs-btn-preview {
  padding: 8px 18px; font-size: 13px; background: #f0f9ff !important;
  border-color: #7dd3fc !important; color: #0369a1 !important;
}
.afs-btn-preview:hover { background: #e0f2fe !important; }

/* ── Preview Panel ── */
.afs-preview-empty {
  text-align: center; padding: 24px 16px;
  color: #9ca3af; font-size: 13px; line-height: 1.6;
}
.afs-preview-loading { text-align: center; padding: 20px; }
.afs-spinner {
  display: inline-block; width: 22px; height: 22px;
  border: 3px solid #e5e7eb; border-top-color: #6366f1;
  border-radius: 50%; animation: afs-spin .7s linear infinite;
}
@keyframes afs-spin { to { transform: rotate(360deg); } }
.afs-preview-stats { margin-bottom: 10px; font-size: 13px; color: #374151; }
.afs-stat-badge {
  display: inline-block; background: #10b981; color: #fff;
  border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 700;
}
.afs-json-tabs { display: flex; gap: 2px; margin-bottom: 8px; }
.afs-tab {
  flex: 1; padding: 6px; border: 1px solid #e5e7eb;
  background: #f9fafb; cursor: pointer; font-size: 12px;
  border-radius: 6px; transition: background .15s;
}
.afs-tab.active { background: #6366f1; color: #fff; border-color: #6366f1; }

/* ── FAQ List (settings page preview) ── */
.afs-faq-list {}
.afs-faq-post { margin-bottom: 16px; }
.afs-faq-post-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: #6366f1; margin-bottom: 6px;
  padding-bottom: 4px; border-bottom: 1px solid #e5e7eb;
}
.afs-faq-item {
  background: #f9fafb; border-left: 3px solid #10b981;
  border-radius: 0 6px 6px 0; padding: 8px 10px; margin-bottom: 6px;
}
.afs-faq-q { font-size: 12px; font-weight: 700; color: #111827; margin-bottom: 3px; }
.afs-faq-a { font-size: 11px; color: #6b7280; line-height: 1.5; max-height: 40px; overflow: hidden; }

.afs-json-output {
  background: #0f172a; color: #a5f3fc;
  border-radius: 8px; padding: 14px; font-size: 11px; line-height: 1.6;
  max-height: 340px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
  margin: 0;
}

/* ── How It Works ── */
.afs-steps { padding-left: 20px; margin: 0; }
.afs-steps li { font-size: 13px; color: #374151; margin-bottom: 8px; line-height: 1.5; }
.afs-steps code { background: #f0f9ff; padding: 1px 5px; border-radius: 3px; font-size: 11px; }

/* ── Meta Box ── */
.afs-meta-box { font-size: 13px; }
.afs-meta-status {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px; background: #f0fdf4;
  border: 1px solid #bbf7d0; margin-bottom: 12px; font-weight: 600;
}
.afs-meta-status.disabled { background: #fef2f2; border-color: #fecaca; }
.afs-meta-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.afs-dot-on  { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.afs-dot-off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.afs-meta-field { margin-bottom: 12px; }
.afs-meta-toggle-row {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-weight: 600; font-size: 12px; color: #374151;
}
.afs-meta-toggle-knob {
  width: 36px; height: 20px; background: #d1d5db; border-radius: 10px;
  position: relative; flex-shrink: 0; transition: background .2s;
}
.afs-meta-toggle-knob::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.afs-meta-toggle-row input:checked ~ .afs-meta-toggle-knob { background: #ef4444; }
.afs-meta-toggle-row input:checked ~ .afs-meta-toggle-knob::after { transform: translateX(16px); }
.afs-meta-toggle-row input { display: none; }
.afs-post-faq-items { max-height: 200px; overflow-y: auto; margin-bottom: 8px; }
.afs-post-faq-item {
  background: #f0fdf4; border-left: 3px solid #10b981;
  padding: 6px 8px; margin-bottom: 5px; border-radius: 0 4px 4px 0; font-size: 11px;
}
.afs-post-faq-item-q { font-weight: 700; color: #065f46; margin-bottom: 2px; }
.afs-post-faq-item-a { color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.afs-post-json {
  background: #0f172a; color: #a5f3fc; border-radius: 6px;
  padding: 10px; font-size: 10px; max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all; margin: 0;
}

/* ── v2.0 additions ── */
.afs-version-badge {
  background: #6366f1; color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px; vertical-align: middle; font-family: monospace;
}
.afs-new-badge {
  background: #f59e0b; color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 8px; vertical-align: middle; margin-left: 6px;
}
.afs-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.afs-header-credit { font-size: 12px; color: rgba(255,255,255,0.5); }
.afs-header-credit a { color: #93c5fd; text-decoration: none; font-weight: 600; }
.afs-header-credit a:hover { color: #fff; }
.afs-badge-orange { background: rgba(251,146,60,0.2); color: #fb923c; border: 1px solid rgba(251,146,60,0.3); }

/* P and Bold detection boxes */
.afs-detect-box { border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.afs-detect-p   { background: #f0fdf4; border: 1px solid #bbf7d0; }
.afs-detect-bold{ background: #f5f3ff; border: 1px solid #ddd6fe; }

/* Info box */
.afs-info-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px;
  padding: 10px 14px; font-size: 12px; color: #92400e; margin-top: 4px;
  line-height: 1.6;
}

/* Credit card (sidebar) */
.afs-credit-card {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  border-radius: 10px; padding: 16px 20px; margin-top: 4px;
}
.afs-credit-icon { font-size: 28px; line-height: 1; }
.afs-credit-name { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.afs-credit-by   { font-size: 12px; color: rgba(255,255,255,0.5); }
.afs-credit-by a { color: #93c5fd; text-decoration: none; font-weight: 600; }
.afs-credit-by a:hover { color: #fff; }

/* Advanced detect box — teal card matching other detect boxes */
.afs-detect-advanced {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
}
.afs-detect-advanced strong { color: #0f766e; }

/* 3rd party notices — force visible white bg + dark text */
.notice:not(.afs-own-notice) {
  background: #fff !important;
  color: #1d2327 !important;
}
.notice:not(.afs-own-notice) p,
.notice:not(.afs-own-notice) span,
.notice:not(.afs-own-notice) div {
  color: #1d2327 !important;
}

/* Upgrade notice — multicolor gradient text */
.afs-free-limit-notice strong {
  background: linear-gradient(90deg, #0073aa, #00b4d8, #0073aa);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: afs-shimmer 2s linear infinite;
}
@keyframes afs-shimmer {
  to { background-position: 200% center; }
}

/* ============================================================
   AUTO FAQ SCHEMA — MOBILE RESPONSIVE (CSS only, no PHP touched)
   ============================================================ */

/* ─── TABLET 900px ─── */
@media (max-width: 900px) {
  .afs-wrap { padding: 0 8px; box-sizing: border-box; overflow-x: hidden; }
  .afs-layout { flex-direction: column; }
  .afs-col-side { width: 100%; }
  .afs-col-side .afs-card-sticky { position: static; }
  .afs-field-row { flex-direction: column; gap: 12px; }
  .afs-field-half { flex: none; width: 100%; }
  .afs-actions { flex-direction: column; align-items: stretch; }
  .afs-btn-save,
  .afs-btn-preview { width: 100% !important; text-align: center; box-sizing: border-box; }
}

/* ─── MOBILE 782px ─── */
@media (max-width: 782px) {

  /* == SETTINGS / WELCOME PAGE == */
  .afs-hero                { padding: 20px 16px 24px !important; }
  .afs-hero-inner          { flex-direction: column !important; gap: 12px !important; }
  .afs-hero-icon           { width: 52px !important; height: 52px !important; font-size: 26px !important; }
  .afs-hero h1             { font-size: 20px !important; }
  .afs-hero p              { font-size: 13px !important; }
  .afs-version             { position: static !important; display: inline-block !important; margin-bottom: 8px !important; }
  .afs-qs-grid             { grid-template-columns: 1fr !important; }
  .afs-quick               { padding: 16px !important; }
  .afs-body                { grid-template-columns: 1fr !important; }
  .afs-left                { padding: 16px !important; border-right: none !important; border-bottom: 1px solid #e5e7eb !important; }
  .afs-right               { padding: 16px !important; }
  .afs-feat-grid           { grid-template-columns: 1fr !important; }
  .afs-cta                 { flex-direction: column !important; }
  .afs-btn-primary,
  .afs-btn-secondary,
  .afs-btn-ghost           { width: 100% !important; justify-content: center !important; box-sizing: border-box !important; }
  .afs-welcome-footer      { flex-direction: column !important; text-align: center !important; padding: 12px 16px !important; }

  /* == UPGRADE PAGE — pricing cards ==
     WP body class for afs-upgrade page = admin_page_afs-upgrade
     Using body class gives highest safe specificity without touching PHP */
  .admin_page_afs-upgrade .afs-upgrade-wrap { overflow-x: hidden; }

  /* Force flex container to column */
  .admin_page_afs-upgrade div[style*="display:flex"][style*="gap:18px"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  /* Override inline width:195px on each card */
  .admin_page_afs-upgrade div[style*="width:195px"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Lifetime box */
  .admin_page_afs-upgrade div[style*="max-width:440px"] {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Upgrade wrap */
  .afs-upgrade-wrap { max-width: 100% !important; padding: 0 12px !important; box-sizing: border-box !important; }

  /* == ALL PREMIUM .wrap max-widths == */
  .wrap[style*="max-width:700px"],
  .wrap[style*="max-width:800px"],
  .wrap[style*="max-width:900px"],
  .wrap[style*="max-width:960px"],
  .wrap[style*="max-width:1000px"] {
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box !important;
  }

  /* == ALL hardcoded inputs/selects — per specific value for max specificity == */
  .wrap input[style*="width:200px"],
  .wrap input[style*="width:250px"],
  .wrap input[style*="width:300px"],
  .wrap input[style*="width:350px"],
  .wrap input[style*="width:400px"],
  .wrap select[style*="width:250px"],
  .wrap select[style*="width:300px"],
  .wrap select[style*="width:350px"],
  .wrap select[style*="width:400px"],
  .wrap td input[style*="width:300px"],
  .wrap td input[style*="width:350px"],
  .wrap td input[style*="width:400px"],
  .wrap td select[style*="width:300px"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* == INLINE GRID layouts → 1 column == */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr;"],
  div[style*="grid-template-columns:repeat(3,1fr)"],
  div[style*="grid-template-columns:repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* == FLEX ROWS that overflow == */
  .afs-cond-rule { flex-wrap: wrap !important; }
  .wrap div[style*="display:flex"][style*="justify-content:space-between"] { flex-wrap: wrap !important; gap: 8px !important; }
  .wrap .notice[style*="display:flex"] { flex-wrap: wrap !important; }

  /* == TABLES horizontal scroll == */
  .wrap table { display: block !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; width: 100% !important; }

  /* == Analytics fixed-width divs == */
  .wrap div[style*="width:100px"],
  .wrap div[style*="width:50px"] { width: auto !important; min-width: 0 !important; }
}

/* ─── PHONE 480px ─── */
@media (max-width: 480px) {
  .afs-wrap               { padding: 0 4px; }
  .afs-hero h1            { font-size: 17px !important; }
  .afs-hbadge             { font-size: 10px !important; padding: 2px 8px !important; }
  .afs-card-body          { padding: 12px !important; }
  .afs-card-header        { padding: 10px 12px !important; }
  .afs-json-output        { font-size: 10px !important; max-height: 200px !important; }
}

/* Shimmer animation for upgrade button */
@keyframes utsafsShimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
