/**
 * Form Validation Styles
 * Modern form validation UI
 *
 * @package GRPCMedia
 */

/* ===============================================
   FORM FIELD STATES
   =============================================== */

.grpcmedia-form-field {
  position: relative;
  margin-bottom: 20px;
}

.grpcmedia-form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.grpcmedia-form-field .required-indicator {
  color: #e74c3c;
  margin-left: 4px;
}

.grpcmedia-form-field input,
.grpcmedia-form-field textarea,
.grpcmedia-form-field select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
}

.grpcmedia-form-field input:focus,
.grpcmedia-form-field textarea:focus,
.grpcmedia-form-field select:focus {
  border-color: var(--grpc-primary, #2F2483);
  box-shadow: 0 0 0 3px rgba(47, 36, 131, 0.1);
}

/* Error State */
.grpcmedia-form-field.has-error input,
.grpcmedia-form-field.has-error textarea,
.grpcmedia-form-field.has-error select {
  border-color: #e74c3c;
  background-color: #fff5f5;
}

.grpcmedia-form-field.has-error input:focus,
.grpcmedia-form-field.has-error textarea:focus,
.grpcmedia-form-field.has-error select:focus {
  border-color: #e74c3c;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.error-message {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #e74c3c;
  animation: fadeInDown 0.3s ease;
}

/* Success State */
.grpcmedia-form-field.has-success input,
.grpcmedia-form-field.has-success textarea,
.grpcmedia-form-field.has-success select {
  border-color: #27ae60;
  background-color: #f0fff4;
}

/* ===============================================
   FORM MESSAGES
   =============================================== */

.grpcmedia-form-message {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 20px 0;
  font-size: 14px;
  animation: fadeInDown 0.3s ease;
}

.grpcmedia-form-message--success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.grpcmedia-form-message--error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.grpcmedia-form-message--warning {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.grpcmedia-form-message--info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

/* ===============================================
   SUBMIT BUTTON STATES
   =============================================== */

button[type="submit"].loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button[type="submit"].loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===============================================
   CHECKBOX AND RADIO STYLES
   =============================================== */

.grpcmedia-form-field input[type="checkbox"],
.grpcmedia-form-field input[type="radio"] {
  width: auto;
  margin-right: 8px;
}

.grpcmedia-checkbox-group,
.grpcmedia-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grpcmedia-checkbox-item,
.grpcmedia-radio-item {
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Custom Checkbox */
.grpcmedia-custom-checkbox {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  margin-right: 10px;
}

.grpcmedia-custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.grpcmedia-custom-checkbox .checkmark {
  position: absolute;
  top: 0;
  left: 0;
  height: 20px;
  width: 20px;
  background-color: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.grpcmedia-custom-checkbox input:checked ~ .checkmark {
  background-color: var(--grpc-primary, #2F2483);
  border-color: var(--grpc-primary, #2F2483);
}

.grpcmedia-custom-checkbox .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.grpcmedia-custom-checkbox input:checked ~ .checkmark::after {
  display: block;
}

/* ===============================================
   FILE UPLOAD FIELD
   =============================================== */

.grpcmedia-file-upload {
  position: relative;
  display: inline-block;
}

.grpcmedia-file-upload input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.grpcmedia-file-upload-label {
  display: inline-block;
  padding: 12px 24px;
  background: #f8f9fa;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.grpcmedia-file-upload-label:hover {
  background: #e9ecef;
  border-color: var(--grpc-primary, #2F2483);
}

.grpcmedia-file-upload-label i {
  margin-right: 8px;
}

/* ===============================================
   ACCESSIBILITY
   =============================================== */

.grpcmedia-form-field input:focus-visible,
.grpcmedia-form-field textarea:focus-visible,
.grpcmedia-form-field select:focus-visible {
  outline: 2px solid var(--grpc-primary, #2F2483);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}


