/* Contact Form 7 - EXACT ORIGINAL STYLING from registration-modal.css */
/* This matches the Vite version exactly */

/* Root Variables for the component - EXACT COPY */
.codered-cf7-form,
.wpcf7-form,
.wpcf7 form {
  --bg-color: #0d0d0d;
  --primary-color: #00f2ea;
  --secondary-color: #a855f7;
  --text-color: #e5e5e5;
  --font-family: "Fira Code", Consolas, "Courier New", Courier, monospace;
  --glitch-anim-duration: 0.5s;
  --font-size-small: 10.66px;
  --font-size-base: 13.33px;
  --border-color: #26373F;
  --bg-secondary: #040e13;
}

/* Hide CF7 default response output and styling */
.wpcf7-response-output {
  display: none !important;
}

/* Hide screen reader response that appears above form */
.wpcf7 .screen-reader-response {
  display: none !important;
}

/* Custom error messages - clean styling without CF7 markup */
.codered-cf7-form .custom-error-tip {
  display: block !important;
  color: #FE384B !important;
  margin-top: 0.5rem !important;
  font-size: 0.75rem !important;
  position: relative !important;
  z-index: 3 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* Custom success messages - EXACT COPY from Vite config */
.codered-cf7-form .custom-success-message {
  display: block !important;
  margin-top: 1rem !important;
  padding: 1rem !important;
  background: rgba(34, 197, 94, 0.2) !important; /* bg-green-500/20 */
  border: 1px solid rgb(34, 197, 94) !important; /* border-green-500 */
  border-radius: 0.375rem !important; /* rounded */
  color: rgb(74, 222, 128) !important; /* text-green-400 */
  text-align: center !important;
  font-size: 0.875rem !important;
  position: relative !important;
  z-index: 3 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

/* Form wrapper - transparent */
.codered-cf7-form,
.wpcf7-form,
.wpcf7 form {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* --- Form Elements (EXACT COPY from original) --- */
.codered-cf7-form .form-group {
  position: relative;
  margin-bottom: 0; /* Remove margin since we use grid gap */
}

.codered-cf7-form .form-label {
  position: absolute;
  top: 0.75em;
  left: 0;
  font-size: 13.33px; /* Default font size across entire form - exact match */
  color: #E2F2F8; /* Input placeholder labels color - exact match */
  opacity: 0.6; /* Exact opacity match */
  text-transform: uppercase; /* Exact match */
  letter-spacing: 0.1em; /* Exact match */
  pointer-events: none;
  transition: all 0.3s ease;
}

.codered-cf7-form .form-group input:not([type="checkbox"]):not([type="radio"]),
.codered-cf7-form .form-group textarea,
.codered-cf7-form .form-group select,
.codered-cf7-form .wpcf7-form-control:not(.wpcf7-checkbox):not(.wpcf7-radio) {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #E2F2F8; /* Bottom border color matches text */
  padding: 0.75em 0;
  color: var(--text-color, #ffffff);
  font-size: 13.33px; /* Default font size across entire form */
  outline: none;
  transition: border-color 0.3s ease;
  resize: vertical; /* Allow vertical resize for textarea */
  font-family: inherit;
}

/* Focus states and label animations - EXACT COPY from original */
.codered-cf7-form .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.codered-cf7-form .form-group textarea:focus,
.codered-cf7-form .form-group select:focus,
.codered-cf7-form .wpcf7-form-control:not(.wpcf7-checkbox):not(.wpcf7-radio):focus {
  border-color: var(--primary-color, #00f2ea);
}

.codered-cf7-form .form-group input:focus + .form-label,
.codered-cf7-form .form-group input:not(:placeholder-shown) + .form-label,
.codered-cf7-form .form-group textarea:focus + .form-label,
.codered-cf7-form .form-group textarea:not(:placeholder-shown) + .form-label,
.codered-cf7-form .form-group select:focus + .form-label,
.codered-cf7-form .form-group select:not([value=""]) + .form-label {
  top: -1.2em;
  font-size: 10.66px; /* Default small font size - exact match */
  opacity: 1;
}

/* Glitch animation for labels - EXACT COPY */
.codered-cf7-form .form-group input:focus + .form-label::before,
.codered-cf7-form .form-group input:focus + .form-label::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color, #0d0d0d);
}

.codered-cf7-form .form-group input:focus + .form-label::before {
  color: var(--secondary-color, #a855f7);
  animation: glitch-anim var(--glitch-anim-duration, 0.5s)
    cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.codered-cf7-form .form-group input:focus + .form-label::after {
  color: var(--primary-color, #00f2ea);
  animation: glitch-anim var(--glitch-anim-duration, 0.5s)
    cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both;
}

@keyframes glitch-anim {
  0% {
    transform: translate(0);
    clip-path: inset(0 0 0 0);
  }
  20% {
    transform: translate(-5px, 3px);
    clip-path: inset(50% 0 20% 0);
  }
  40% {
    transform: translate(3px, -2px);
    clip-path: inset(20% 0 60% 0);
  }
  60% {
    transform: translate(-4px, 2px);
    clip-path: inset(80% 0 5% 0);
  }
  80% {
    transform: translate(4px, -3px);
    clip-path: inset(30% 0 45% 0);
  }
  100% {
    transform: translate(0);
    clip-path: inset(0 0 0 0);
  }
}

/* Autofill styling to match design - EXACT COPY */
.codered-cf7-form .form-group input:-webkit-autofill,
.codered-cf7-form .form-group input:-webkit-autofill:hover,
.codered-cf7-form .form-group input:-webkit-autofill:focus,
.codered-cf7-form .wpcf7-form-control:-webkit-autofill,
.codered-cf7-form .wpcf7-form-control:-webkit-autofill:hover,
.codered-cf7-form .wpcf7-form-control:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
  -webkit-text-fill-color: var(--text-color, #ffffff);
  transition: background-color 5000s ease-in-out 0s;
  border-bottom: 1px solid #E2F2F8;
}

/* Select specific styling - EXACT COPY */
.codered-cf7-form .form-group select,
.codered-cf7-form select.wpcf7-form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23E2F2F8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 1.5em;
  padding-right: 2em;
}

.codered-cf7-form .form-group select option,
.codered-cf7-form select.wpcf7-form-control option {
  background: var(--bg-secondary, #040e13);
  color: var(--text-color, #ffffff);
}

/* Submit button styling - EXACT COPY from original */
.codered-cf7-form input[type="submit"],
.wpcf7 input[type="submit"],
.wpcf7-submit {
  width: auto !important;
  min-width: 200px !important;
  max-width: 100% !important;
  padding: 0.8em 2em !important;
  margin: 60px auto 1rem !important;
  display: block !important;
  background-color: transparent !important;
  border: 2px solid var(--primary-color, #00f2ea) !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 13.33px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.2em !important;
  cursor: pointer !important;
  position: relative !important;
  transition: all 0.3s !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.codered-cf7-form input[type="submit"]:hover,
.codered-cf7-form input[type="submit"]:focus {
  background-color: var(--primary-color, #00f2ea) !important;
  color: var(--bg-color, #0d0d0d) !important;
  box-shadow: 0 0 25px var(--primary-color, #00f2ea) !important;
  outline: none !important;
}

.codered-cf7-form input[type="submit"]:active {
  transform: scale(0.97) !important;
}

.codered-cf7-form input[type="submit"]:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

.codered-cf7-form input[type="submit"]:disabled:hover {
  background-color: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Error styling - works with CF7 native error messages */
.codered-cf7-form .wpcf7-not-valid,
.codered-cf7-form .wpcf7-form-control.wpcf7-not-valid {
  border-color: #FF0000 !important;
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1) !important;
}

/* Hide all CF7 default error elements - we use custom JavaScript errors */
.wpcf7-not-valid-tip,
.wpcf7-response-output.wpcf7-validation-errors,
.wpcf7-validation-errors {
  display: none !important;
}

/* Success styling - Updated for latest CF7 */
.codered-cf7-form .wpcf7-mail-sent-ok,
.wpcf7 .wpcf7-mail-sent-ok,
.wpcf7-response-output.wpcf7-mail-sent-ok {
  background: rgba(0, 255, 0, 0.1) !important;
  border: 1px solid #00FF00 !important;
  color: #4ADE80 !important;
  padding: 0.75rem !important;
  border-radius: 0.375rem !important;
  margin-top: 1rem !important;
  font-size: 0.875rem !important;
  text-align: center !important;
}

/* Loading state */
.codered-cf7-form.submitting input[type="submit"] {
  opacity: 0.7;
  cursor: not-allowed;
  background: #666;
}

.codered-cf7-form.submitting input[type="submit"]:after {
  content: "SENDING...";
}

/* Form grid layout - EXACT COPY from original */
.codered-cf7-form .form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px; /* Spacing between input fields - exact match */
}

/* Newsletter section styling */
.codered-cf7-form .form-group.newsletter-section {
  grid-column: 1 / -1; /* Full width across both columns */
}

.codered-cf7-form .newsletter-section h3 {
  color: #E2F2F8;
  font-size: 13.33px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 15px 0; /* Add 15px bottom margin for spacing */
  padding: 0;
  text-align: left;
}

/* Checkbox styling */
.codered-cf7-form .newsletter-section .wpcf7-checkbox,
.codered-cf7-form .checkbox-group .wpcf7-checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: 0; /* Remove gap, will use margin instead */
}

.codered-cf7-form .newsletter-section .wpcf7-list-item,
.codered-cf7-form .checkbox-group .wpcf7-list-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px; /* Add gap between checkbox and label */
}

.codered-cf7-form .newsletter-section input[type="checkbox"],
.codered-cf7-form .checkbox-group input[type="checkbox"] {
  width: auto !important;
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.codered-cf7-form .newsletter-section .wpcf7-list-item-label,
.codered-cf7-form .checkbox-group .wpcf7-list-item-label {
  color: #E2F2F8;
  font-size: 13.33px;
  line-height: 1.4;
  cursor: pointer;
}

/* Hide the "Yes" text in checkbox label */
.codered-cf7-form .newsletter-section .wpcf7-list-item-label {
  display: none;
}

/* Style the text after checkbox */
.codered-cf7-form .newsletter-section {
  color: #E2F2F8;
  font-size: 13.33px;
  line-height: 1.4;
}

/* Add margin between checkbox and following text */
.codered-cf7-form .newsletter-section .wpcf7-checkbox {
  margin-right: 10px;
}

@media (min-width: 768px) {
  .codered-cf7-form .form-grid {
    grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
  }
}

/* Mobile responsive adjustments - EXACT COPY */
@media (max-width: 640px) {
  .codered-cf7-form .form-grid {
    gap: 30px; /* Slightly smaller gap on mobile */
  }
  
  /* Prevent mobile zoom by ensuring input font-size is at least 16px */
  .codered-cf7-form .form-group input,
  .codered-cf7-form .form-group textarea,
  .codered-cf7-form .form-group select,
  .codered-cf7-form .wpcf7-form-control {
    font-size: 16px !important; /* Prevent mobile zoom */
  }
  
  /* Adjust labels for mobile with larger input font */
  .codered-cf7-form .form-label {
    font-size: 16px !important; /* Match input font size */
  }
  
  .codered-cf7-form .form-group input:focus + .form-label,
  .codered-cf7-form .form-group input:not(:placeholder-shown) + .form-label,
  .codered-cf7-form .form-group textarea:focus + .form-label,
  .codered-cf7-form .form-group textarea:not(:placeholder-shown) + .form-label,
  .codered-cf7-form .form-group select:focus + .form-label,
  .codered-cf7-form .form-group select:not([value=""]) + .form-label {
    font-size: 12px !important; /* Smaller when focused/filled */
  }
}

/* Prevent motion for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .codered-cf7-form .form-group input:focus + .form-label::before,
  .codered-cf7-form .form-group input:focus + .form-label::after {
    animation: none;
    opacity: 0;
  }
}

/* Spinner animation for loading state */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.codered-cf7-form.submitting input[type="submit"]:before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-top: 2px solid transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}