/* QuickMoneyLoans Mobile-First Application Form Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 10px;
  color: #333;
  line-height: 1.6;
}

form {
  max-width: 100%;
  margin: 0 auto;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
}

/* Header styling - Mobile first */
form::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4caf50, #2196f3, #ff9800);
  border-radius: 12px 12px 0 0;
}

.form-header {
  text-align: center;
  margin-bottom: 32px;
}

h1 {
  color: #2c3e50;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  color: #2c3e50;
  font-size: 1.8rem;
  margin-bottom: 12px;
  font-weight: 600;
  position: relative;
  line-height: 1.3;
}

h2::after {
  content: "";
  display: block;
  width: 50px;
  height: 3px;
  background: #4caf50;
  margin: 12px auto;
  border-radius: 2px;
}

.form-subtitle {
  color: #666;
  font-size: 14px;
  margin-bottom: 0;
}

h3 {
  color: #34495e;
  font-size: 1.3rem;
  margin: 32px 0 20px 0;
  padding: 16px 0 12px 0;
  border-bottom: 2px solid #ecf0f1;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

h4 {
  color: #34495e;
  font-size: 1.1rem;
  margin: 24px 0 16px 0;
  font-weight: 600;
}

.section-icon {
  font-size: 1.2rem;
}

/* Form group styling with better spacing */
.form-group {
  margin-bottom: 28px; /* Increased bottom margin */
}

/* Consistent label styling with proper spacing */
label {
  display: block;
  margin-bottom: 2px; /* Reduced to bring input closer to its label */
  font-weight: 600;
  color: #2c3e50;
  font-size: 16px;
  line-height: 1.0;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 120px;
}

/* CONSISTENT INPUT STYLING - All inputs have identical dimensions */
input[type="text"],
input[type="email"],
input[type="date"],
input[type="tel"],
input[type="number"],
input[type="select"],
select {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid grey;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s ease;
  background-color: #fafbfc;
  min-height: 52px;
  max-height: 52px; /* Force consistent height */
  height: 52px; /* Explicit height for all inputs */
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
  line-height: 1.2; /* Consistent line height */
  vertical-align: top; /* Consistent alignment */
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="date"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
select {
  outline: none;
  border: 1px solid grey;
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
  transform: translateY(-1px);
}

/* SSN container styling with consistent padding */
.ssn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.ssn-container input {
  width: 100px !important;
  min-width: 100px;
  text-align: center;
  font-weight: 600;
  background-color: #f8f9fa;
  font-size: 18px;
  padding: 14px 8px !important; /* Slightly different for visual balance */
  min-height: 50px;
}

.ssn-container span {
  font-weight: bold;
  color: #666;
  font-size: 20px;
  margin: 0 4px;
}

/* Currency input styling */
.currency-input {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 18px;
  font-weight: bold;
  color: #666;
  z-index: 1;
  font-size: 16px;
}

.currency-input input {
  padding-left: 40px !important; /* Space for dollar sign */
}

/* Field hints with proper spacing */
.field-hint {
  display: block;
  color: #666;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 0; /* No bottom margin to prevent extra space */
  font-style: italic;
}

/* Enhanced phone number styling for mobile */
input[name="phone"],
input[name="cosigner_phone"],
input[name="employer_phone"],
input[name="cosigner_employer_phone"] {
  font-family: -apple-system, BlinkMacSystemFont, "SF Mono", "Monaco", "Consolas", monospace;
  letter-spacing: 1px;
  font-size: 18px;
}

/* Financial input styling */
input[id="loan_amount"],
input[id="monthly_income"],
input[id="monthly_payment"] {
  background-color: #f0f8f0;
  border-color: #4caf50;
  font-weight: 600;
  font-size: 18px;
}

input[id="loan_amount"]:focus,
input[id="monthly_income"]:focus,
input[id="monthly_payment"]:focus {
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.2);
}

/* Submit button styling */
.submit-btn {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  padding: 18px 24px;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 32px;
  width: 100%;
  min-height: 56px;
  text-transform: uppercase;
  letter-spacing: 1px;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-btn:hover,
.submit-btn:active {
  background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

.submit-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-loading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Form disclaimer */
.form-disclaimer {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-top: 16px;
  line-height: 1.4;
}

 

/* Error message styling with consistent spacing */
.error-message {
  color: #e74c3c;
  font-size: 14px;
  margin-top: 4px;
  margin-bottom: 0; /* No bottom margin */
  min-height: 18px; /* Reduced from 20px */
  font-weight: 500;
}

.form-group.error input {
  border-color: #e74c3c !important;
  background-color: #fdf2f2 !important;
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* State and ZIP code styling */
input[name="b_employer_state"],
input[name="c_employer_state"] {
  text-transform: uppercase;
}

/* Mobile-specific improvements */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  form {
    padding: 16px;
    margin: 5px;
    border-radius: 8px;
  }

  h1 {
    font-size: 1.4rem;
  }

  h2 {
    font-size: 1.6rem;
    margin-bottom: 20px;
  }

  h3 {
    font-size: 1.2rem;
    margin: 28px 0 16px 0;
    padding: 12px 0 8px 0;
  }

  label {
    font-size: 15px;
  }

  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="tel"],
  input[type="number"] {
    padding: 14px 16px;
    font-size: 16px;
    min-height: 48px;
    max-height: 48px; /* Force consistent height on mobile */
    height: 48px; /* Explicit height for mobile */
  }

  .currency-input input {
    padding-left: 36px !important;
  }

  .currency-symbol {
    left: 16px;
  }

  .ssn-container input {
    width: 70px !important;
    min-width: 55px;
    font-size: 16px;
    padding: 12px 6px !important;
    min-height: 46px;
  }

  .submit-btn {
    padding: 16px 20px;
    font-size: 16px;
    min-height: 52px;
    margin-top: 28px;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  body {
    padding: 20px;
  }

  form {
    max-width: 700px;
    padding: 40px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 2.2rem;
    margin-bottom: 30px;
  }

  h3 {
    font-size: 1.5rem;
  }
}

@media (min-width: 1024px) {
  form {
    max-width: 800px;
    padding: 50px;
  }
}

/* Enhanced accessibility */
input:focus {
  outline: 3px solid rgba(76, 175, 80, 0.3);
  outline-offset: 2px;
}

/* Section color coding */
h3:nth-of-type(1) {
  color: #2980b9;
  border-bottom-color: #d5e8f0;
}

h3:nth-of-type(2) {
  color: #8e44ad;
  border-bottom-color: #e8d5f0;
}

h3:nth-of-type(3) {
  color: #e67e22;
  border-bottom-color: #f0e8d5;
}

/* Prevent zoom on input focus for iOS */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="datetime"],
  input[type="datetime-local"],
  input[type="date"],
  input[type="month"],
  input[type="time"],
  input[type="week"],
  input[type="number"],
  input[type="email"],
  input[type="url"],
  input[type="search"],
  input[type="tel"],
  input[type="color"] {
    font-size: 16px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  }

  form {
    background: #2c3e50;
    color: #ecf0f1;
  }

  h1,
  h2,
  h3,
  h4,
  label {
    color: #ecf0f1;
  }

  input[type="text"],
  input[type="email"],
  input[type="date"],
  input[type="tel"],
  input[type="number"] {
    background-color: #34495e;
    border-color: #4a5f7a;
    color: #ecf0f1;
  }

  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="date"]:focus,
  input[type="tel"]:focus,
  input[type="number"]:focus {
    background-color: #3d566e;
    border-color: #4caf50;
  }
}
