/* Absa Form Styling Guidelines with Accessibility Focus */

/* Form containers and fieldsets */
.form-container {
  background-color: var(--serene);
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

fieldset {
  /*border: 1px solid var(--grey-24);*/
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

legend {
  color: var(--hope);
  font-weight: 700;
  font-size: 1.2rem;
  /*padding: 0 10px;*/
}

/* Label styling for better readability */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--grey-72);
}

/* Form controls with Absa style */
.form-control {
  height: 45px;
  border-radius: 4px;
  border: 1px solid var(--grey-24);
  padding: 10px 15px;
  font-size: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--hope);
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(149, 5, 42, 0.25);
}

/* Select input styling */
select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2395052A' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* Checkbox and radio button styling */
.form-check {
  padding-left: 1.8rem;
  margin-bottom: 15px;
}

.form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  margin-left: -1.8rem;
}

.form-check-input:checked {
  accent-color: var(--hope);
  border-color: var(--hope);
}

.form-check-input:focus {
  border-color: var(--hope);
  box-shadow: 0 0 0 0.2rem rgba(149, 5, 42, 0.25);
}

.form-check-label {
  padding-left: 5px;
  line-height: 1.5;
}

/* Required field indicator */
.required-field::after {
  content: " *";
  color: var(--error-accent);
}

/* Validation styling */
.is-valid {
  border-color: var(--positive-text) !important;
}

.is-invalid {
  border-color: var(--error-text) !important;
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: var(--error-text);
}

.valid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: var(--positive-text);
}

/* Form group spacing */
.form-group {
  margin-bottom: 20px;
}

/* Help text */
.form-text {
  display: block;
  margin-top: 5px;
  font-size: 0.875em;
  color: var(--grey-60);
}

/* Accessibility focus indicators */
input:focus, 
select:focus, 
textarea:focus, 
button:focus,
.form-check-input:focus {
  outline: 2px solid var(--hope);
  outline-offset: 2px;
}

/* Date input specific styling */
input[type="date"] {
  padding-right: 30px;
}

/* File input styling */
input[type="file"] {
  padding: 8px;
}

input[type="file"]::file-selector-button {
  border: 1px solid var(--hope);
  background-color: transparent;
  color: var(--hope);
  padding: 8px 16px;
  border-radius: 4px;
  margin-right: 15px;
  transition: background-color 0.2s, color 0.2s;
}

input[type="file"]::file-selector-button:hover {
  background-color: var(--hope);
  color: white;
}

/* Form submit button styling */
.form-submit-btn {
  background-color: var(--hope);
  color: white;
  border: 2px solid var(--hope);
  border-radius: 4px;
  padding: 12px 24px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background-color 0.2s, color 0.2s;
  letter-spacing: 0.5px;
}

.form-submit-btn:hover {
  background-color: transparent;
  color: var(--hope);
}

/* High contrast mode for accessibility */
@media (prefers-contrast: high) {
  .form-control {
    border-width: 2px;
  }
  
  input, select, textarea {
    border-color: black !important;
    color: black !important;
    background-color: white !important;
  }
  
  label {
    color: black !important;
  }
}

/* Focus indicators for keyboard navigation */
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid var(--hope);
  outline-offset: 2px;
}
