/* Refined Color Variables */
:root {
  --cyan: #00aeef;
  --magenta: #ec008c;
  --green: #7ac143;
  --orange: #f47b20;
  --dark-blue: #2e3192;
  --white: #ffffff;
  --text-main: #333333; 
  --text-muted: #666666;
  --light-bg: #f4f7f9; 
  --border-color: #d1d9e2; 
}

/* 1. Form Wrapper */
.webform-submission-form {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto; 
  font-family: 'Kelson Sans', system-ui, sans-serif;
  color: var(--text-main);
  padding: 40px 20px;
  background-color: var(--light-bg); 
}

/* 2. Creating the "Cards" */
fieldset.custom-fieldset {
  background: var(--white);
  border-radius: 32px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.03); 
  padding: 40px; 
  margin: 0 0 60px 0 !important;
  display: block; 
}

fieldset.custom-fieldset:nth-of-type(1) { border-top: 6px solid var(--cyan); }
fieldset.custom-fieldset:nth-of-type(2) { border-top: 6px solid var(--green); }
fieldset.custom-fieldset:nth-of-type(3) { border-top: 6px solid var(--orange); }

/* 3. The Main Card Titles (Legends) */
fieldset.custom-fieldset > legend {
  font-size: 1.75rem; 
  font-weight: 700;
  color: var(--dark-blue);
  text-align: left;
  width: 100%;
  padding-bottom: 12px;
  margin-bottom: 30px; 
  border-bottom: 2px solid var(--light-bg); 
}

/* 4. Grid Layout for Fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
@media (min-width: 768px) {
  .form-row.two-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* 5. Labels and Descriptions */
.webform-submission-form label {
  font-weight: 600;
  font-size: 0.95rem; 
  color: var(--text-main);
  margin-bottom: 8px; 
  display: block;
}

.webform-submission-form .description,
.webform-submission-form .webform-element-description {
  margin-top: 4px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
}

/* 6. Inputs and Textareas */
.custom-input {
  width: 100%;
  padding: 14px 16px; 
  border: 1.5px solid var(--border-color) !important; 
  background-color: #fafbfc !important; 
  border-radius: 6px;
  font-size: 1.05rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.custom-input:hover {
  border-color: #b5c0cd !important; 
}

.custom-input:focus {
  outline: none !important;
  background-color: var(--white) !important; 
}

/* Dynamic Focus States for Inputs */
fieldset.custom-fieldset:nth-of-type(1) .custom-input:focus {
  border-color: var(--cyan) !important;
  box-shadow: 0 0 0 3px rgba(0, 174, 239, 0.15) !important;
}
fieldset.custom-fieldset:nth-of-type(2) .custom-input:focus {
  border-color: var(--green) !important;
  box-shadow: 0 0 0 3px rgba(122, 193, 67, 0.15) !important;
}
fieldset.custom-fieldset:nth-of-type(3) .custom-input:focus {
  border-color: var(--orange) !important;
  box-shadow: 0 0 0 3px rgba(244, 123, 32, 0.15) !important;
}

/* 8. Submit Button */
.custom-submit-btn {
  display: block;
  margin: 10px auto 0 auto; 
  background-color: var(--dark-blue); 
  color: var(--white);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 16px 40px;
  border: 2px solid var(--dark-blue);
  border-radius: 6px; 
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-submit-btn:hover {
  background-color: var(--white);
  color: var(--dark-blue);
}

/* 9. General Field Spacing */
.webform-submission-form .form-item {
  margin-bottom: 30px;
}

.webform-submission-form .form-item:last-child,
.form-row:last-child .form-item {
  margin-bottom: 0;
}

.form-required::after {
  content: '*';
  color: red;
  margin-left: 0.3em;
}

/* 10. Intro Header Card */
.custom-intro-card {
  background: var(--white);
  border-radius: 32px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.03);
  border-top: 6px solid var(--magenta); /* Uses your unused magenta variable! */
  padding: 40px;
  margin: 0 0 60px 0;
  text-align: center; /* Centers the text for a welcoming intro */
}

.custom-intro-card .intro-title {
  color: var(--dark-blue);
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 16px;
}

.custom-intro-card .intro-text {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 800px; /* Prevents the text line from getting too wide/hard to read */
}

/* Mobile responsiveness for the title */
@media (max-width: 768px) {
  .custom-intro-card .intro-title {
    font-size: 2rem;
  }
}