/* ═══════════════════════════════════════════════════════════════════════
   WP WhatsApp Audience Connect — Public Form Stylesheet
   ══════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ────────────────────────────────────────────── */
:root {
  /* These are the defaults — overridden per-element via PHP inline style */
  --wpwac-p-accent:      #25d366;
  --wpwac-p-accent-dk:   color-mix(in srgb, var(--wpwac-p-accent) 80%, #000 20%);
  --wpwac-p-accent-light: color-mix(in srgb, var(--wpwac-p-accent) 15%, #fff 85%);

  --wpwac-p-bg:       #ffffff;
  --wpwac-p-surface:  #f8fafc;
  --wpwac-p-border:   #e2e8f0;
  --wpwac-p-text:     #0f172a;
  --wpwac-p-muted:    #64748b;
  --wpwac-p-success:  #10b981;
  --wpwac-p-danger:   #ef4444;

  --wpwac-p-radius:    16px;
  --wpwac-p-radius-sm: 8px;
  --wpwac-btn-radius:  8px;        /* overridden per-element from settings */
  --wpwac-p-font:      inherit;
  --wpwac-p-shadow:    0 4px 24px rgba(0,0,0,0.07);
  --wpwac-p-tr:        0.2s ease;
}

/* box-sizing everywhere in WPWAC scope */
.wpwac-strip-wrap *,
.wpwac-full-wrap *,
.wpwac-modal-overlay *,
.wpwac-popup-overlay *,
.wpwac-form-message {
  box-sizing: border-box;
  font-family: var(--wpwac-p-font);
}

/* ════════════════════════════════════════════════════════════════════════
   1. STRIP / INLINE FORM  [wpwac_form]
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-strip-wrap {
  display: inline-block;
  width: 100%;
}

/* One-line row: CC select + phone input + button */
/* High specificity overrides to insulate the Inline form layout from themes */
.wpwac-strip-wrap .wpwac-strip-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0 !important;
  border: 1.5px solid var(--wpwac-p-border) !important;
  border-radius: var(--wpwac-btn-radius) !important;
  overflow: hidden !important;
  background: var(--wpwac-p-input-bg) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
  transition: box-shadow var(--wpwac-p-tr) !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 44px !important;
  box-sizing: border-box !important;
}

.wpwac-strip-wrap .wpwac-strip-row:focus-within {
  border-color: var(--wpwac-p-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpwac-p-accent) 25%, transparent) !important;
}

/* Country-code dropdown in strip */
.wpwac-strip-wrap .wpwac-strip-row select.wpwac-strip-cc {
  flex-shrink: 0 !important;
  padding: 0 26px 0 12px !important;
  background: transparent !important;
  border: none !important;
  border-right: 1.5px solid var(--wpwac-p-border) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--wpwac-p-text) !important;
  cursor: pointer !important;
  outline: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  min-width: 90px !important;
  width: 90px !important;
  max-width: 90px !important;
  height: 44px !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

/* Phone input in strip */
.wpwac-strip-wrap .wpwac-strip-row input.wpwac-strip-phone {
  flex: 1 !important;
  min-width: 120px !important;
  width: auto !important;
  padding: 0 14px !important;
  height: 44px !important;
  background: transparent !important;
  border: none !important;
  border-right: none !important;
  outline: none !important;
  font-size: 15px !important;
  color: var(--wpwac-p-text) !important;
  box-shadow: none !important;
  display: block !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
}

.wpwac-strip-wrap .wpwac-strip-row input.wpwac-strip-phone::placeholder {
  color: #94a3b8 !important;
}

/* Submit button in strip */
.wpwac-strip-wrap .wpwac-strip-row button.wpwac-strip-btn {
  flex-shrink: 0 !important;
  padding: 0 20px !important;
  height: 44px !important;
  background: var(--wpwac-p-accent) !important;
  color: var(--wpwac-p-accent-text) !important;
  border: none !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  transition: background var(--wpwac-p-tr) !important;
  border-radius: 0 calc(var(--wpwac-btn-radius) - 1.5px) calc(var(--wpwac-btn-radius) - 1.5px) 0 !important;
  box-shadow: none !important;
  width: auto !important;
  box-sizing: border-box !important;
}

.wpwac-strip-wrap .wpwac-strip-row button.wpwac-strip-btn:hover {
  background: var(--wpwac-p-accent-dk) !important;
}

/* Make modal submit button full-width */
.wpwac-modal-submit-btn {
  width: 100%;
  margin-top: 12px;
  border-radius: var(--wpwac-btn-radius) !important;
  height: 44px;
  justify-content: center;
}

/* Consent row — compact single line */
.wpwac-strip-consent {
  display: flex !important;
  align-items: flex-start !important;
  gap: 8px !important;
  margin-top: 8px !important;
  cursor: pointer !important;
  user-select: none !important;
}

.wpwac-strip-consent input[type="checkbox"] {
  appearance: none !important;
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  margin-top: 2px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 4px !important;
  background: #fff !important;
  display: grid !important;
  place-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  box-shadow: none !important;
}

.wpwac-strip-consent input[type="checkbox"]::before {
  content: "" !important;
  width: 8px !important;
  height: 8px !important;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%) !important;
  transform: scale(0) !important;
  background: #fff !important;
  transition: 0.1s transform !important;
}

.wpwac-strip-consent input[type="checkbox"]:checked {
  background: var(--wpwac-p-accent) !important;
  border-color: var(--wpwac-p-accent) !important;
}

.wpwac-strip-consent input[type="checkbox"]:checked::before {
  transform: scale(1) !important;
}

.wpwac-strip-consent span {
  font-size: 12px;
  color: var(--wpwac-p-muted);
  line-height: 1.4;
}

.wpwac-strip-consent span a {
  color: var(--wpwac-p-accent);
  text-decoration: none;
}

.wpwac-strip-consent span a:hover {
  text-decoration: underline;
}

/* Inline consent inside strip-row */
.wpwac-strip-consent-inline {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 0 12px !important;
  border-right: 1.5px solid var(--wpwac-p-border) !important;
  flex-shrink: 0 !important;
  white-space: nowrap !important;
  user-select: none !important;
  cursor: pointer !important;
  background: transparent !important;
}

.wpwac-strip-consent-inline input[type="checkbox"] {
  appearance: none !important;
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  border: 1.5px solid var(--wpwac-p-border) !important;
  border-radius: 3px !important;
  background: #fff !important;
  display: grid !important;
  place-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.wpwac-strip-consent-inline input[type="checkbox"]::before {
  content: "" !important;
  width: 7px !important;
  height: 7px !important;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%) !important;
  transform: scale(0) !important;
  background: #fff !important;
  transition: 0.1s transform !important;
}

.wpwac-strip-consent-inline input[type="checkbox"]:checked {
  background: var(--wpwac-p-accent) !important;
  border-color: var(--wpwac-p-accent) !important;
}

.wpwac-strip-consent-inline input[type="checkbox"]:checked::before {
  transform: scale(1) !important;
}

.wpwac-strip-consent-inline span {
  font-size: 11px !important;
  color: var(--wpwac-p-text) !important;
  line-height: 1 !important;
  font-weight: 500 !important;
}

.wpwac-strip-consent-inline span a {
  color: var(--wpwac-p-accent) !important;
  text-decoration: none !important;
}

.wpwac-strip-consent-inline span a:hover {
  text-decoration: underline !important;
}

/* ════════════════════════════════════════════════════════════════════════
   2. FULL / DEDICATED PAGE FORM  [wpwac_form layout="classic"]
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-full-wrap {
  background: var(--wpwac-p-bg);
  border: 1px solid var(--wpwac-p-border);
  border-radius: var(--wpwac-p-radius);
  padding: 32px;
  max-width: 480px;
  box-shadow: var(--wpwac-p-shadow);
  position: relative;
  overflow: hidden;
  margin: 16px auto;
}

/* Top accent bar */
.wpwac-full-wrap::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--wpwac-p-accent);
  border-radius: 4px 4px 0 0;
}

.wpwac-full-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--wpwac-p-text);
  line-height: 1.3;
}

.wpwac-full-desc {
  font-size: 14px;
  color: var(--wpwac-p-muted);
  margin: 0 0 24px;
  line-height: 1.6;
}

/* Full-width phone row for full layout */
.wpwac-phone-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.wpwac-country-code {
  width: 110px !important;
  flex-shrink: 0 !important;
  padding: 11px 10px !important;
  background: #fff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--wpwac-p-radius-sm) !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--wpwac-p-text) !important;
  outline: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  padding-right: 28px !important;
  cursor: pointer !important;
  transition: border-color var(--wpwac-p-tr) !important;
  box-shadow: none !important;
}

.wpwac-phone-input {
  flex: 1 !important;
  padding: 11px 14px !important;
  background: #fff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--wpwac-p-radius-sm) !important;
  font-size: 15px !important;
  color: var(--wpwac-p-text) !important;
  outline: none !important;
  transition: border-color var(--wpwac-p-tr), box-shadow var(--wpwac-p-tr) !important;
}

.wpwac-phone-input::placeholder { color: #94a3b8 !important; }

.wpwac-phone-input:focus,
.wpwac-country-code:focus,
.wpwac-field:focus {
  border-color: var(--wpwac-p-accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpwac-p-accent) 20%, transparent) !important;
}

/* Generic field */
.wpwac-field-wrap { margin-bottom: 14px; }

.wpwac-field {
  width: 100% !important;
  padding: 11px 14px !important;
  background: #fff !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: var(--wpwac-p-radius-sm) !important;
  font-size: 15px !important;
  color: var(--wpwac-p-text) !important;
  outline: none !important;
  transition: border-color var(--wpwac-p-tr), box-shadow var(--wpwac-p-tr) !important;
}

.wpwac-field::placeholder { color: #94a3b8 !important; }

/* Consent row in full form */
.wpwac-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
  cursor: pointer;
  user-select: none;
}

.wpwac-consent-row input[type="checkbox"] {
  appearance: none !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  margin-top: 2px !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 5px !important;
  background: #fff !important;
  display: grid !important;
  place-content: center !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  box-shadow: none !important;
}

.wpwac-consent-row input[type="checkbox"]::before {
  content: "" !important;
  width: 10px !important;
  height: 10px !important;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%) !important;
  transform: scale(0) !important;
  background: #fff !important;
  transition: 0.1s transform !important;
}

.wpwac-consent-row input[type="checkbox"]:checked {
  background: var(--wpwac-p-accent) !important;
  border-color: var(--wpwac-p-accent) !important;
}

.wpwac-consent-row input[type="checkbox"]:checked::before {
  transform: scale(1) !important;
}

.wpwac-consent-label {
  font-size: 13px;
  color: var(--wpwac-p-muted);
  line-height: 1.5;
}

.wpwac-consent-label a {
  color: var(--wpwac-p-accent);
  text-decoration: none;
}

/* Full-width submit button */
.wpwac-submit-btn,
.wpwac-btn-full {
  width: 100% !important;
  padding: 13px !important;
  background: var(--wpwac-p-accent) !important;
  color: var(--wpwac-p-accent-text) !important;
  border: none !important;
  border-radius: var(--wpwac-btn-radius) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  transition: background var(--wpwac-p-tr), box-shadow var(--wpwac-p-tr) !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--wpwac-p-accent) 30%, transparent) !important;
}

.wpwac-submit-btn:hover,
.wpwac-btn-full:hover {
  background: var(--wpwac-p-accent-dk) !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--wpwac-p-accent) 40%, transparent) !important;
}

.wpwac-submit-btn:disabled,
.wpwac-btn-full:disabled {
  background: #cbd5e1 !important;
  color: #f8fafc !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

/* Spinner */
.wpwac-submit-btn .spinner,
.wpwac-strip-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wpwac-spin .7s linear infinite;
  display: none;
}

.wpwac-submit-btn.loading .spinner,
.wpwac-strip-btn.loading .spinner  { display: block; }
.wpwac-submit-btn.loading .btn-text,
.wpwac-strip-btn.loading .btn-text { opacity: .75; }

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

/* ════════════════════════════════════════════════════════════════════════
   3. COMPACT MODAL  [wpwac_widget]  — triggered by data-wpwac-open
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999998;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.wpwac-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.wpwac-modal-box {
  background: #fff;
  border-radius: var(--wpwac-p-radius);
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 360px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  transform: scale(0.92) translateY(16px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

/* Accent top bar */
.wpwac-modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--wpwac-p-accent);
}

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

.wpwac-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f1f5f9;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all var(--wpwac-p-tr);
}

.wpwac-modal-close:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: rotate(90deg);
}

.wpwac-modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.wpwac-modal-icon {
  font-size: 22px;
  line-height: 1;
}

.wpwac-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--wpwac-p-text);
  margin: 0;
  line-height: 1.3;
}

/* Strip row inside modal: no border-radius override needed, inherits strip */
.wpwac-modal-form .wpwac-strip-row {
  border-radius: var(--wpwac-btn-radius);
}

/* ════════════════════════════════════════════════════════════════════════
   4. AUTO-OPEN POPUP  [wpwac_popup]
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
  padding: 16px;
}

.wpwac-popup-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.wpwac-popup-box {
  max-width: 460px;
  width: 100%;
  position: relative;
  transform: scale(0.94) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wpwac-popup-overlay.open .wpwac-popup-box {
  transform: scale(1) translateY(0);
}

.wpwac-popup-close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 10;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all var(--wpwac-p-tr);
}

.wpwac-popup-close:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: rotate(90deg);
}

.wpwac-popup-box .wpwac-full-wrap {
  margin: 0;
  box-shadow: 0 24px 60px rgba(0,0,0,0.2);
}

/* ════════════════════════════════════════════════════════════════════════
   5. TRIGGER BUTTON  [wpwac_trigger]
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--wpwac-p-accent);
  color: #fff;
  border: none;
  border-radius: var(--wpwac-btn-radius, 8px);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--wpwac-p-font);
  cursor: pointer;
  transition: background var(--wpwac-p-tr), box-shadow var(--wpwac-p-tr);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--wpwac-p-accent) 30%, transparent);
}

.wpwac-trigger-btn:hover {
  background: var(--wpwac-p-accent-dk);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--wpwac-p-accent) 40%, transparent);
}

/* ════════════════════════════════════════════════════════════════════════
   6. SUCCESS / ERROR MESSAGES
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-form-message {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 8px;
  animation: wpwac-fade-in 0.3s ease;
}

@keyframes wpwac-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wpwac-form-message.success {
  display: flex;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #10b981;
}

.wpwac-form-message.error {
  display: flex;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Premium Layout Shift Prevention on Success */
.wpwac-form-success {
  position: relative !important;
}

.wpwac-form-success > *:not(.wpwac-form-message) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.3s ease !important;
}

.wpwac-form-success .wpwac-form-message.success {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
  border: none !important;
  color: var(--wpwac-p-success, #10b981) !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  z-index: 10 !important;
  box-sizing: border-box !important;
  padding: 0 10px !important;
  text-align: center !important;
  animation: wpwac-fade-in 0.3s ease !important;
}

/* ════════════════════════════════════════════════════════════════════════
   7. UTILITY
   ════════════════════════════════════════════════════════════════════════ */

.wpwac-mt-12 { margin-top: 12px !important; }

/* ════════════════════════════════════════════════════════════════════════
   8. RESPONSIVE
   ════════════════════════════════════════════════════════════════════════ */

@media (max-width: 520px) {
  .wpwac-full-wrap     { padding: 24px 18px; }
  .wpwac-phone-row     { flex-direction: column; }
  .wpwac-country-code  { width: 100%; }
  .wpwac-modal-box     { padding: 24px 18px 20px; }
  .wpwac-popup-close   { top: 10px; right: 10px; }
}
