@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --background: hsl(0 0% 100%);
  --foreground: hsl(0 0% 9%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(0 0% 9%);
  --popover: hsl(0 0% 100%);
  --popover-foreground: hsl(0 0% 9%);
  --primary: hsl(0 0% 45%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(100 30% 85%);
  --secondary-foreground: hsl(100 50% 20%);
  --muted: hsl(100 20% 92%);
  --muted-foreground: hsl(100 10% 45%);
  --accent: hsl(0 0% 90%);
  --accent-foreground: hsl(0 0% 15%);
  --destructive: hsl(0 84% 60%);
  --destructive-foreground: hsl(0 0% 98%);
  --border: hsl(214 31% 91%);
  --input: hsl(0 0% 100%);
  --ring: hsl(215 20% 65%);
  --chart-1: hsl(100 50% 40%);
  --chart-2: hsl(95 45% 45%);
  --chart-3: hsl(105 40% 50%);
  --chart-4: hsl(90 50% 55%);
  --chart-5: hsl(110 45% 35%);
  --sidebar: hsl(0 0% 98%);
  --sidebar-foreground: hsl(0 0% 9%);
  --sidebar-primary: hsl(100 50% 35%);
  --sidebar-primary-foreground: hsl(0 0% 98%);
  --sidebar-accent: hsl(100 30% 85%);
  --sidebar-accent-foreground: hsl(100 50% 15%);
  --sidebar-border: hsl(100 15% 88%);
  --sidebar-ring: hsl(100 50% 35%);
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 9px;

  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: #f8fafc;
}

/* Brand helpers */
.text-brand-purple { color: #5b5bd6; }
.bg-brand-purple { background-color: #5b5bd6; }
.border-brand-purple { border-color: #5b5bd6; }
.bg-brand-green { background-color: hsl(100 45% 40%); }

/* Cards */
.card-modern {
  background-color: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 9px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease-in-out;
}

.card-modern:hover { box-shadow: var(--shadow-md); }

.card-minimal {
  background-color: #ffffff;
  border: 1px solid #f1f5f9;
  border-radius: 4.5px;
  box-shadow: 0 0.5px 1.5px rgba(0,0,0,0.05), 0 0.5px 1px rgba(0,0,0,0.03);
  transition: all 0.2s ease-in-out;
}

.card-minimal:hover {
  box-shadow: 0 2px 3px -0.5px rgba(0,0,0,0.05), 0 1px 2px -0.5px rgba(0,0,0,0.03);
}

/* Inputs */
.input-modern {
  border: 1px solid #e5e7eb !important;
  padding: 6px 12px;
  border-radius: 9px;
  font-size: 16px;
  line-height: 1.5;
  background-color: #f1f5f9 !important;
  color: #6b7280 !important;
  transition: all 0.2s ease-in-out;
  height: 34px !important;
}

/* Override Safari default select styling - apply custom styles */
select.input-modern,
select.select_field,
select.form-control,
.modern-lead-redesign select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%236b7280" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e') !important;
  background-repeat: no-repeat !important;
  background-position: right 8px center !important;
  background-size: 16px !important;
  padding-right: 32px !important;
  background-color: #f1f5f9 !important; /* Same as input-modern when not focused */
  border: 1px solid #e5e7eb !important;
  color: #6b7280 !important;
}

/* Select focus state - same as input focus */
select.input-modern:focus,
select.select_field:focus,
select.form-control:focus,
.modern-lead-redesign select:focus {
  background-color: #ffffff !important; /* White when focused, same as input */
  border-color: #d1d5db !important;
  outline: none !important;
  box-shadow: none !important;
  transform: scale(1.02) !important;
  color: #374151 !important;
}

/* Style option elements to match select field - consistent across all browsers */
select.input-modern option,
select.select_field option,
select.form-control option,
.modern-lead-redesign select option {
  background-color: #ffffff !important;
  color: #374151 !important;
  padding: 8px 12px !important;
}

/* Style hover state for options */
select.input-modern option:hover,
select.select_field option:hover,
select.form-control option:hover,
.modern-lead-redesign select option:hover {
  background-color: #f3f4f6 !important;
}

/* Style selected/checked option */
select.input-modern option:checked,
select.select_field option:checked,
select.form-control option:checked,
.modern-lead-redesign select option:checked {
  background-color: #e5e7eb !important;
  color: #111827 !important;
}

/* Fix dollar sign alignment - center vertically */
.relative .absolute.left-3 {
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Grey delete icon in document sections */
.specific-edit-file-delete img,
.remove-queued-doc-btn img,
.delete_document_div img {
  filter: grayscale(1) brightness(0.5) !important;
}

/* Loading spinner overlay for Save button */
#lead-save-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.lead-save-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #4f46e5;
  border-radius: 50%;
  margin: 30rem auto 50rem auto;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.input-modern::placeholder { color: #9ca3af !important; }
.input-modern:focus,
select.input-modern:focus,
select.select_field:focus,
select.form-control:focus {
  background-color: #ffffff !important;
  border-color: #d1d5db !important;
  outline: none !important;
  box-shadow: none !important;
  transform: scale(1.02);
  color: #374151 !important;
}

.label-modern { font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 8px; display: block; }

/* Buttons */
.button-primary {
  background-color: #16a34a;
  color: #ffffff;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 9px;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-md);
}
.button-primary:hover { background-color: #15803d; transform: scale(1.05); box-shadow: var(--shadow-lg); }
.button-primary:focus { outline: 2px solid #22c55e; outline-offset: 2px; }

.button-secondary {
  background-color: #f3f4f6;
  color: #374151;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 9px;
  transition: all 0.2s ease-in-out;
  border: 1px solid #e5e7eb;
}
.button-secondary:hover { background-color: #e5e7eb; }

/* Progress */
.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  transition: all 0.2s ease-in-out;
}
.progress-step.active { background: #f5f3ff; color: #5b5bd6; }
.progress-step.inactive { background: #f9fafb; color: #6b7280; }

.progress-circle {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease-in-out;
}
.progress-circle.active { background: #5b5bd6; color: #ffffff; }
.progress-circle.inactive { background: #e5e7eb; color: #4b5563; }

/* Document button */
.document-button {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  background-color: #f1f5f9;
  width: 60px;
  height: 41px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.document-button:hover { background-color: #ffffff; }

/* Documents grid polish */
.docs-grid {
  grid-template-columns: 1fr 60px 1fr 60px;
}
.docs-section-title { font-size: 1.125rem; font-weight: 600; color: #111827; }
.docs-section-subtitle { font-size: 0.875rem; color: #6b7280; }

/* Document grid container - mobile responsive */
.document-item-wrapper {
  display: contents;
}

/* Actions wrapper - transparent on desktop */
.document-actions-wrapper {
  display: contents;
}

/* Generic document rows - align with main grid on desktop */
#other_personal_documents_field,
#other_documents_field {
  display: grid;
  grid-template-columns: 1fr 100px 40px 1fr 100px 40px;
  gap: 8px;
  align-items: center;
}

.generic-document-row {
  grid-column: 1 / 4; /* Span first 3 columns to match "Upload Generic Documents" section */
}

.generic-document-grid {
  display: grid;
  grid-template-columns: 1fr 100px 40px;
  gap: 8px;
  align-items: center;
  width: 100%;
}

/* Generic actions wrapper - transparent on desktop */
.generic-actions-wrapper {
  display: contents;
}

@media (max-width: 768px) {
  .document-grid-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  .document-item-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    grid-column: 1 !important;
  }
  
  .document-item-wrapper .document-label {
    width: 100% !important;
    height: auto !important;
    min-height: 41px !important;
  }
  
  /* Actions wrapper becomes flex container on mobile */
  .document-actions-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    width: 100% !important;
    align-items: center !important;
  }
  
  /* Upload wrapper - full width when no delete button */
  .document-actions-wrapper .document-upload-wrapper {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
  }
  
  .document-actions-wrapper .document-upload-wrapper .document-button,
  .document-actions-wrapper .document-upload-wrapper .leads_document_upload {
    width: 100% !important;
  }
  
  /* When delete button is present, upload takes 83.33% (col-10) */
  .document-actions-wrapper:has(.delete-button-wrapper button) .document-upload-wrapper {
    width: 83.333333% !important; /* col-10 equivalent */
  }
  
  .document-actions-wrapper:has(.delete-button-wrapper button) .document-upload-wrapper .document-button,
  .document-actions-wrapper:has(.delete-button-wrapper button) .document-upload-wrapper .leads_document_upload {
    width: 100% !important;
  }
  
  /* Delete button wrapper - hidden when no button, shown when has button */
  .document-actions-wrapper .delete-button-wrapper:not(:has(button)) {
    display: none !important;
  }
  
  .document-actions-wrapper .delete-button-wrapper:has(button) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16.666667% !important; /* col-2 equivalent */
    flex-shrink: 0 !important;
  }
  
  /* Generic document rows mobile responsive */
  #other_personal_documents_field,
  #other_documents_field {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }
  
  .generic-document-row {
    grid-column: auto !important;
    width: 100% !important;
  }
  
  .generic-document-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }
  
  .generic-document-grid .select_document_others {
    width: 100% !important;
  }
  
  
  /* On mobile, make actions wrapper a flex container */
  .generic-document-grid .generic-actions-wrapper {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    width: 100% !important;
    align-items: center !important;
  }
  
  /* Upload wrapper - full width when upload is hidden */
  .generic-actions-wrapper .generic-upload-wrapper[style*="display: none"] {
    display: none !important;
  }
  
  .generic-actions-wrapper .generic-upload-wrapper:not([style*="display: none"]) {
    display: flex !important;
    width: 83.333333% !important; /* col-10 */
  }
  
  /* Delete button wrapper */
  .generic-actions-wrapper .generic-delete-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 16.666667% !important; /* col-2 */
    flex-shrink: 0 !important;
  }
  
  /* When upload is hidden, delete should also be hidden or take full width */
  .generic-actions-wrapper:has(.generic-upload-wrapper[style*="display: none"]) .generic-delete-wrapper {
    display: none !important;
  }
  
  /* Credit issue fields mobile responsive */
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding: 12px 16px !important;
  }
  
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] > div:first-child {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    justify-content: flex-start !important;
  }
  
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] > div:nth-child(2) {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
  }
  
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] > div:nth-child(2) label {
    gap: 6px !important;
  }
  
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] > div:last-child {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
  }
  
  .credit_issue_fields .bg-white.rounded-lg[style*="grid-template-columns"] > div:last-child select {
    width: 100% !important;
    float: none !important;
    max-width: 100% !important;
  }
  
  /* Recently applied for credit section mobile responsive */
  .recently_applied_for_creditcard_section .flex.items-center {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }
  
  .recently_applied_for_creditcard_section .flex.items-center input[type="text"] {
    width: 100% !important;
    flex: none !important;
  }
  
  .recently_applied_for_creditcard_section .flex.items-center select {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Tabs mobile responsive */
  .max-w-7xl.mx-auto.px-8 .flex.space-x-4 {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
  }
  
  .max-w-7xl.mx-auto.px-8 .flex.space-x-4::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
  }
  
  .max-w-7xl.mx-auto.px-8 .flex.space-x-4 button {
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  
  .max-w-7xl.mx-auto.px-8 {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* Inline question layout for Additional Information */
.question-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.question-text { font-size: 0.95rem; color: #111827; }
.radio-inline { display: flex; align-items: center; gap: 24px; }
/* Align Paid/Unpaid radios in legacy (edit) view rows */
.border_style { display: flex; align-items: center; gap: 24px; justify-content: center; }
.radio-inline.cstm_label { display: flex; align-items: center; gap: 8px; margin: 0; }
.radio_styling { margin: 0; vertical-align: middle; }
/* Force revealed content to start on a new line within question row */
.reveal-block { flex-basis: 100%; width: 100%; }
@media (max-width: 768px) {
  .question-row { flex-direction: column; align-items: flex-start; }
  .radio-inline { gap: 12px; }
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  background-color: #111827;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
}


