/* Form Validation Styles for ARM Solutions
 * Based on recommendations from FORM_EXPERIENCE_IMPROVEMENTS.md
 */

/* Form feedback elements */
.form-feedback {
  display: none;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.valid-feedback {
  color: #28a745;
  display: block;
}

.invalid-feedback {
  color: #6c757d;
  display: block;
}

/* Input validation states */
.is-valid {
  border-color: #28a745 !important;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.is-invalid {
  border-color: #dc3545 !important;
  padding-right: calc(1.5em + 0.75rem);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Error summary */
.error-summary {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 0.25rem;
  background-color: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.error-summary h4 {
  color: #dc3545;
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.error-summary ul {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

.error-summary a {
  color: #dc3545;
  text-decoration: underline;
}

.error-summary a:hover {
  color: #bd2130;
}

/* Loading state for buttons */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading .spinner-border {
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -0.5rem;
  margin-left: -0.5rem;
}

/* Auto-save status */
.autosave-status {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  min-height: 1.5rem;
}

.autosave-saved {
  color: #28a745;
}

.autosave-restored {
  color: #17a2b8;
}

.autosave-cleared {
  color: #6c757d;
}

.autosave-clear {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Focus styles */
input:focus, 
textarea:focus, 
select:focus, 
button:focus {
  outline: 3px solid #0066cc;
  outline-offset: 2px;
}

/* Required field indicator */
.required-indicator {
  color: #dc3545;
  font-weight: bold;
}

/* Form skip link for keyboard navigation */
.form-skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0066cc;
  color: white;
  padding: 8px 15px;
  z-index: 100;
  transition: top 0.3s;
}

.form-skip-link:focus {
  top: 0;
}

/* Focused input container */
.input-focused {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}
