/**
 * Portiq Form Styles
 * Scoped via .portiq-form-wrapper to avoid conflicts with WP themes.
 * Uses CSS custom properties for theming.
 */

.portiq-form-wrapper {
  --portiq-primary: #9195F0;
  --portiq-primary-hover: #7b7fe8;
  --portiq-accent: #F4DC1A;
  --portiq-bg: #ffffff;
  --portiq-bg-input: #f8f9fa;
  --portiq-border: #e0e2e8;
  --portiq-text: #1a1d27;
  --portiq-text-muted: #6b7280;
  --portiq-error: #ef4444;
  --portiq-success: #10b981;
  --portiq-radius: 8px;
  --portiq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  font-family: var(--portiq-font);
  max-width: 640px;
  margin: 0 auto;
}

/* ---- Theme: Dark ---- */
.portiq-theme--dark {
  --portiq-bg: #1a1d27;
  --portiq-bg-input: #252830;
  --portiq-border: #2e3140;
  --portiq-text: #e4e5e9;
  --portiq-text-muted: #8b8d97;
}

/* ---- Theme: Brand ---- */
.portiq-theme--brand {
  --portiq-bg: #f0f0ff;
  --portiq-bg-input: #ffffff;
  --portiq-border: #c8c9f0;
}

/* ---- Form ---- */
.portiq-form {
  background: var(--portiq-bg);
  color: var(--portiq-text);
  padding: 2rem;
  border-radius: var(--portiq-radius);
  position: relative;
}

/* ---- Progress Bar ---- */
.portiq-progress {
  height: 4px;
  background: var(--portiq-border);
  border-radius: 2px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.portiq-progress__bar {
  height: 100%;
  background: var(--portiq-primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.portiq-step-indicator {
  font-size: 0.75rem;
  color: var(--portiq-text-muted);
  margin-bottom: 1.5rem;
}

/* ---- Steps ---- */
.portiq-step {
  display: none;
}

.portiq-step--active {
  display: block;
}

.portiq-step__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--portiq-text);
}

.portiq-step__desc {
  font-size: 0.875rem;
  color: var(--portiq-text-muted);
  margin-bottom: 1.5rem;
}

/* ---- Fields ---- */
.portiq-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.portiq-field {
  width: 100%;
}

.portiq-field--half {
  width: calc(50% - 0.5rem);
}

@media (max-width: 480px) {
  .portiq-field--half {
    width: 100%;
  }
}

.portiq-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--portiq-text);
  margin-bottom: 0.375rem;
}

.portiq-required {
  color: var(--portiq-error);
  margin-left: 0.125rem;
}

.portiq-input {
  display: block;
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 0.9375rem;
  font-family: var(--portiq-font);
  color: var(--portiq-text);
  background: var(--portiq-bg-input);
  border: 1px solid var(--portiq-border);
  border-radius: var(--portiq-radius);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.portiq-input:focus {
  border-color: var(--portiq-primary);
  box-shadow: 0 0 0 3px rgba(145, 149, 240, 0.15);
}

.portiq-textarea {
  resize: vertical;
  min-height: 100px;
}

.portiq-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ---- Options (radio/checkbox) ---- */
.portiq-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portiq-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--portiq-text);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--portiq-border);
  border-radius: var(--portiq-radius);
  transition: border-color 0.15s;
}

.portiq-option:hover {
  border-color: var(--portiq-primary);
}

.portiq-option input {
  accent-color: var(--portiq-primary);
}

/* ---- Errors ---- */
.portiq-error {
  font-size: 0.75rem;
  color: var(--portiq-error);
  margin-top: 0.25rem;
  min-height: 1rem;
}

.portiq-field--error .portiq-input,
.portiq-field--error .portiq-select {
  border-color: var(--portiq-error);
}

/* ---- Navigation ---- */
.portiq-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

.portiq-btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--portiq-font);
  border: none;
  border-radius: var(--portiq-radius);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.portiq-btn--next,
.portiq-btn--submit {
  background: var(--portiq-primary);
  color: #ffffff;
  margin-left: auto;
}

.portiq-btn--next:hover,
.portiq-btn--submit:hover {
  background: var(--portiq-primary-hover);
}

.portiq-btn--back {
  background: transparent;
  color: var(--portiq-text-muted);
  border: 1px solid var(--portiq-border);
}

.portiq-btn--back:hover {
  background: var(--portiq-bg-input);
}

.portiq-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Success ---- */
.portiq-success {
  text-align: center;
  padding: 2rem;
  color: var(--portiq-text);
}

.portiq-success p {
  font-size: 1.125rem;
  color: var(--portiq-success);
  font-weight: 600;
}

/* ---- Progressive Profiling ---- */
.portiq-field--prefilled .portiq-input {
  background: rgba(145, 149, 240, 0.06);
  border-color: rgba(145, 149, 240, 0.3);
}

.portiq-field--skipped {
  display: none;
}

/* ---- Branding (removable with white-label) ---- */
.portiq-branding {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.6875rem;
  color: var(--portiq-text-muted);
  opacity: 0.6;
}

.portiq-branding a {
  color: var(--portiq-text-muted);
  text-decoration: none;
}

.portiq-branding a:hover {
  color: var(--portiq-primary);
}
