/* cssx/application-form.css */
/* Adoption Form Specific Styles */

/* ===== FORM CONTAINER ===== */
.application-form-container {
  max-width: 800px;
  margin: 0 auto;
}

.application-form-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: var(--bg-white);
  padding: var(--space-32);
  text-align: center;
}

.application-form-header h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-8);
}

.application-form-header p {
  opacity: 0.9;
  font-size: var(--font-size-lg);
}

/* ===== PROGRESS BAR ===== */
.progress-container {
  padding: var(--space-20);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.progress-bar {
  background: var(--bg-tertiary);
  height: var(--space-8);
  border-radius: var(--space-4);
  overflow: hidden;
  margin-bottom: var(--space-12);
}

.progress-fill {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
  height: 100%;
  transition: width 0.5s ease;
  border-radius: var(--space-4);
}

.progress-text {
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

/* ===== STEP CONTENT ===== */
.step-content {
  padding: var(--space-40);
  min-height: 400px;
}

.step-title {
  color: var(--primary-color);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-24);
  text-align: center;
}

.step-subtitle {
  color: var(--text-muted);
  font-size: var(--font-size-base);
  margin-bottom: var(--space-32);
  text-align: center;
  line-height: 1.6;
}

/* ===== FORM SECTIONS ===== */
.form-section {
  margin-bottom: var(--space-16);
  margin-top: var(--space-16);
  padding: var(--space-24);
  background: var(--bg-secondary);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.form-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--primary-color);
  margin-bottom: var(--space-20);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.section-description {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-20);
  line-height: 1.5;
}

/* ===== FORM GROUPS ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
}

.form-row.single {
  grid-template-columns: 1fr;
}

.form-group--double-wide {
  grid-column: span 2;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
}

.form-label.required::after {
  content: " *";
}

input[type="text"].form-input, 
.form-input {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  transition: all 0.3s ease;
  background: var(--bg-white);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(46, 139, 87, 0.1);
}

.form-input.error {
  border-color: var(--danger-color);
}

.form-textarea {
  min-height: var(--space-64);
  resize: vertical;
}

.form-select {
  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='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right var(--space-12) center;
  background-repeat: no-repeat;
  background-size: var(--space-16) var(--space-16);
  padding-right: var(--space-48);
  appearance: none;
}

/* ===== BUTTON GROUPS ===== */
.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
  margin-top: var(--space-8);
}

.choice-btn {
  padding: var(--space-16) var(--space-24);
  border: 2px solid var(--border-color);
  background: var(--bg-white);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  text-align: center;
  min-width: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
}

.choice-btn:hover {
  border-color: var(--primary-color);
  background: var(--bg-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.choice-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--bg-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.choice-btn input[type="radio"],
.choice-btn input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

/* Button variants */
.choice-btn.yes.active {
  background: var(--success-color);
  border-color: var(--success-color);
}

.choice-btn.no.active {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

.choice-btn.house.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.choice-btn.apartment.active {
  background: #06b6d4;
  border-color: #06b6d4;
}

.choice-btn.own.active {
  background: var(--success-color);
  border-color: var(--success-color);
}

.choice-btn.rent.active {
  background: var(--warning-color);
  border-color: var(--warning-color);
  color: #000;
}

/* ===== NUMBER INPUTS ===== */
.number-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-top: var(--space-8);
}

.number-btn {
  width: var(--space-48);
  height: var(--space-48);
  border: 2px solid var(--border-color);
  background: var(--bg-white);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.number-btn:hover {
  border-color: var(--primary-color);
  background: var(--bg-secondary);
}

.number-btn.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--bg-white);
}

.number-display {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--primary-color);
  min-width: var(--space-32);
  text-align: center;
}

/* ===== PET HISTORY CARDS ===== */
.pet-history-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-20);
  margin-top: var(--space-20);
}

.pet-history-card {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--space-20);
  background: var(--bg-white);
  transition: all 0.3s ease;
}

.pet-history-card.filled {
  border-color: var(--primary-color);
  background: var(--bg-secondary);
}

.pet-history-title {
  font-weight: var(--font-weight-semibold);
  color: var(--primary-color);
  margin-bottom: var(--space-16);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

/* ===== AGREEMENT SECTION ===== */
.agreement-item {
  align-items: flex-start;
  background: var(--bg-white);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-24);
  display: flex;
  gap: var(--space-16);
  margin-bottom: var(--space-20);
  padding: var(--space-16);
}

.agreement-item:last-child {
  margin-bottom: 0;
}

.agreement-checkbox {
  margin-top: var(--space-4);
  transform: scale(1.2);
  accent-color: var(--primary-color);
}

.agreement-text {
  font-size: var(--font-size-sm);
  line-height: 1.6;
  color: var(--text-primary);
}

/* ===== NAVIGATION ===== */
.form-navigation {
  background: var(--bg-secondary);
  padding: var(--space-24);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-btn {
  padding: var(--space-16) var(--space-32);
  border: none;
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-btn.primary {
  background: var(--primary-color);
  color: var(--bg-white);
}

.nav-btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.nav-btn.secondary {
  background: var(--secondary-color);
  color: var(--bg-white);
}

.nav-btn.secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

/* ===== ERROR MESSAGES ===== */
.field-error {
  color: var(--danger-color);
  font-size: var(--font-size-xs);
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.form-errors {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: var(--space-16);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-24);
}

.form-errors ul {
  margin: 0;
  padding-left: var(--space-20);
}

/* ===== PET SELECTION ===== */
.pet-selection-container {
  margin-top: var(--space-24);
}

.current-pet-display {
  background: var(--bg-white);
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  padding: var(--space-20);
  display: flex;
  align-items: center;
  gap: var(--space-16);
  margin-bottom: var(--space-16);
}

.pet-photo-small {
  width: var(--space-64);
  height: var(--space-64);
  border-radius: var(--border-radius);
  object-fit: cover;
  background: var(--bg-secondary);
}

.pet-info-small {
  flex: 1;
}

.pet-name-display {
  font-weight: var(--font-weight-semibold);
  color: var(--primary-color);
  font-size: var(--font-size-lg);
}

.pet-details-display {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

.change-pet-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: var(--font-size-sm);
}

.change-pet-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-color);
}

form {
  margin-bottom: var(--space-40);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .adoption-form-header {
    padding: var(--space-24);
  }
  
  .adoption-form-header h1 {
    font-size: var(--font-size-2xl);
  }
  
  .step-content {
    padding: var(--space-24);
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: var(--space-16);
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .choice-btn {
    width: 100%;
  }
  
  .pet-history-container {
    grid-template-columns: 1fr;
  }
  
  .form-navigation {
    flex-direction: column;
    gap: var(--space-12);
  }
  
  .nav-btn {
    width: 100%;
    justify-content: center;
  }
  
  .current-pet-display {
    flex-direction: column;
    text-align: center;
  }
}

.field-error {
  color: var(--danger-color);
  font-size: var(--font-size-xs);
  margin-top: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-weight: var(--font-weight-medium);
}

.field-error::before {
  content: "⚠️";
  font-size: var(--font-size-sm);
}

.button-group.error {
  border: 2px solid var(--danger-color);
  border-radius: var(--border-radius);
  padding: var(--space-8);
  background: var(--error-bg);
}

.button-group.error .choice-btn {
  border-color: var(--danger-color);
}

.form-errors {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  padding: var(--space-16);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-24);
}

.form-errors ul {
  margin: 0;
  padding-left: var(--space-20);
}


/* CORRECTIONS */


/* ====== FORM LAYOUT NORMALIZATION (keep class names) ====== */

/* 1) Make .form-row behave like .form-grid by default */
.form-row {
  display: grid;
  gap: var(--space-16);
  grid-template-columns: 1fr 1fr;
}
.form-row.single { grid-template-columns: 1fr; }

/* Respect double-wide fields regardless of parent grid */
.form-group--double-wide { grid-column: 1 / -1; }

/* Mobile: single column for both row + grid */
@media (max-width: 768px) {
  .form-row,
  .form-grid { grid-template-columns: 1fr; }
}

/* 2) Make .form-group a consistent field block */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}

/* 3) Style inputs/selects/textarea even if .form-input class is missing */
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-12) var(--space-16);
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font: inherit;
  background: var(--bg-white);
  transition: all 0.3s ease;
  line-height: 1.35;
}
.form-group textarea { min-height: var(--space-64); resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-color: var(--primary-color);
}

/* ====== TOGGLE PILL STYLES (radios + checkboxes) ======
   Works with your existing markup:
   - <div class="checkbox-item"><input ...><label ...></label></div>
   - <div class="radio-item"><input ...><label ...></label></div>
   - .choice-btn (kept for places you already used it)
*/

/* Visually hide native inputs but keep accessibility */
.checkbox-item input[type="checkbox"],
.radio-item    input[type="radio"] {
  position: absolute !important;
  height: 1px; width: 1px;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Base pill style reused for labels */
.checkbox-item > label,
.radio-item > label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}

/* Checked state — adjacent pattern */
.checkbox-item input[type="checkbox"]:checked + label,
.radio-item    input[type="radio"]:checked + label {
  background: var(--primary-color);
  color: var(--bg-white);
  border-color: var(--primary-color);
}

/* Checked state — wrapped/choice-btn pattern (if used) */
.choice-btn.active,
label.choice-btn:has(> input[type="radio"]:checked),
label.choice-btn:has(> input[type="checkbox"]:checked) {
  background: var(--primary-color);
  color: var(--bg-white);
  border-color: var(--primary-color);
}

/* Grouping helpers: reuse your .button-group layout for all groups */
.checkbox-group,
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12);
}

/* Focus visibility (keyboard users) */
.checkbox-item input[type="checkbox"]:focus-visible + label,
.radio-item    input[type="radio"]:focus-visible + label,
.choice-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Optional: small checkmark for checked boxes */
.checkbox-item input[type="checkbox"]:checked + label::before {
  content: "✓";
  font-weight: 700;
  margin-right: 4px;
}

/* ====== BUTTON GROUP ALIGNMENT ====== */
/* Keep your existing .button-group/.choice-btn behavior intact */
.button-group { display: flex; flex-wrap: wrap; gap: var(--space-12); }


/* ===== Volunteer Application pill fixes & left checkboxes ===== */

/* Strengthen pill look for labels in groups (checkboxes + radios) */
.form-section .checkbox-group .checkbox-item > label,
.form-section .radio-group    .radio-item    > label,
.form-section .button-group   .choice-btn,
.form-section .checkbox-item > label.toggle-btn,
.form-section .radio-item    > label.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 9999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
}

/* Make sure groups lay out as pills with spacing */
.form-section .checkbox-group,
.form-section .radio-group,
.form-section .button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ——— Checkbox: add a visible square to the LEFT ——— */
/* Adjacent pattern: input[type=checkbox] + label */
.checkbox-item input[type="checkbox"] + label::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
  transform: translateY(1px);
}

/* Checked state shows a filled box + checkmark; pill also colors */
.checkbox-item input[type="checkbox"]:checked + label::before {
  border-color: var(--primary-color);
  background: var(--primary-color);
  box-shadow: inset 0 0 0 2px #fff;
}
.checkbox-item input[type="checkbox"]:checked + label {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Focus ring for keyboard users on the box */
.checkbox-item input[type="checkbox"]:focus-visible + label::before {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Wrapped pattern: <label class="toggle-btn"><input ...> Text</label> */
label.toggle-btn:has(> input[type="checkbox"])::before {
  content: "";
  width: 1.05em;
  height: 1.05em;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  display: inline-block;
  flex-shrink: 0;
  transform: translateY(1px);
}
label.toggle-btn:has(> input[type="checkbox"]:checked)::before {
  border-color: var(--primary-color);
  background: var(--primary-color);
  box-shadow: inset 0 0 0 2px #fff;
}
label.toggle-btn:has(> input[type="checkbox"]:focus-visible) {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ——— Radio pills (no square box), keep the “selected” fill ——— */
.radio-item input[type="radio"]:checked + label,
label.toggle-btn:has(> input[type="radio"]:checked),
.button-group .choice-btn.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Ensure the native inputs remain accessible but visually hidden */
.checkbox-item input[type="checkbox"],
.radio-item    input[type="radio"] {
  position: absolute !important;
  height: 1px; width: 1px;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(1px,1px,1px,1px);
  clip-path: inset(50%);
  white-space: nowrap;
}
