/*
 * Shared CF7 enhancement styles.
 *
 * Extracted from style.css so pages that replace the main theme stylesheet,
 * such as the guest-list landing pages, still get the same enhanced form UI
 * without duplicating CSS between bundles.
 */

/* Change the color of the check-mark */
/* Change the color of the radio button */
input[type='checkbox']:checked,
input[type='radio']:checked {
  accent-color: #c21f73;
}

/* CF7 forms and payments form
--------------------------------------------- */

.wpcf7-form select,
.wpcf7-form input[type='radio'],
.wpcf7-radio label {
  cursor: pointer;
}

/* Add padding to 2nd option of radio button in Create Demo User */
#egl-create-demo-user-modal .floating-label-container .wpcf7-list-item:nth-of-type(2) {
  padding-left: 10px;
}

/* Set font color for unselected radio options */
.floating-label-container .wpcf7-list-item input[type='radio']:not(:checked) + span {
  color: #b8b8b8;
}

/* Apply transition delay when changing radio options */
.floating-label-container .wpcf7-list-item span {
  transition: color 0.3s ease;
}

/* Show/hide (toggle) More-Info field (when 'other' selected */
.floating-label-container.fade-toggle {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity 0.3s ease,
    max-height 0.3s ease;
  margin-top: 0;
}

/* When field is shown */
.floating-label-container.fade-toggle.visible {
  opacity: 1;
  max-height: 150px; /* adjust based on field height */
  overflow: visible;
  margin-top: 20px;
}

/* End of show/hide toggle */

.cf7-radio-fix {
  border-radius: 5px;
}

.cf7-radio-fix .mdl-textfield__input {
  border-bottom: none;
  padding-bottom: 2.5em !important;
}

.wpcf7-list-item {
  margin: 0 !important;
}

.custom-required-fields-error {
  color: red;
  margin-top: 10px;
}

.blush-pink {
  background-color: #e5bfce;
}

.pastel-green {
  background-color: #cbdac9;
}

/* Style for checkboxes and labels to indicate interactivity */
.styled-form label {
  display: flex;
  align-items: baseline;
  cursor: pointer;
  transition:
    color 0.2s ease,
    text-decoration 0.2s ease;
}

/* Hover effect for labels */
.styled-form label:hover {
  color: #e4097e;
  font-weight: 600;
}

/* Hide "Required Field" message until the submit button is clicked */
.wpcf7-not-valid-tip {
  display: none !important;
}

/* Created in cf7-enhance.js to show error messages */
.wpcf7-show-tip {
  display: block !important;
}

.wpcf7-list-item-label {
  font-size: 1.5rem;
}

/* Labels with disabled inputs */
.styled-form label input:disabled + .wpcf7-list-item-label {
  cursor: default;
  color: gray;
}

/* Labels for checked checkboxes */
.styled-form label input[type='checkbox']:checked + .wpcf7-list-item-label,
.wpcf7-radio input[type='radio']:checked + span.wpcf7-list-item-label {
  color: #333;
}

.grid {
  display: grid;
}

.two-cols-grid {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 550px) {
  .two-cols-grid {
    grid-template-columns: 1fr;
  }
}

.special-section-in-form {
  margin-top: 20px;
  background-color: #d9b0c0;
  padding: 2em;
  margin: 2em -2em 0;
  border-radius: 1rem;
}

/* Single source of truth for control sizing + checkbox tokens */
.payments-form-material {
  /* Text / select inputs */
  --control-height: 44px;
  --control-pad-x: 12px;
  --control-radius: 6px;
  --control-border: #d1d1d1;

  /* Checkboxes */
  --checkbox-size: 20px;
  --checkbox-radius: 4px;
  --checkbox-border: #cfcfcf;
  --checkbox-bg: #fff;
  --checkbox-accent: #c21f73;
  --checkbox-focus: rgba(194, 31, 115, 0.35);
  --checkbox-gap: 5px;

  /* Radio buttons */
  --radio-size: 16px;
  --radio-border: #cfcfcf;
  --radio-bg: #fff;
  --radio-accent: #c21f73;
}

/* Uniform inputs/selects (auto-matches iPad too) */
.floating-label-container .mdl-textfield__input {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: var(--control-height);
  line-height: calc(var(--control-height) - 2px);
  padding: 12px var(--control-pad-x) 0;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: #fff;
  font-size: 16px; /* avoids iOS zoom-on-focus */
}

/* Checkbox row alignment / hit area */
.payments-form-material .wpcf7-list-item label {
  display: inline-flex;
  align-items: center;
  gap: var(--checkbox-gap);
  min-height: 44px;
  cursor: pointer;
  position: relative;
}

/* Checkbox base box: single source of truth (no native or ::before tick) */
.payments-form-material .wpcf7-list-item input[type='checkbox'] {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  accent-color: initial !important;
  transform: none !important;

  width: var(--checkbox-size);
  height: var(--checkbox-size);
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;

  inline-size: var(--checkbox-size);
  block-size: var(--checkbox-size);
  box-sizing: border-box;
  border: 2px solid var(--checkbox-border);
  border-radius: var(--checkbox-radius);
  background: var(--checkbox-bg);

  background-repeat: no-repeat;
  background-position: center;
  background-size: 70% 70%;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
}

/* Kill any previous pseudo-element checkmarks */
.payments-form-material .wpcf7-list-item input[type='checkbox']::before {
  content: none !important;
  border: 0 !important;
}

/* Checked state: draw a single SVG tick */
.payments-form-material .wpcf7-list-item input[type='checkbox']:checked {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 10' fill='none'%3E%3Cpath d='M1 5 L5 9 L13 1' stroke='%23c21f73' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Focus ring for accessibility */
.payments-form-material .wpcf7-list-item input[type='checkbox']:focus-visible {
  outline: 3px solid var(--checkbox-focus);
  outline-offset: 2px;
}

/* Default weight for all checkbox labels */
.payments-form-material .wpcf7-list-item label {
  font-weight: 400;
}

/* Fallback for CF7's default markup */
.payments-form-material .wpcf7-list-item input[type='checkbox']:checked + .wpcf7-list-item-label {
  font-weight: 700;
}

/* Bold the whole label when its input is checked */
@supports selector(label:has(input:checked)) {
  .payments-form-material .wpcf7-list-item label:has(input[type='checkbox']:checked) {
    font-weight: 700;
  }
}

/* Radio base: neutralize theme/iOS scaling and size it */
.payments-form-material .wpcf7-list-item input[type='radio'] {
  appearance: none !important;
  -webkit-appearance: none !important;

  position: relative;
  display: inline-block;
  width: var(--radio-size) !important;
  height: var(--radio-size) !important;
  min-width: 0 !important;
  min-height: 0 !important;

  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border: 2px solid var(--radio-border);
  border-radius: 50%;
  background: var(--radio-bg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 70% 70%;

  transform: none !important;
  -webkit-transform: none !important;
  zoom: 1 !important;
}

/* Checked dot */
.payments-form-material .wpcf7-list-item input[type='radio']:checked {
  background-image: none;
  border-color: var(--radio-accent);
}

/* Draw a perfectly centered dot */
.payments-form-material .wpcf7-list-item input[type='radio']::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--radio-size) * 0.55);
  height: calc(var(--radio-size) * 0.55);
  background: var(--radio-accent);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.12s ease-out;
}

.payments-form-material .wpcf7-list-item input[type='radio']:checked::after {
  transform: translate(-50%, -50%) scale(1);
}

/* Focus ring */
.payments-form-material .wpcf7-list-item input[type='radio']:focus-visible {
  outline: 3px solid var(--checkbox-focus);
  outline-offset: 2px;
}

/* Insert finger in CF7 forms and wiggle it */
.wiggle-finger .wpcf7-list-item label::before {
  content: '';
  position: absolute;
  left: -28px;
  width: 20px;
  height: 15px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='15' viewBox='0 0 512 512'><path fill='%23c21f73' d='M480 96c17.7 0 32 14.3 32 32s-14.3 32-32 32H272V96h208zM320 288c17.7 0 32 14.3 32 32s-14.3 32-32 32h-64c-17.7 0-32-14.3-32-32s14.3-32 32-32h64zm64-64c0 17.7-14.3 32-32 32h-48c-17.7 0-32-14.3-32-32s14.3-32 32-32h48c17.7 0 32 14.3 32 32zm-96 160c17.7 0 32 14.3 32 32s-14.3 32-32 32h-64c-17.7 0-32-14.3-32-32s14.3-32 32-32h64zm-88-96h.6c-5.4 9.4-8.6 20.3-8.6 32c0 13.2 4 25.4 10.8 35.6c-24.9 8.7-42.8 32.5-42.8 60.4c0 11.7 3.1 22.6 8.6 32H160C71.6 448 0 376.4 0 288v-61.7c0-42.4 16.9-83.1 46.9-113.1l11.6-11.6C82.5 77.5 115.1 64 149 64h27c35.3 0 64 28.7 64 64v88c0 22.1-17.9 40-40 40s-40-17.9-40-40v-56c0-8.8-7.2-16-16-16s-16 7.2-16 16v56c0 39.8 32.2 72 72 72z'/></svg>") no-repeat center/contain;
  animation: wiggle-icon 1.2s infinite ease-in-out;
  pointer-events: none;
}

.payments-form-material.styled-form {
  padding: 2em;
  border-radius: 30px;
  border: 1px solid #ccc;
}

.payments-form-material fieldset {
  border: 3px solid #c21f73;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 5px;
}

.payments-form-material legend {
  font-size: 1.2em;
  font-weight: bold;
  color: #333333;
  padding: 0 10px;
}

.payments-form-material .legend-text {
  font-size: 0.9em;
  color: #555555;
  margin-bottom: 10px;
  line-height: 1.2;
}

#online-payments-modal .payments-form-material .price::after {
  display: none !important;
}

/* Added June 2024 - replaces the MD plugin */
.floating-label-container {
  position: relative;
  margin-top: 10px;
}

.mdl-textfield__input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border-bottom: 1px solid #8e8e8e;
}

.floating-label {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 14px;
  color: #777;
  transition: all 0.2s ease;
  pointer-events: none;
}

.floating-label-container .mdl-textfield__input:focus {
  outline: none;
  border-bottom: 2px solid #b00020;
  transition: all 0.2s ease;
}

.floating-label-container.active .floating-label {
  top: 0;
  left: 5px;
  font-size: 10px;
  color: red;
  transition: all 0.2s ease;
}

.floating-label-container.filled .floating-label {
  top: 0;
  left: 5px;
  font-size: 10px;
  color: gray;
}

/* "Number of Events" input field corrections in GuestList payment modal */
#purchasedEvents::-webkit-outer-spin-button,
#purchasedEvents::-webkit-inner-spin-button {
  -webkit-appearance: inner-spin-button !important;
  display: inline-block !important;
  margin: 0;
  opacity: 1;
}

/* If any global reset set appearance:none, undo it */
#purchasedEvents {
  appearance: auto !important;
  -webkit-appearance: auto !important;
  -moz-appearance: number-input !important;
}

/* Number of Events: label left, input right, show steppers */
.purchased-events-wrapper .floating-label-container {
  display: flex !important;
  align-items: center;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

/* Make the floating label behave like a normal static label on the left */
.purchased-events-wrapper .floating-label-container > label.floating-label {
  top: -5px;
  font-size: 16px;
  left: 0;
}

/* Keep the number field compact on the right */
.purchased-events-wrapper .floating-label-container #purchasedEvents {
  height: 40px;
  text-align: center;
  padding: 0 8px;
  border: 1px solid #d1d1d1;
  border-radius: 6px;
  background: #fff;
  outline: none;
}

/* Hide native up/down steppers for the credits input only */
.purchased-events-wrapper #purchasedEvents::-webkit-outer-spin-button,
.purchased-events-wrapper #purchasedEvents::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.purchased-events-wrapper #purchasedEvents {
  appearance: textfield;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

/* Wrapper that holds minus [number] plus */
.purchased-events-wrapper .purchasedEvents-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-block: 25px;
  border-radius: 4px;
}

/* The +/- buttons */
.purchased-events-wrapper .purchased-events-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  background: #f8f8f8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.purchased-events-wrapper .purchased-events-step:active {
  transform: translateY(1px);
}

/* Keep the input tidy inside the box */
.purchased-events-wrapper .purchasedEvents-box #purchasedEvents {
  height: 36px;
  text-align: center;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  background: #fff;
  padding: 0 6px;
}

/* Force + / - symbols to show on all devices */
.purchased-events-wrapper .purchased-events-step {
  text-indent: 0 !important;
  background-image: none !important;
  color: #6b6b6b !important;
  font-size: 18px !important;
  font-weight: 700;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 36px;
  border: 1px solid #cfcfcf;
  border-radius: 4px;
  background: #eee;
  cursor: pointer;
  user-select: none;
}

/* If any global rule sets font-size:0 on button children, neutralize it */
.purchased-events-wrapper .purchased-events-step * {
  font-size: inherit !important;
}

/* When a real value from a dropdown is selected */
select.mdl-textfield__input:valid,
select.mdl-textfield__input option:not(:first-child) {
  color: #333;
}

textarea,
input.wpcf7-form-control {
  color: #333;
}

input.wpcf7-form-control.mdl-button {
  color: #fff;
  margin-top: 20px;
}
