/* ============================================================
   OnyxAnchor — Contact Form 7 Custom Styles
   Dark-glass form design — matches original React project form.

   Works with: Template A (6-field) and Template B (8-field)
   from cf7-admin-form-template.txt

   Enqueued via functions.php → onyxanchor_enqueue_assets()
   as handle: oag-cf7-styles
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  --oag-gold:         #C9A646;
  --oag-gold-deep:    #8F6F24;
  --oag-gold-light:   #E6C46A;
  --oag-font-display: "Sora", system-ui, sans-serif;
  --oag-font-body:    "Poppins", system-ui, sans-serif;
  --oag-error:        #ff6b6b;
  --oag-success:      #4ade80;
}


/* ============================================================
   OUTER WRAPPER — Dark glass container
   Wraps the entire CF7 form. Matches React .glass class:
   rgba(255,255,255,0.04) background + backdrop blur + gold border.
   ============================================================ */
.oag-cf7-wrapper {
  position: relative;
  padding: 1.75rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(201, 166, 70, 0.22);
  color: #ffffff;
  overflow: hidden;
}

/* Subtle top gold line accent */
.oag-cf7-wrapper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(201, 166, 70, 0.5), transparent);
  pointer-events: none;
}

@media (min-width: 768px) {
  .oag-cf7-wrapper {
    padding: 2.5rem;
  }
}

/* ── Strip CF7 plugin default spacing ── */
.oag-cf7-wrapper .wpcf7,
.oag-cf7-wrapper .wpcf7-form {
  margin: 0;
  padding: 0;
}
.oag-cf7-wrapper p {
  margin: 0;
}


/* ============================================================
   FORM INNER CONTAINER
   ============================================================ */
.oag-cf7-form-inner {
  display: block;
}


/* ============================================================
   GRID LAYOUT
   2-column on tablet+, 1-column on mobile
   Full-width fields use .oag-cf7-full
   ============================================================ */
.oag-cf7-grid {
  display: grid;
  gap: 1.5rem 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .oag-cf7-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .oag-cf7-full {
    grid-column: span 2;
  }
}


/* ============================================================
   FIELD WRAPPER — .oag-cf7-field
   Relative positioning for floating label; padding-top creates
   space above the input so the label can float there.
   ============================================================ */
.oag-cf7-field {
  position: relative;
  padding-top: 1rem;
}

/* CF7 wraps every input in a <span class="wpcf7-form-control-wrap"> */
.oag-cf7-field .wpcf7-form-control-wrap {
  display: block;
  position: relative;
}


/* ============================================================
   FLOATING LABEL
   Default position: visually inside the input (acts as placeholder).
   Floated state (.is-focused / .has-value): small gold text at top.
   ============================================================ */
.oag-cf7-label {
  position: absolute;
  left: 0;
  top: 1.75rem;          /* vertically inside the input area */
  font-family: var(--oag-font-display);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.40);
  pointer-events: none;
  transition: top 0.25s ease, font-size 0.25s ease, color 0.25s ease;
  line-height: 1;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── JS-driven: oag-cf7-float-labels.js adds these classes ── */
.oag-cf7-field.is-focused .oag-cf7-label,
.oag-cf7-field.has-value  .oag-cf7-label {
  top: 0;
  font-size: 0.625rem;
  color: var(--oag-gold);
}

/* ── CSS :has() native fallback (Chrome 105+, Safari 15.4+) ── */
.oag-cf7-field:has(.oag-cf7-input:focus)                      .oag-cf7-label,
.oag-cf7-field:has(.oag-cf7-input:not(:placeholder-shown))    .oag-cf7-label,
.oag-cf7-field:has(.oag-cf7-textarea:focus)                   .oag-cf7-label {
  top: 0;
  font-size: 0.625rem;
  color: var(--oag-gold);
}


/* ============================================================
   INPUTS & TEXTAREA
   Bottom-border only; transparent background.
   Matches React: border-b border-white/15, focus:border-gold
   ============================================================ */
.oag-cf7-wrapper .oag-cf7-input,
.oag-cf7-wrapper .oag-cf7-textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 0.6rem 0 0.6rem;
  outline: none;
  font-family: var(--oag-font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  transition: border-color 0.25s ease;
  display: block;
  box-sizing: border-box;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  border-radius: 0;
  caret-color: var(--oag-gold);
}

/* Hide placeholder — label acts as placeholder */
.oag-cf7-wrapper .oag-cf7-input::placeholder,
.oag-cf7-wrapper .oag-cf7-textarea::placeholder {
  color: transparent;
}

/* Focus state */
.oag-cf7-wrapper .oag-cf7-input:focus,
.oag-cf7-wrapper .oag-cf7-textarea:focus {
  border-color: var(--oag-gold);
}

/* Textarea specific */
.oag-cf7-wrapper .oag-cf7-textarea {
  resize: none;
  min-height: 6.5rem;
  overflow-y: hidden;
}

/* Prevent browser blue/yellow autofill background */
.oag-cf7-wrapper .oag-cf7-input:-webkit-autofill,
.oag-cf7-wrapper .oag-cf7-textarea:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  -webkit-text-fill-color: #ffffff !important;
  background-clip: content-box !important;
  caret-color: #ffffff;
  transition: background-color 9999s ease-out;
}


/* ============================================================
   SUBMIT BUTTON — .oag-cf7-submit
   Matches React .btn-gold + .cta-pulse:
   gold gradient, uppercase, animated glow pulse.
   ============================================================ */
.oag-cf7-wrapper .oag-cf7-submit,
.oag-cf7-wrapper input[type="submit"].oag-cf7-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 2rem;
  padding: 0.875rem 1.5rem;
  min-height: 2.75rem;
  font-family: var(--oag-font-display);
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #0a0a0a;
  background: linear-gradient(135deg, #E6C46A, #C9A646 55%, #8F6F24);
  border: 1px solid rgba(255, 220, 140, 0.45);
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
  box-shadow:
    0 10px 30px -10px rgba(201, 166, 70, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 0 rgba(201, 166, 70, 0.55);
  animation: oag-cf7-pulse 3.2s ease-in-out infinite;
  -webkit-appearance: none;
          appearance: none;
  position: relative;
  overflow: hidden;
}

/* Arrow after button text */
.oag-cf7-wrapper .oag-cf7-submit::after {
  content: " →";
  display: inline-block;
  transition: transform 0.3s ease;
}

.oag-cf7-wrapper .oag-cf7-submit:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 18px 50px -12px rgba(201, 166, 70, 0.7);
  animation: none;
}

.oag-cf7-wrapper .oag-cf7-submit:hover::after {
  transform: translateX(3px);
}

.oag-cf7-wrapper .oag-cf7-submit:active {
  transform: translateY(0);
}

/* Disabled during AJAX submit */
.oag-cf7-wrapper .wpcf7-form.submitting .oag-cf7-submit,
.oag-cf7-wrapper .oag-cf7-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  animation: none;
  transform: none;
}

/* After successful send */
.oag-cf7-wrapper .wpcf7-form.sent .oag-cf7-submit {
  background: linear-gradient(135deg, rgba(201, 166, 70, 0.45), rgba(143, 111, 36, 0.45));
  animation: none;
  cursor: default;
}

/* ── Gold pulse keyframe ── */
@keyframes oag-cf7-pulse {
  0%, 100% {
    box-shadow:
      0 10px 30px -10px rgba(201, 166, 70, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.35),
      0 0 0 0 rgba(201, 166, 70, 0.55);
  }
  50% {
    box-shadow:
      0 14px 40px -10px rgba(201, 166, 70, 0.7),
      inset 0 1px 0 rgba(255, 255, 255, 0.4),
      0 0 0 10px rgba(201, 166, 70, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .oag-cf7-wrapper .oag-cf7-submit {
    animation: none;
  }
}


/* ============================================================
   DISCLAIMER TEXT — below submit button
   ============================================================ */
.oag-cf7-disclaimer {
  margin-top: 1rem !important;
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.40);
  text-align: center;
  font-family: var(--oag-font-body);
  line-height: 1.5;
  letter-spacing: 0.02em;
}


/* ============================================================
   CF7 VALIDATION ERRORS
   ============================================================ */
.oag-cf7-wrapper .wpcf7-not-valid-tip {
  display: block;
  color: var(--oag-error);
  font-size: 0.6875rem;
  margin-top: 0.25rem;
  font-family: var(--oag-font-body);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.oag-cf7-wrapper .wpcf7-not-valid {
  border-bottom-color: var(--oag-error) !important;
}

/* Red label when field is invalid */
.oag-cf7-field:has(.wpcf7-not-valid) .oag-cf7-label {
  color: var(--oag-error) !important;
}


/* ============================================================
   RESPONSE OUTPUT (Success / Error message block)
   ============================================================ */
.oag-cf7-wrapper .wpcf7-response-output {
  margin: 1.25rem 0 0 !important;
  padding: 0.75rem 1rem;
  border: 1px solid;
  border-radius: 0;
  font-size: 0.875rem;
  font-family: var(--oag-font-body);
  line-height: 1.5;
  text-align: center;
}

/* ── Success ── */
.oag-cf7-wrapper .wpcf7-mail-sent-ok,
.oag-cf7-wrapper .wpcf7-form.sent .wpcf7-response-output {
  color: var(--oag-success);
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.07);
}

/* ── Error / validation ── */
.oag-cf7-wrapper .wpcf7-mail-sent-ng,
.oag-cf7-wrapper .wpcf7-spam-blocked,
.oag-cf7-wrapper .wpcf7-validation-errors,
.oag-cf7-wrapper .wpcf7-acceptance-missing,
.oag-cf7-wrapper .wpcf7-form.invalid     .wpcf7-response-output,
.oag-cf7-wrapper .wpcf7-form.unaccepted  .wpcf7-response-output,
.oag-cf7-wrapper .wpcf7-form.failed      .wpcf7-response-output {
  color: var(--oag-error);
  border-color: rgba(255, 107, 107, 0.35);
  background: rgba(255, 107, 107, 0.07);
}


/* ============================================================
   CF7 AJAX SPINNER
   ============================================================ */
.oag-cf7-wrapper .wpcf7-spinner {
  margin-left: 0.75rem;
  vertical-align: middle;
  background-color: var(--oag-gold);
}


/* ============================================================
   RESPONSIVE OVERRIDES
   ============================================================ */
@media (max-width: 480px) {
  .oag-cf7-wrapper {
    padding: 1.25rem;
  }
  .oag-cf7-grid {
    gap: 1.25rem 0;
  }
  .oag-cf7-label {
    font-size: 0.6875rem;
  }
  .oag-cf7-wrapper .oag-cf7-submit {
    font-size: 0.75rem;
    padding: 0.75rem 1.25rem;
  }
}
