/**
 * EasyForm Frontend Styles - Professional Enhanced Version
 * Modern, professional styling while maintaining backward compatibility
 */

/* CSS Custom Properties for Dynamic Styling */
.easyform-form {
  --easyform-primary-color: #007cba;
  --easyform-secondary-color: #4299e1;
  --easyform-background-color: #ffffff;
  --easyform-text-color: #1a202c;
  --easyform-font-family: inherit;
  --easyform-font-size: 16px;
  --easyform-border-radius: 8px;
}

/* Form container - Enhanced professional styling with CSS variables */
.easyform-form {
  max-width: 100%;
  margin: 0 auto;
  padding: 32px;
  background: var(--easyform-background-color);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  font-family: var(--easyform-font-family);
  font-size: var(--easyform-font-size);
}

.easyform-form::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--easyform-primary-color) 0%,
    var(--easyform-secondary-color) 50%,
    var(--easyform-primary-color) 100%
  );
  border-radius: 16px 16px 0 0;
}

/* Form fields - Enhanced spacing and organization */
.easyform-fields {
  margin-bottom: 24px;
}

.easyform-field {
  margin-bottom: 24px;
  position: relative;
}

.easyform-field:last-child {
  margin-bottom: 0;
}

/* Field labels - Professional typography with CSS variables */
.easyform-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--easyform-text-color);
  cursor: pointer;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

.easyform-required {
  color: #e53e3e;
  font-weight: 700;
  margin-left: 4px;
}

/* Form inputs - Modern professional styling */
.easyform-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.5;
  transition: all 0.2s ease;
  box-sizing: border-box;
  background: #ffffff;
  font-family: inherit;
}

.easyform-input:focus {
  outline: none;
  border-color: var(--easyform-primary-color);
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
  background: #ffffff;
}

.easyform-input:hover:not(:focus) {
  border-color: #cbd5e0;
}

.easyform-input::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

/* Textarea specific */
.easyform-field-textarea textarea.easyform-input {
  resize: vertical;
  min-height: 100px;
}

/* Select styling - Enhanced professional dropdown */
.easyform-field-select select.easyform-input {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23007cba' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 48px;
  cursor: pointer;
  font-weight: 500;
}

.easyform-field-select select.easyform-input:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23007cba' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.easyform-field-select select.easyform-input:hover {
  border-color: #007cba;
}

/* Radio buttons and checkboxes - Modern professional styling */
.easyform-radio-option,
.easyform-checkbox-option {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.easyform-radio-option:hover,
.easyform-checkbox-option:hover {
  background: rgba(0, 124, 186, 0.05);
}

.easyform-radio-option input[type="radio"],
.easyform-radio-option input[type="checkbox"],
.easyform-checkbox-option input[type="radio"],
.easyform-checkbox-option input[type="checkbox"] {
  margin: 0;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: #007cba;
  cursor: pointer;
}

.easyform-radio-option label,
.easyform-checkbox-option label {
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #2d3748;
  line-height: 1.4;
}

/* File upload - Enhanced professional styling */
.easyform-field-file .easyform-file-info {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #718096;
  font-style: normal;
  background: #f7fafc;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #007cba;
}

.easyform-file-list {
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.easyform-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.2s ease;
  border-radius: 4px;
}

.easyform-file-item:hover {
  background: rgba(0, 124, 186, 0.05);
}

.easyform-file-item:last-child {
  border-bottom: none;
}

.easyform-file-name {
  font-weight: 600;
  color: #2d3748;
  font-size: 14px;
}

.easyform-file-size {
  font-size: 12px;
  color: #718096;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* Submit section - Enhanced professional styling */
.easyform-submit-section {
  text-align: center;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 0 0 16px 16px;
  margin: 32px -32px -32px -32px;
  padding: 24px 32px;
}

.easyform-submit-btn {
  background: linear-gradient(
    135deg,
    var(--easyform-primary-color) 0%,
    var(--easyform-secondary-color) 100%
  );
  color: #ffffff;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 160px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.easyform-submit-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.easyform-submit-btn:hover {
  background: linear-gradient(135deg, #005a87 0%, #3182ce 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
}

.easyform-submit-btn:hover::before {
  left: 100%;
}

.easyform-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.easyform-submit-btn:disabled {
  background: #a0aec0;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Error styling - Enhanced professional error states */
.easyform-error {
  color: #e53e3e;
  font-size: 14px;
  margin-top: 6px;
  display: block;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.easyform-error::before {
  content: "⚠";
  font-size: 16px;
}

.easyform-field-error .easyform-input {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
  background: #fef5f5;
}

.easyform-field-error label {
  color: #e53e3e;
}

/* Success message - Enhanced professional styling */
.easyform-success {
  background: linear-gradient(135deg, #d4edda 0%, #c6f6d5 100%);
  border: 1px solid #9ae6b4;
  color: #22543d;
  padding: 20px;
  border-radius: 12px;
  margin-top: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.15);
  position: relative;
}

.easyform-success::before {
  content: "✓";
  font-size: 24px;
  color: #38a169;
  margin-right: 8px;
  display: inline-block;
}

/* Loading state - Enhanced professional loading animation */
.easyform-form.submitting {
  opacity: 0.8;
  pointer-events: none;
  position: relative;
}

.easyform-form.submitting::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  z-index: 10;
  backdrop-filter: blur(2px);
}

.easyform-form.submitting::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top: 3px solid var(--easyform-primary-color);
  border-radius: 50%;
  animation: easyform-spin 1s linear infinite;
  z-index: 11;
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.2);
}

@keyframes easyform-spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Additional professional animations */
@keyframes easyform-fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes easyform-slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.easyform-field {
  animation: easyform-fadeIn 0.3s ease-out;
}

.easyform-form.loaded .easyform-field {
  animation: easyform-slideIn 0.4s ease-out;
}

.easyform-form.loaded .easyform-field:nth-child(2) {
  animation-delay: 0.1s;
}

.easyform-form.loaded .easyform-field:nth-child(3) {
  animation-delay: 0.2s;
}

.easyform-form.loaded .easyform-field:nth-child(4) {
  animation-delay: 0.3s;
}

.easyform-form.loaded .easyform-field:nth-child(5) {
  animation-delay: 0.4s;
}

/* Responsive design */
@media (max-width: 768px) {
  .easyform-form {
    padding: 15px;
    margin: 0 10px;
  }

  .easyform-input {
    padding: 12px 14px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .easyform-submit-btn {
    padding: 14px 28px;
    font-size: 18px;
  }

  .easyform-radio-option,
  .easyform-checkbox-option {
    margin-bottom: 10px;
  }
}

@media (max-width: 480px) {
  .easyform-form {
    margin: 0 5px;
    padding: 10px;
  }

  .easyform-field label {
    font-size: 13px;
  }

  .easyform-input {
    padding: 10px 12px;
  }
}

/* Print styles */
@media print {
  .easyform-form {
    box-shadow: none;
    border: none;
    background: transparent;
  }

  .easyform-submit-btn {
    display: none;
  }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
  .easyform-form {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .easyform-input,
  .easyform-field-select select {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .easyform-input:focus {
    border-color: #4299e1;
  }

  .easyform-submit-btn {
    background: #4299e1;
  }

  .easyform-submit-btn:hover {
    background: #3182ce;
  }

  .easyform-field label {
    color: #e2e8f0;
  }

  .easyform-file-list {
    background: #2d3748;
    border-color: #4a5568;
  }

  .easyform-submit-section {
    border-color: #4a5568;
  }
}

/* Accessibility improvements */
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  word-wrap: normal !important;
}

.easyform-field:focus-within label {
  color: var(--easyform-primary-color);
}

/* Focus management */
.easyform-input:focus + label,
.easyform-input:focus ~ label {
  color: var(--easyform-primary-color);
}

/* Skip to content for accessibility */
.easyform-form a:focus {
  outline: 2px solid var(--easyform-primary-color);
  outline-offset: 2px;
}
