/**
 * Vendor Application Form Custom Styles
 * Additional styles to complement Tailwind CSS
 */

/* Form Container */
#vendor-application-form {
  animation: fadeIn 0.3s ease-in;
}

.vendor-application-form__section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@keyframes fadeIn {
  from {
      opacity: 0;
      transform: translateY(10px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

/* Step Transitions */
.step-content {
  transition: opacity 0.3s ease-in-out;
}

.step-content.hidden {
  opacity: 0;
  display: none;
}

.step-content.active {
  opacity: 1;
  display: block;
}

/* Progress Bar Enhancements */
.step-circle {
  background-color: #e5e7eb; /* Tailwind gray-200 */
  border: 2px solid #d1d5db; /* Tailwind gray-300 */
  color: #4b5563; /* Tailwind gray-600 */
  width: 2.5rem; /* 40px */
  height: 2.5rem; /* 40px */
  border-radius: 9999px; /* full */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.3s ease;
  position: relative;
  box-sizing: border-box; /* Ensure padding/border are included in width/height */
}

.step-circle.active {
  background-color: #3b82f6; /* Tailwind blue-500 */
  border-color: #3b82f6;
  color: white;
}

.step-circle.completed {
  background-color: #10b981; /* Tailwind green-500 */
  border-color: #10b981;
  color: white;
}

.step-circle.completed::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
}

.step-line {
  height: 2px;
  background-color: #d1d5db; /* Tailwind gray-300 */
  flex-grow: 1; /* Allows line to fill space in its flex container */
  transition: background-color 0.3s ease;
  margin: 0 0.5rem; /* Adds some horizontal spacing around the line */
}

/* This class should be added by JS to the line when its preceding step is active or completed */
.step-line.active {
  background-color: #3b82f6; /* Tailwind blue-500 */
}

.step-line.completed {
  background-color: #10b981; /* Tailwind green-500 */
}

/* Styling for the text below the steps */
/* Assumes the <p> tag itself gets an 'active' or 'completed' class from JavaScript */
p.text-sm.active {
  color: #3b82f6; /* Tailwind blue-500 */
  font-weight: 600; /* Tailwind semibold */
}

p.text-sm.completed {
  color: #10b981; /* Tailwind green-500 */
  /* You might want to keep it semibold or revert to normal weight */
  font-weight: 600;
}

/* Form Fields */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Error States */
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% {
      transform: translateX(0);
  }
  25% {
      transform: translateX(-5px);
  }
  75% {
      transform: translateX(5px);
  }
}

.error-message.show {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
      opacity: 0;
      transform: translateY(-5px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

/* OTP Input */
#otp_code {
  letter-spacing: 0.5em;
  font-family: 'Courier New', monospace;
}

/* Loading States */
button:disabled {
  position: relative;
  overflow: hidden;
}

button:disabled::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.2) 50%,
      transparent 100%
  );
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
      left: -100%;
  }
  100% {
      left: 100%;
  }
}

/* Success Message */
#success-message {
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
      opacity: 0;
      transform: translateY(20px);
  }
  to {
      opacity: 1;
      transform: translateY(0);
  }
}

/* Alert Messages */
.bg-red-100,
.bg-green-100 {
  animation: alertSlide 0.3s ease-out;
}

@keyframes alertSlide {
  from {
      opacity: 0;
      transform: translateX(-10px);
  }
  to {
      opacity: 1;
      transform: translateX(0);
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  #vendor-application-form {
      padding: 1rem;
  }
  
  .step-circle {
      width: 2rem;
      height: 2rem;
      font-size: 0.875rem;
  }
  
  .step-line {
      height: 2px;
  }
  
  #otp_code {
      max-width: 100%;
      font-size: 1.5rem;
  }
}

/* Print Styles */
@media print {
  #vendor-application-form {
      background: white;
      color: black;
  }
  
  .btn-primary,
  .btn-secondary {
      display: none;
  }
  
  .step-content.hidden {
      display: block !important;
      opacity: 1 !important;
      page-break-before: always;
  }
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .step-circle {
      border: 2px solid currentColor;
  }
  
  input,
  textarea,
  select {
      border-width: 2px;
  }
  
  .error-message {
      font-weight: bold;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
  }
}

/* Custom Focus Styles */
*:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Button Hover Effects */
.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.btn-secondary:not(:disabled):hover {
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

/* Form Layout Improvements */
.grid {
  gap: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
}

input,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input:hover:not(:focus):not([aria-invalid="true"]),
select:hover:not(:focus):not([aria-invalid="true"]) {
  border-color: #9ca3af;
}

/* Timer Display */
#resend-timer {
  font-weight: 500;
  color: #6b7280;
}

/* Success Screen Enhancements */
#success-message .bg-green-100 {
  position: relative;
  overflow: hidden;
}

#success-message .bg-green-100::before {
  content: '✓';
  position: absolute;
  top: 50%;
  right: 1rem;
  transform: translateY(-50%);
  font-size: 3rem;
  color: rgba(34, 197, 94, 0.2);
}

/* Loading Spinner for AJAX calls */
.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}