/* Custom Form Styling for KagiPay */

/* Form container styling */
.smpForm {
  font-family: 'Noto Sans JP', "メイリオ", Meiryo, sans-serif;
  max-width: 100%;
  width: 100%;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 1rem;
  box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.08);
  background-color: #ffffff;
  border: 1px solid rgba(69, 140, 203, 0.15);
  box-sizing: border-box;
}

/* Form field containers */
.smpForm .fieldWrap {
  margin-bottom: 1.25rem;
  position: relative;
  display: flex;
  align-items: flex-start;
  width: 100%;
}

/* Form labels */
.smpForm label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #11415d;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

/* Side-by-side layout for SS form fields */
.ss_field {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  position: relative;
  padding: 0.5rem 0;
  width: 100%;
  box-sizing: border-box;
}

/* Form title/label styling - standardize width for all labels */
.ss_form_title,
.ss_field > label,
.ss_field > .ss_label {
  font-weight: bold; 
  text-align: left;
  width: 18rem;  /* Standardized width */
  min-width: 18rem;
  color: #11415d;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0.625rem 0.25rem;
  line-height: 1.2;
}

/* Main container for the entire form */
form > .ss_container {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Content area inside main container */
form > .ss_container > .ss_contents {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Container for input elements within each field */
.ss_grid {
  display: flex;
  flex: 1;
  width: calc(100% - 18rem);  /* Standardized width for all fields */
  padding-left: 0.5rem;
  box-sizing: border-box;
  overflow: hidden;
}

/* Input container */
.ss_input {
  width: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  max-width: 100%;
}

/* Input styling */
.ss_input input[type="text"],
.ss_input input[type="email"],
.ss_input input[type="tel"],
.ss_input input[type="number"],
.ss_input input:not([type="checkbox"]):not([type="radio"]),
.ss_input select,
.ss_input textarea,
.smpForm input[type="text"],
.smpForm input[type="email"],
.smpForm input[type="tel"],
.smpForm select,
.smpForm textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e8e8e8;
  border-radius: 0.375rem;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  background-color: #fcfcfc;
  color: #11415d;
  height: 2.625rem;
  line-height: normal;
  box-sizing: border-box;
}

/* Required field indicator text styling */
.smpForm .required,
.ss_user_notnull {
  color: #dc3545;
  font-weight: bold;
  margin-left: 0.25rem;
  font-size: 1.1em;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
}

/* Required/Optional field label styling with blue/gray boxes */
.ss_field > label::before,
.ss_field > .ss_label::before,
.ss_form_title::before {
  content: "";
  display: inline-block;
  width: 2.5rem;
  height: 1.25rem;
  background-color: #11415d;
  color: white;
  font-size: 0.75rem;
  text-align: center;
  line-height: 1.25rem;
  margin-right: 0.625rem;
  flex-shrink: 0;
  position: relative;
  top: 0;
}

/* Required field indicator in blue box */
.ss_field > label.required::before,
.ss_field > .ss_label.required::before,
.ss_form_title.required::before,
.ss_required_field .ss_form_title::before {
  content: "必須";
}

/* Optional field indicator in gray box */
.ss_field:not(.ss_required_field) .ss_form_title::before {
  content: "任意";
  background-color: #11415d;
}

/* Optional field text indicator */
.ss_user_optional {
  color: #6c757d;
  font-weight: bold;
  margin-left: 0.25rem;
  font-size: 1.1em;
  vertical-align: middle;
}

/* Input field hover and focus states */
.ss_input input:hover,
.ss_input select:hover,
.ss_input textarea:hover,
.smpForm input[type="text"]:hover,
.smpForm input[type="email"]:hover,
.smpForm input[type="tel"]:hover,
.smpForm select:hover,
.smpForm textarea:hover {
  border-color: #458ccb;
  background-color: #ffffff;
}

.ss_input input:focus,
.ss_input select:focus,
.ss_input textarea:focus,
.smpForm input[type="text"]:focus,
.smpForm input[type="email"]:focus,
.smpForm input[type="tel"]:focus,
.smpForm select:focus,
.smpForm textarea:focus {
  border-color: #458ccb;
  background-color: #ffffff;
  box-shadow: 0 0 0 0.25rem rgba(69, 140, 203, 0.15);
  outline: none;
}

/* Example text styling - hide the original example text */
.ss_rightComment {
  display: none;
}

/* Consolidated field placeholder styling */
#ss_name .ss_input input,
#ss_company_name .ss_input input,
#ss_position .ss_input input,
#ss_email .ss_input input,
#ss_email_conf .ss_input input,
#ss_phone .ss_input input {
  padding-left: 1rem;
  max-width: 100%;
  width: 100%;
}

/* Consolidated placeholder styling */
#ss_name .ss_input input::placeholder,
#ss_company_name .ss_input input::placeholder,
#ss_position .ss_input input::placeholder,
#ss_email .ss_input input::placeholder,
#ss_email_conf .ss_input input::placeholder,
#ss_phone .ss_input input::placeholder {
  color: #888888;
  opacity: 1;
  font-family: 'Noto Sans JP', Arial, sans-serif;
  font-size: 0.85rem;
}

/* Remove any lingering background images when field gets focus or has content */
.ss_input input:focus,
.ss_input input:not(:placeholder-shown) {
  background-image: none !important;
  padding-left: 1rem !important;
}

/* Keep the bottom comment (warning) visible but change color */
.ss_bottomComment {
  color: #666666;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-top: 0.35rem;
  display: block;
}

/* Warning and error message styling */
.ss_warning,
.ss_alert,
.ss_error,
.ss_error_message,
.error-message,
.form-error,
.validation-error,
.warning-text,
span[class*="warning"],
div[class*="warning"],
p[class*="warning"],
.必須入力してください,
.必須入力してください。,
.必ず入力してください,
.必ず入力してください。 {
  color: #dc3545;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Error states */
.smpForm .error input,
.smpForm .error select,
.smpForm .error textarea,
.ss_input.error input,
.ss_input.error select,
.ss_input.error textarea {
  border-color: #dc3545;
  background-color: #fff9f9;
}

.smpForm .errorMessage {
  color: #dc3545;
  font-size: 0.8rem;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.smpForm .errorMessage::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  background-color: #dc3545;
  color: white;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: bold;
}

/* Ensure all error indicators are red */
.error-icon,
.error-indicator,
.validation-icon {
  color: #dc3545;
  fill: #dc3545;
}

/* Checkboxes and radio buttons */
.smpForm input[type="checkbox"],
.smpForm input[type="radio"],
.ss_input input[type="checkbox"],
.ss_input input[type="radio"] {
  margin: 0.2rem 0.5rem 0 0;
  width: 1rem;
  height: 1rem;
  accent-color: #458ccb;
}

/* Checkbox and radio button labels */
.smpForm .checkboxLabel,
.smpForm .radioLabel,
.ss_input label {
  display: inline-flex;
  align-items: flex-start;
  margin-right: 1rem;
  cursor: pointer;
  color: #11415d;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Submit button */
.smpForm .submit,
.smpForm button[type="submit"],
.ss_btnArea input[type="button"],
.ss_btnArea input[type="submit"] {
  background: linear-gradient(180deg, #458ccb, #11415d);
  color: white;
  border: none;
  border-radius: 1.875rem;
  padding: 0.85rem 2.5rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  margin: 2rem auto 1rem;
  text-align: center;
  box-shadow: 0 0.25rem 0.75rem rgba(17, 65, 93, 0.2);
  min-width: 10rem;
}

/* Submit button hover and active states */
.smpForm .submit:hover,
.smpForm button[type="submit"]:hover,
.ss_btnArea input[type="button"]:hover,
.ss_btnArea input[type="submit"]:hover {
  transform: translateY(-0.125rem);
  box-shadow: 0 0.375rem 1rem rgba(17, 65, 93, 0.3);
  background: linear-gradient(180deg, #5098d7, #11415d);
}

.smpForm .submit:active,
.smpForm button[type="submit"]:active,
.ss_btnArea input[type="button"]:active,
.ss_btnArea input[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 0.125rem 0.5rem rgba(17, 65, 93, 0.2);
}

/* Field descriptions and helper text */
.smpForm .fieldDescription,
.smpForm .note {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.35rem;
  line-height: 1.4;
}

/* Custom styling for placeholder text */
.ss_input input::placeholder,
.ss_input textarea::placeholder,
.smpForm input::placeholder,
.smpForm textarea::placeholder {
  color: #888888;
  opacity: 0.8;
  font-size: 0.85rem;
}

/* Privacy policy section styling */
.p-privacy {
  background-color: #f8fafc;
  padding: 2rem;
  border-radius: 0.75rem;
  margin: 2rem 0;
  border: 1px solid #e8e8e8;
  max-height: 18.75rem;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}

.p-privacy::-webkit-scrollbar {
  width: 0.5rem;
}

.p-privacy::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0.25rem;
}

.p-privacy::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 0.25rem;
}

.p-privacy::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.p-privacy__ttl {
  color: #11415d;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  font-weight: bold;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(17, 65, 93, 0.1);
}

.p-privacy__list {
  padding-left: 1.5rem;
}

.p-privacy__item {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #444;
}

/* Form section title */
.form-section-title {
  color: #11415d;
  font-size: 1.75rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
  width: 100%;
}

.form-section-title::after {
  content: "";
  display: block;
  width: 3.75rem;
  height: 0.1875rem;
  background: linear-gradient(90deg, #458ccb, #11415d);
  margin: 1rem auto 0;
  border-radius: 0.125rem;
}

/* Form wrapper card */
.form-wrapper.kagipay-form-card {
  background-color: #ffffff;
  border-radius: 1.25rem;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.08);
  padding: 3rem;
  border: 1px solid rgba(69, 140, 203, 0.15);
  margin-bottom: 3rem;
  width: 100%;
  box-sizing: border-box;
}

/* Specific styling for input sizes */
.ss_input input[maxlength="20"] {
  max-width: 100%;
  width: 15rem;
}

.ss_input input[maxlength="100"] {
  max-width: 100%;
  width: 30rem;
}

.ss_input input[size="15"] {
  width: 15rem;
  max-width: 100%;
}

.ss_input input[size="40"] {
  width: 25rem;
  max-width: 100%;
}

/* Ensure the submit button is properly sized */
.ss_btnArea {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 2rem;
}

/* Privacy agreement checkbox styling - special full-width treatment */
.ss_field#ss_VisitorData\.attribute1 {
  background-color: #f8f9fa;
  border-radius: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #e9ecef;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* More specific selector to override default styles */
.ss_field#ss_VisitorData\.attribute1 .ss_form_title {
  display: flex;
  align-items: center;
  line-height: 1.4;
  padding: 0;
  margin-bottom: 0.5rem;
  width: 100%;
  min-width: 100%;
  flex-wrap: wrap;
}

.ss_field#ss_VisitorData\.attribute1 .ss_grid {
  width: 100%;
  padding-left: 0;
  margin-top: 0.5rem;
  margin-left: 0;
  display: block;
}

.ss_field#ss_VisitorData\.attribute1 .ss_form_title::before {
  margin-top: 0;
  margin-bottom: 0;
  align-self: flex-start;
}

.ss_field#ss_VisitorData\.attribute1 .ss_input {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-left: 0;
  width: auto;
  padding-left: 0.25rem;
}

.ss_field#ss_VisitorData\.attribute1 input[type="checkbox"] {
  margin-right: 0.5rem;
  width: 1.125rem;
  height: 1.125rem;
  accent-color: #458ccb;
}

/* Fix for the checkbox text alignment */
.ss_field#ss_VisitorData\.attribute1 .ss_input br {
  display: none;
}

/* Custom styling for label classes */
.ss_field .ss_form_title.facility-name-label,
.ss_field .ss_form_title.person-in-charge-label,
.ss_field .ss_form_title.position-label,
.ss_field .ss_form_title.email-label {
  font-size: 0.9rem;
  line-height: 1.3;
  width: 18rem;
  min-width: 18rem;
  padding-right: 0.5rem;
}

/* Special styling for facility name label */
.ss_field .ss_form_title.facility-name-label {
  word-break: keep-all;
  white-space: normal;
}

/* Force blue background on position field label indicator even if it's optional */
.ss_field:not(.ss_required_field) .ss_form_title.position-label::before {
  background-color: #11415d !important;
}

/* Responsive adjustments */
@media (max-width: 767px) {
  .smpForm {
    padding: 1.5rem;
  }
  
  .ss_field {
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem 0;
  }
  
  .ss_field > label,
  .ss_field > .ss_label,
  .ss_form_title,
  .ss_field .ss_form_title.facility-name-label,
  .ss_field .ss_form_title.person-in-charge-label,
  .ss_field .ss_form_title.position-label,
  .ss_field .ss_form_title.email-label {
    width: 100%;
    padding: 0;
    min-width: 100%;
    line-height: 1.4;
    margin-bottom: 0.25rem;
  }
  
  .ss_grid,
  .ss_field .facility-name-label + .ss_grid,
  .ss_field .person-in-charge-label + .ss_grid,
  .ss_field .position-label + .ss_grid,
  .ss_field .email-label + .ss_grid {
    width: 100%;
    padding-left: 0;
  }
  
  .ss_input {
    width: 100%;
  }
  
  .ss_btnArea input[type="button"],
  .ss_btnArea input[type="submit"] {
    width: auto;
    min-width: 8rem;
    padding: 0.75rem 1.5rem;
  }
  
  .p-privacy {
    padding: 1.5rem;
  }
  
  .ss_rightComment {
    display: block;
    margin-left: 0;
    margin-top: 0.35rem;
  }
  
  .form-wrapper.kagipay-form-card {
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 1rem;
  }
  
  .ss_input input[size="15"],
  .ss_input input[size="40"],
  .ss_input input[maxlength="20"],
  .ss_input input[maxlength="100"] {
    min-width: 0;
    max-width: 100%;
    width: 100%;
  }
  
  /* More specific selectors for mobile privacy agreement */
  .ss_field#ss_VisitorData\.attribute1 {
    padding: 0.75rem;
  }
  
  .ss_field#ss_VisitorData\.attribute1 .ss_form_title {
    padding: 0;
    margin-bottom: 0.5rem;
    width: 100%;
  }
  
  .ss_field#ss_VisitorData\.attribute1 .ss_grid {
    margin-left: 0;
    width: 100%;
  }
  
  .ss_field#ss_VisitorData\.attribute1 .ss_input {
    width: auto;
    justify-content: flex-start;
    padding-left: 0.25rem;
  }
}

/* Add a new media query for medium-sized screens */
@media (min-width: 768px) and (max-width: 1200px) {
  .ss_input input[size="15"],
  .ss_input input[size="40"],
  .ss_input input[maxlength="20"],
  .ss_input input[maxlength="100"] {
    max-width: 100%;
    width: 100%;
  }
  
  .ss_grid {
    width: calc(100% - 18rem);
    padding-left: 0.5rem;
  }
  
  .ss_form_title,
  .ss_field > label,
  .ss_field > .ss_label {
    min-width: 18rem;
    width: 18rem;
  }
}

