/* ================================================================
   APPOINTMENT MODAL — Medhas Law
   Premium navy / white / ivory / champagne-gold theme.
   Reuses existing CSS custom properties from styles.css.
================================================================ */

/* ── Backdrop ────────────────────────────────────────────────── */
.apt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 46, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  overflow-y: auto;
}

.apt-modal-backdrop.apt-open {
  opacity: 1;
  visibility: visible;
}

/* ── Modal box ───────────────────────────────────────────────── */
.apt-modal {
  position: relative;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28), 0 4px 16px rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: 660px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.34, 1.30, 0.64, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.apt-modal::-webkit-scrollbar { width: 5px; }
.apt-modal::-webkit-scrollbar-track { background: transparent; }
.apt-modal::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 10px; }

.apt-modal-backdrop.apt-open .apt-modal {
  transform: scale(1) translateY(0);
}

/* ── Modal header ────────────────────────────────────────────── */
.apt-modal-head {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 100%);
  padding: 28px 32px 24px;
  border-radius: 14px 14px 0 0;
  position: relative;
}

.apt-modal-eyebrow {
  display: block;
  font-size: 0.70rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.apt-modal-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.2;
  margin: 0 0 6px;
}

.apt-modal-subtitle {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  line-height: 1.55;
}

/* ── Close button ────────────────────────────────────────────── */
.apt-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.80);
  transition: background 0.18s, color 0.18s, transform 0.18s;
  flex-shrink: 0;
}

.apt-modal-close:hover,
.apt-modal-close:focus-visible {
  background: rgba(196, 154, 82, 0.24);
  color: var(--gold);
  transform: scale(1.08);
  outline: none;
}

/* ── Modal body / form ───────────────────────────────────────── */
.apt-modal-body {
  padding: 28px 32px 32px;
  background: #FFFFFF;
  border-radius: 0 0 14px 14px;
}

/* Reuse the contact.css field layout pattern */
.apt-form-row {
  margin-bottom: 16px;
}

.apt-form-row--2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.apt-field-group {
  display: flex;
  flex-direction: column;
}

.apt-label {
  font-size: 0.80rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.02em;
  margin-bottom: 5px;
}

.apt-required {
  color: var(--gold-dark);
  margin-left: 2px;
}

.apt-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #D8D5CE;
  border-radius: 7px;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-dark);
  background: var(--ivory);
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.apt-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196, 154, 82, 0.15);
  background: #FFFFFF;
}

.apt-input--error {
  border-color: #C0392B !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12) !important;
}

.apt-select-wrap {
  position: relative;
}

.apt-select-wrap select.apt-input {
  padding-right: 36px;
  cursor: pointer;
}

.apt-select-chevron {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-light);
}

textarea.apt-input {
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
}

.apt-field-error {
  font-size: 0.76rem;
  color: #C0392B;
  margin-top: 3px;
  min-height: 1em;
}

/* ── Radio group ─────────────────────────────────────────────── */
.apt-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.apt-radio-group {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.apt-radio-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.875rem;
  color: var(--text-mid);
  cursor: pointer;
}

.apt-radio {
  accent-color: var(--gold);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Consent checkbox ────────────────────────────────────────── */
.apt-consent-group {
  background: var(--ivory);
  border: 1px solid #E5E1D8;
  border-radius: 8px;
  padding: 13px 14px;
}

.apt-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  position: relative;
}

.apt-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.apt-checkbox-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1.5px solid #C8C3B8;
  border-radius: 4px;
  background: #FFFFFF;
  margin-top: 2px;
  transition: border-color 0.18s, background 0.18s;
}

.apt-checkbox:checked + .apt-checkbox-custom {
  background: var(--gold);
  border-color: var(--gold);
}

.apt-checkbox:checked + .apt-checkbox-custom::after {
  content: '';
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #FFFFFF;
  border-top: none;
  border-left: none;
  transform: rotate(42deg) translate(-1px, -1px);
}

.apt-checkbox:focus-visible + .apt-checkbox-custom {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.apt-checkbox-text {
  font-size: 0.78rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ── Submit button ───────────────────────────────────────────── */
.apt-submit-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gold);
  color: #FFFFFF;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 13px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-top: 4px;
}

.apt-submit-btn:hover:not(:disabled) {
  background: var(--gold-dark);
  box-shadow: 0 4px 18px rgba(196, 154, 82, 0.40);
  transform: translateY(-1px);
}

.apt-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ── Feedback Banners (Success & Error Notifications) ────────── */
.apt-feedback-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 9px;
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.apt-feedback-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.apt-feedback-content {
  flex: 1;
}

.apt-feedback-title {
  margin: 0 0 3px 0;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.35;
}

.apt-feedback-desc {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Success Banner */
.apt-feedback-success {
  background: #F0FAF4;
  border: 1.5px solid #22c55e;
}
.apt-feedback-success .apt-feedback-icon svg {
  color: #16a34a;
}
.apt-feedback-success .apt-feedback-title {
  color: #14532d;
}
.apt-feedback-success .apt-feedback-desc {
  color: #166534;
}

/* Error Banner */
.apt-feedback-error {
  background: #fef2f2;
  border: 1.5px solid #ef4444;
}
.apt-feedback-error .apt-feedback-icon svg {
  color: #dc2626;
}
.apt-feedback-error .apt-feedback-title {
  color: #7f1d1d;
}
.apt-feedback-error .apt-feedback-desc {
  color: #991b1b;
}

/* ── Success message (legacy support) ────────────────────────── */
.apt-success-msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #F0FAF4;
  border: 1.5px solid #48BB78;
  border-radius: 9px;
  padding: 16px 18px;
  margin-top: 8px;
}

.apt-success-msg svg {
  color: #2F855A;
  flex-shrink: 0;
  margin-top: 2px;
}

.apt-success-msg p {
  font-size: 0.875rem;
  color: #22543D;
  margin: 0;
  line-height: 1.6;
}

.apt-form-notice {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 0.74rem;
  color: var(--text-light);
  line-height: 1.55;
  margin-top: 14px;
}

.apt-form-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-light);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  .apt-modal-head {
    padding: 22px 20px 20px;
  }

  .apt-modal-body {
    padding: 20px 18px 24px;
  }

  .apt-modal-title {
    font-size: 1.30rem;
  }

  .apt-form-row--2 {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
