/* ==========================================================================
   Wise Agent — Admin Settings Page
   Scoped under .wa-settings-page so nothing bleeds into other WP pages.
   ========================================================================== */

.wa-settings-page *,
.wa-settings-page *::before,
.wa-settings-page *::after {
  box-sizing: border-box;
}

/* ── Page wrapper ─────────────────────────────────────────────────────────── */
.wa-settings-page {
  margin: 20px 20px 40px 0;
  max-width: 860px;
}

/* ── Page header ──────────────────────────────────────────────────────────── */
.wa-settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.wa-settings-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.wa-settings-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #e8f4fd;
  color: #0073aa;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Section heading ──────────────────────────────────────────────────────── */
.wa-section-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 12px;
}

/* ── Connection banner (not logged in) ───────────────────────────────────── */
.wa-connection-banner {
  background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
  border-radius: 12px;
  padding: 32px 36px;
  color: #fff;
  margin-bottom: 24px;
}

.wa-connection-banner h2 {
  margin: 0 0 10px;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.wa-connection-banner p {
  margin: 0 0 22px;
  opacity: 0.88;
  font-size: 0.9rem;
  max-width: 460px;
  line-height: 1.55;
}

.wa-connection-banner .wa-btn-connect {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  color: #0073aa !important;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: none !important;
  height: auto;
  line-height: 1.4;
  transition: opacity 150ms;
}

.wa-connection-banner .wa-btn-connect:hover {
  background: #e8f4fd;
  color: #005a87 !important;
  opacity: 1;
}

/* Error callout inside the connection banner */
.wa-connection-banner__errors {
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(252, 165, 165, 0.5);
  border-left: 3px solid #fca5a5;
  border-radius: 7px;
  padding: 12px 16px;
  margin-bottom: 20px;
}

.wa-connection-banner__error-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fecaca;
  margin: 0 0 6px;
}

.wa-connection-banner__error-msg {
  margin: 0;
  color: #fff !important;
  font-size: 0.85rem;
  opacity: 0.95;
  line-height: 1.5;
}

.wa-connection-banner__error-msg + .wa-connection-banner__error-msg {
  margin-top: 6px;
}

/* ── Profile card — reconnect state ──────────────────────────────────────── */
.wa-profile-card--reconnect {
  border-color: #fde68a;
  background: #fffbeb;
}

.wa-profile-card--reconnect .wa-profile-card__avatar {
  background: #fef3c7;
  border-color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-profile-card--reconnect .wa-profile-card__avatar .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
  line-height: 24px;
  color: #d97706;
}

.wa-profile-card--reconnect .wa-profile-card__name {
  color: #92400e;
}

.wa-profile-card--reconnect .wa-profile-card__email {
  color: #b45309;
}

/* ── Error notice ─────────────────────────────────────────────────────────── */
.wa-error-notice {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.wa-error-notice h3 {
  margin: 0 0 6px;
  color: #991b1b;
  font-size: 0.9rem;
  font-weight: 700;
}

.wa-error-notice p {
  margin: 0 0 4px;
  color: #991b1b;
  font-size: 0.85rem;
}

.wa-error-notice p:last-child {
  margin-bottom: 0;
}

/* ── Elementor install notice ─────────────────────────────────────────────── */
.wa-elementor-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.wa-elementor-notice h3 {
  margin: 0 0 6px;
  color: #78350f;
  font-size: 0.9rem;
  font-weight: 700;
}

.wa-elementor-notice p {
  margin: 0 0 12px;
  color: #78350f;
  font-size: 0.85rem;
}

/* ── Profile card ─────────────────────────────────────────────────────────── */
.wa-profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wa-profile-card__avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  background: #f1f5f9;
}

.wa-profile-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wa-profile-card__info {
  flex: 1;
  min-width: 0;
}

.wa-profile-card__name {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-profile-card__email {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-profile-card__connected {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
}

.wa-profile-card__connected::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
}

.wa-profile-card__actions {
  flex-shrink: 0;
}

.wa-btn-disconnect {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  background: transparent;
  border: 1.5px solid #ef4444;
  color: #ef4444 !important;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  transition:
    background 150ms,
    color 150ms;
  line-height: 1.4;
  height: auto;
}

.wa-btn-disconnect:hover,
.wa-btn-disconnect:focus {
  background: #ef4444;
  color: #fff !important;
}

/* ── Settings section cards ───────────────────────────────────────────────── */
.wa-settings-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

/* Override the flat legacy styles from wiseagent-form.css */
.wa-settings-section .wa-collapsible-title {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px;
  padding: 15px 20px;
  cursor: pointer;
  background: #fff;
  border: none !important;
  border-bottom: 1px solid #f1f5f9;
  width: 100% !important;
  transition: background 120ms;
  user-select: none;
  height: auto !important;
  border-radius: 0;
}

.wa-settings-section .wa-collapsible-title:hover {
  background: #f8fafc;
}

/* Force all direct children except links to be click-transparent
   so event.target lands on the .wa-collapsible-title div itself */
.wa-settings-section .wa-collapsible-title > * {
  pointer-events: none;
}

.wa-settings-section .wa-collapsible-title h3 a {
  pointer-events: auto;
}

.wa-settings-section .wa-collapsible-title h3 {
  flex: 1;
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
}

.wa-settings-section .wa-collapsible-title h3 a {
  color: #1e293b;
  text-decoration: none;
}

.wa-settings-section .wa-collapsible-title h3 a:hover {
  color: #0073aa;
}

.wa-settings-section .wa-collapsible-title .dashicons {
  color: #94a3b8;
  font-size: 18px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  flex-shrink: 0;
}

/* Section icon badge */
.wa-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #e8f4fd;
  flex-shrink: 0;
}

.wa-section-icon .dashicons {
  font-size: 15px !important;
  width: 15px !important;
  height: 15px !important;
  line-height: 15px !important;
  color: #0073aa !important;
  pointer-events: none;
}

/* Status badge next to section title */
.wa-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  pointer-events: none;
}

.wa-status-badge--enabled {
  background: #dcfce7;
  color: #15803d;
}

.wa-status-badge--disabled {
  background: #f1f5f9;
  color: #94a3b8;
}

.wa-status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Collapsible content body */
.wa-settings-section .wiseagent-form-body.wa-collapsible-content {
  background: #fff;
  padding: 22px 24px;
  width: 100% !important;
  border-radius: 0;
}

/* ── Form field layout ────────────────────────────────────────────────────── */
.wa-field-row {
  margin-bottom: 16px;
}

.wa-field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  letter-spacing: 0.015em;
}

.wa-field-input {
  display: block;
  width: 100%;
  max-width: 520px;
  padding: 8px 12px;
  font-size: 0.875rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  color: #1e293b;
  background: #fdfdfd;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
  line-height: 1.5;
  height: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.wa-field-input:focus {
  outline: none;
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

/* ── Form actions row ─────────────────────────────────────────────────────── */
.wa-form-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wa-btn-save {
  display: inline-flex;
  align-items: center;
  padding: 9px 22px;
  background: #0073aa;
  color: #fff !important;
  border: none;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 150ms ease,
    transform 100ms;
  line-height: 1.4;
  height: auto;
}

.wa-btn-save:hover {
  background: #005a87;
  color: #fff !important;
  transform: translateY(-1px);
}

.wa-btn-save:active {
  transform: translateY(0);
}

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.wa-toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  margin-bottom: 10px;
  cursor: pointer;
  transition:
    border-color 150ms,
    background 150ms;
}

.wa-toggle-row:last-of-type {
  margin-bottom: 0;
}

.wa-toggle-row.is-checked {
  border-color: #0073aa;
  background: #f0f8ff;
}

.wa-toggle {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.wa-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.wa-toggle__track {
  display: block;
  width: 38px;
  height: 22px;
  background: #d1d5db;
  border-radius: 11px;
  cursor: pointer;
  position: relative;
  transition: background 200ms;
  flex-shrink: 0;
}

.wa-toggle input:checked ~ .wa-toggle__track {
  background: #0073aa;
}

.wa-toggle__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.wa-toggle input:checked ~ .wa-toggle__track::after {
  transform: translateX(16px);
}

.wa-toggle-text {
  flex: 1;
  min-width: 0;
}

.wa-toggle-text__label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: #1e293b;
  cursor: pointer;
  margin-bottom: 2px;
}

.wa-toggle-text__desc {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.4;
}

.wa-toggle-text__count {
  font-size: 0.73rem;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 5px;
}

/* ── Sub-section (nested card, e.g. Single Event Pages) ─────────────────── */
.wa-sub-section {
  margin-top: 20px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  overflow: hidden;
}

.wa-sub-section__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

.wa-sub-section__title {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  margin: 0;
  letter-spacing: 0.01em;
}

.wa-sub-section__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #e8f4fd;
  flex-shrink: 0;
}

.wa-sub-section__icon .dashicons {
  font-size: 13px;
  width: 13px;
  height: 13px;
  line-height: 13px;
  color: #0073aa;
}

.wa-sub-section__body {
  padding: 16px;
  background: #fff;
}

/* ── Layout picker ────────────────────────────────────────────────────────── */
.wa-layout-picker {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.wa-layout-option {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.wa-layout-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.wa-layout-preview {
  width: 148px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  transition:
    border-color 150ms,
    box-shadow 150ms;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  text-align: center;
}

.wa-layout-preview:hover {
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wa-layout-option.is-selected .wa-layout-preview {
  border-color: #0073aa;
  box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.12);
}

.wa-layout-option__name {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-align: center;
  pointer-events: none;
}

.wa-layout-option.is-selected .wa-layout-option__name {
  color: #0073aa;
}

/* Layout preview slots */
.wa-lp-hero {
  background: #b6cedf;
  height: 34px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: #334155;
  margin-bottom: 5px;
  text-align: center;
}

.wa-lp-row {
  display: flex;
  gap: 4px;
}

.wa-lp-content {
  flex: 1;
  background: #ebebeb;
  border-radius: 3px;
  height: 52px;
  font-size: 7px;
  color: #666;
  padding: 3px 4px;
  text-align: center;
}

.wa-lp-sidebar {
  width: 42px;
  background: #ddeef9;
  border-radius: 3px;
  height: 52px;
  font-size: 7px;
  color: #555;
  padding: 3px 4px;
  text-align: center;
}

.wa-lp-img {
  width: 52px;
  background: #b6cedf;
  border-radius: 3px;
  height: 62px;
  font-size: 7px;
  color: #334155;
  padding: 3px 4px;
  text-align: center;
}

.wa-lp-info {
  flex: 1;
  background: #ddeef9;
  border-radius: 3px;
  height: 62px;
  font-size: 7px;
  color: #666;
  padding: 3px 4px;
  text-align: center;
}

.wa-lp-full {
  background: #ebebeb;
  border-radius: 3px;
  height: 22px;
  font-size: 7px;
  color: #666;
  padding: 3px 4px;
  margin-top: 4px;
  text-align: center;
}

/* ── Custom CSS textarea ──────────────────────────────────────────────────── */
.wa-custom-css-box {
  margin-top: 18px;
}

.wa-custom-css-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.wa-custom-css-box p {
  margin: 0 0 8px;
  font-size: 0.75rem;
  color: #64748b;
}

.wa-custom-css-box textarea {
  width: 100%;
  font-family:
    "Fira Code", "Cascadia Code", "JetBrains Mono", "Courier New", monospace;
  font-size: 12px;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  padding: 10px 12px;
  resize: vertical;
  background: #1e293b;
  color: #e2e8f0;
  line-height: 1.65;
  transition: border-color 150ms;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.wa-custom-css-box textarea:focus {
  outline: none;
  border-color: #0073aa;
}

/* ── Settings notice (info box) inside a card ─────────────────────────────── */
.wa-settings-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 8px;
  margin-top: 20px;
  font-size: 0.8rem;
  line-height: 1.5;
}

.wa-settings-notice--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.wa-settings-notice--info .dashicons {
  color: #3b82f6;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 16px;
}

.wa-settings-notice__body {
  flex: 1;
}

.wa-settings-notice ul {
  margin: 5px 0 0 16px;
  padding: 0;
}

.wa-settings-notice ul li {
  margin-bottom: 3px;
}

.wa-settings-notice a {
  color: inherit;
  font-weight: 700;
}

/* ── CPT toggle rows ──────────────────────────────────────────────────────── */
.wa-cpt-toggles {
  margin-bottom: 0;
}
