/* ChurchCRM Family Registration Styles */

.register-box {
  width: 90%;
  margin: 30px auto;
  position: relative;
  z-index: 2;
}

.registration-card {
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.bs-stepper .content {
  padding: 30px;
}

.step-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  margin: 0 -30px 30px -30px;
}

/* Stepper label: visually hide text on very small screens while keeping it
   in the accessibility tree for screen readers */
@media (max-width: 400px) {
  .bs-stepper-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

.step-header h4 {
  color: white;
  margin: 0;
  font-weight: 600;
}

.member-card {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.3s ease-out;
}

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

.member-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.member-card .card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  padding: 12px 20px;
  flex-shrink: 0;
  z-index: 1;
}

.member-card .card-body {
  padding: 20px;
  flex: 1;
  overflow: visible;
  max-height: 2000px;
  transition:
    max-height 0.3s ease,
    opacity 0.3s ease;
  opacity: 1;
}

.member-card .card-body[style*="display: none"] {
  max-height: 0;
  padding: 0 20px;
  opacity: 0;
  overflow: hidden;
}

.member-card-header-clickable {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.member-card-header-clickable:hover {
  background-color: #f0f0fa;
}

.member-toggle-btn {
  font-size: 0.875rem;
  color: #667eea;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.member-toggle-btn:hover {
  color: #667eea;
  text-decoration: none;
}

.member-toggle-btn i {
  transition: transform 0.2s ease;
}

/* Ensure form-row inside member cards behaves as a proper grid */
.member-card .row {
  display: flex;
  flex-wrap: wrap;
}

.member-card .mb-3 {
  margin-bottom: 1rem;
}

/* Column widths — only enforce at md breakpoint and above so they stack on mobile */
@media (min-width: 768px) {
  .member-card .row .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .member-card .row .col-md-7 {
    flex: 0 0 58.333333%;
    max-width: 58.333333%;
  }

  .member-card .row .col-md-5 {
    flex: 0 0 41.666667%;
    max-width: 41.666667%;
  }
}

/* Below md: stack all columns full-width */
@media (max-width: 767.98px) {
  .member-card .row > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Form control styling for member cards */
.member-card .form-control,
.member-card .custom-control-input {
  border-radius: 4px;
  border: 1px solid #ced4da;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
}

.member-card .form-control:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.member-card .input-group-text {
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  border-radius: 4px 0 0 4px;
  color: #667eea;
}

.member-card .mb-3 label {
  font-weight: 500;
  color: #333;
  margin-bottom: 0.5rem;
}

/* Ensure form-row spacing is proper */
.member-card .row {
  margin-bottom: 0;
}

/* Select dropdowns */
.member-card select {
  appearance: none;
  background: white
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E")
    no-repeat right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
}

/* Checkbox styling */
.member-card .custom-control {
  position: relative;
  display: block;
  padding-left: 1.5rem;
}

.member-card .custom-control-input {
  position: absolute;
  left: 0;
  z-index: -1;
  width: 1rem;
  height: 1.25rem;
  opacity: 0;
}

.member-card .custom-control-label {
  position: relative;
  margin-bottom: 0;
  color: #666;
  cursor: pointer;
}

.member-card .custom-control-label::before {
  content: "";
  position: absolute;
  top: 0.25rem;
  left: -1.5rem;
  display: block;
  width: 1rem;
  height: 1rem;
  pointer-events: none;
  border: 1px solid #adb5bd;
  border-radius: 0.25rem;
}

.member-card .custom-checkbox .custom-control-input:checked ~ .custom-control-label::before {
  border-color: #667eea;
  background-color: #667eea;
}

/* Enabled checkbox styling */
.member-card .custom-control-input:not(:disabled) ~ .custom-control-label {
  color: #666;
  cursor: pointer;
  opacity: 1;
  pointer-events: auto;
}

.member-card .custom-control-input:not(:disabled) ~ .custom-control-label::before {
  cursor: pointer;
  pointer-events: auto;
  background-color: white;
}

/* Disabled checkbox styling */
.member-card .custom-control-input:disabled ~ .custom-control-label {
  color: #999;
  cursor: not-allowed;
  opacity: 0.6;
  pointer-events: none;
}

.member-card .custom-control-input:disabled ~ .custom-control-label::before {
  border-color: #ccc;
  background-color: #f5f5f5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Invalid feedback styling */
.member-card .invalid-feedback {
  display: block;
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Focus state for inputs */
.member-card .form-control.is-valid {
  border-color: #28a745;
}

.member-card .form-control.is-valid:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
}

.member-card .form-control.is-invalid {
  border-color: #dc3545;
}

.member-card .form-control.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Add/Remove member buttons */
#add-member-btn {
  margin-bottom: 20px;
  width: 100%;
  transition: all 0.3s ease;
}

#add-member-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.remove-member-btn {
  white-space: nowrap;
  transition: all 0.2s ease;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.remove-member-btn:hover {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

.family-count-badge {
  display: inline-block;
  background-color: #667eea;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  margin-left: 10px;
}

/* Review section styles */
.review-section {
  margin-bottom: 30px;
  padding: 20px;
  background-color: #f8f9fa;
  border-radius: 6px;
  border-left: 4px solid #667eea;
}

.review-section h5 {
  color: #667eea;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
}

.review-section h5 i {
  margin-right: 10px;
  font-size: 1.2em;
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #dee2e6;
}

.review-item:last-child {
  border-bottom: none;
}

.review-item strong {
  color: #333;
}

.review-item span {
  color: #666;
}

.registration-success {
  text-align: center;
  padding: 40px 20px;
}

.registration-success i {
  font-size: 4rem;
  color: #28a745;
  margin-bottom: 20px;
}

.registration-success h3 {
  color: #28a745;
  margin-bottom: 10px;
}

.registration-success p {
  color: #666;
  margin-bottom: 20px;
}

.registration-error {
  text-align: center;
  padding: 40px 20px;
}

.registration-error i {
  font-size: 4rem;
  color: #dc3545;
  margin-bottom: 20px;
}

.registration-error h3 {
  color: #dc3545;
  margin-bottom: 10px;
}

.registration-error p {
  color: #666;
  margin-bottom: 20px;
}

/* ── Mobile Responsive Overrides ───────────────────────────────── */
@media (max-width: 767.98px) {
  .register-box {
    width: 100%;
    max-width: 100%;
    padding: 0 12px;
    margin: 16px auto;
  }

  .bs-stepper .content {
    padding: 16px;
  }

  .step-header {
    margin: 0 -16px 20px -16px;
    padding: 16px;
  }

  .step-header h4 {
    font-size: 1rem;
  }

  .step-header p {
    font-size: 0.8rem;
  }

  /* Prevent iOS auto-zoom on input focus */
  .member-card .form-control,
  .member-card .form-select,
  .register-box .form-control,
  .register-box .form-select {
    font-size: 16px;
  }

  /* Member card spacing */
  .member-card .card-header {
    padding: 10px 14px;
  }

  .member-card .card-body {
    padding: 14px;
  }

  .member-card h5 {
    font-size: 0.9rem;
  }

  /* Phone input: stack "No format" checkbox on its own row below the input */
  .member-card .input-group {
    flex-wrap: wrap;
  }

  .member-card .input-group > .input-group-text:last-child {
    flex: 0 0 100%;
    width: 100%;
    border-top: 1px solid #ced4da;
    border-left: 1px solid #ced4da;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    font-size: 0.8rem;
  }

  /* Nav buttons: full-width stacked on mobile */
  .bs-stepper .content > .mb-3:last-child {
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
  }

  .bs-stepper .content > .mb-3:last-child .btn {
    width: 100%;
    margin-right: 0;
  }

  /* Family count badge */
  .family-count-badge {
    padding: 4px 10px;
    font-size: 12px;
  }

  /* Review cards */
  .register-box .card-body {
    padding: 16px;
  }

  /* Register logo */
  .register-logo {
    margin-bottom: 12px;
  }

  .register-logo .h2,
  .register-logo a {
    font-size: 1.25rem;
  }
}
