/*
 * DCR Web Portal — Global Sample Request Modal
 * rd-sq-* classes used by #gsm-modal (footer-injected) and #rd-sample-modal (report-description page).
 * Loaded globally via footer.php so the modal works on every page.
 */

/* ── OVERLAY ─────────────────────────────────────────────────────────────────── */

.rd-sq-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(6,15,40,0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: rdFadeIn 0.2s ease;
}
.rd-sq-overlay[hidden] { display: none; }
@keyframes rdFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── PANEL ───────────────────────────────────────────────────────────────────── */

.rd-sq-panel {
  background: var(--white); border-radius: 14px;
  width: 60%; max-width: 860px; max-height: 90vh;
  overflow-y: auto; padding: 28px 28px 24px;
  position: relative;
  animation: rdSlideUp 0.22s ease;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
@keyframes rdSlideUp { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── CLOSE BUTTON ────────────────────────────────────────────────────────────── */

.rd-sq-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--page-bg); cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background 0.15s;
}
.rd-sq-close:hover { background: var(--card-border); }
.rd-sq-close svg { width: 16px; height: 16px; stroke: var(--text-mid); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── HEADER ──────────────────────────────────────────────────────────────────── */

.rd-sq-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--card-border); }
.rd-sq-header-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--tint-navy); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rd-sq-header-icon svg { width: 18px; height: 18px; stroke: var(--navy); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rd-sq-title { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text-dark); margin: 0 0 4px; }
.rd-sq-subtitle { font-size: var(--text-xs); color: var(--text-muted); margin: 0; }
.rd-sq-subtitle span { color: var(--av-red); }

/* ── FORM GRID ───────────────────────────────────────────────────────────────── */

.rd-sq-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.rd-sq-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.rd-sq-field.rd-sq-full { grid-column: 1 / -1; }
.rd-sq-label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-dark); }
.rd-sq-label span { color: var(--av-red); margin-left: 2px; }

/* ── INPUTS ──────────────────────────────────────────────────────────────────── */

.rd-sq-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--card-border);
  border-radius: 7px; font-size: var(--text-sm); font-family: var(--font-sans);
  color: var(--text-dark); background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.rd-sq-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(13,71,161,0.10); }
.rd-sq-input:focus::placeholder { opacity: 0; transition: opacity 0.15s; }
.rd-sq-input.rd-sq-invalid { border-color: var(--av-red); box-shadow: 0 0 0 3px rgba(244,67,54,0.10); }
textarea.rd-sq-input { resize: vertical; min-height: 88px; line-height: var(--lh-normal); }

/* ── PHONE SPLIT ─────────────────────────────────────────────────────────────── */

.rd-sq-phone-wrap { display: flex; gap: 8px; }
.rd-sq-phone-code { width: 200px; flex-shrink: 0; padding-right: 6px; }
.rd-sq-phone-num  { flex: 1; }

/* ── ERROR MESSAGES ──────────────────────────────────────────────────────────── */

.rd-sq-error { font-size: var(--text-xs); color: var(--av-red); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.rd-sq-error[hidden] { display: none; }

/* ── CAPTCHA ─────────────────────────────────────────────────────────────────── */

.rd-sq-captcha-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-sq-captcha-canvas { border: 1.5px solid var(--card-border); border-radius: 6px; background: var(--page-bg); display: block; }
.rd-sq-captcha-refresh {
  width: 36px; height: 36px; border-radius: 7px; border: 1.5px solid var(--card-border);
  background: var(--page-bg); cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}
.rd-sq-captcha-refresh:hover { border-color: var(--navy); background: var(--tint-navy); }
.rd-sq-captcha-refresh svg { width: 16px; height: 16px; stroke: var(--navy); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rd-sq-captcha-input-wrap { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.rd-sq-captcha-label { font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--text-dark); }
.rd-sq-captcha-input { font-size: var(--text-sm); letter-spacing: 2px; }

/* ── SUBMIT ROW ──────────────────────────────────────────────────────────────── */

.rd-sq-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid var(--card-border); flex-wrap: wrap; }
.rd-sq-privacy-note { display: flex; align-items: flex-start; gap: 6px; font-size: 11px; color: var(--text-muted); max-width: 340px; line-height: var(--lh-normal); margin: 0; flex: 1; }
.rd-sq-privacy-note svg { width: 12px; height: 12px; stroke: var(--av-teal); fill: none; flex-shrink: 0; margin-top: 1px; }
.rd-sq-submit-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 26px; background: var(--navy); color: var(--white);
  border: none; border-radius: 8px; font-size: var(--text-sm);
  font-weight: var(--fw-bold); cursor: pointer; font-family: var(--font-sans);
  transition: background 0.18s, transform 0.15s;
  white-space: nowrap;
}
.rd-sq-submit-btn:hover { background: var(--blue); transform: translateY(-1px); }
.rd-sq-submit-btn:disabled { background: var(--text-muted); cursor: not-allowed; transform: none; }
.rd-sq-submit-btn svg { width: 14px; height: 14px; stroke: var(--white); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── SUCCESS STATE ───────────────────────────────────────────────────────────── */

.rd-sq-success {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 20px; text-align: center;
}
.rd-sq-success-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--tint-teal); display: flex; align-items: center; justify-content: center; }
.rd-sq-success-icon svg { width: 26px; height: 26px; stroke: var(--av-teal); fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rd-sq-success h4 { font-size: var(--text-lg); font-weight: var(--fw-bold); color: var(--text-dark); margin: 0; }
.rd-sq-success p { font-size: var(--text-sm); color: var(--text-mid); margin: 0; max-width: 380px; line-height: var(--lh-loose); text-align: center; }
.rd-sq-success-meta { width: 100%; max-width: 420px; background: var(--page-bg); border: 1px solid var(--card-border); border-radius: 10px; text-align: left; overflow: hidden; }
.rd-sq-success-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--card-border); font-size: var(--text-sm); color: var(--text-mid); line-height: 1.5; }
.rd-sq-success-row:last-child { border-bottom: none; }
.rd-sq-success-row svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; stroke: var(--av-teal); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rd-sq-success-row strong { color: var(--text-dark); font-weight: var(--fw-semibold); }

/* ── EMAIL PREVIEW BUTTON (post-submit success state) ───────────────────────── */

.rd-sq-preview-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border: 1.5px solid var(--navy); border-radius: 7px;
  background: transparent; color: var(--navy); font-size: var(--text-sm);
  font-weight: var(--fw-semibold); cursor: pointer; font-family: var(--font-sans);
  margin-top: 8px; transition: background 0.15s;
}
.rd-sq-preview-btn:hover { background: var(--tint-navy); }
.rd-sq-preview-btn svg { width: 14px; height: 14px; stroke: var(--navy); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── EMAIL PREVIEW PANEL (shown after submit, contains rendered email) ───────── */

.rd-ep-panel { max-width: 640px; }
.rd-ep-email-frame {
  border: 1px solid var(--card-border); border-radius: 8px; overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; color: #333;
  max-height: 70vh; overflow-y: auto;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
  .rd-sq-panel { width: 92%; }
}
@media (max-width: 640px) {
  .rd-sq-row { grid-template-columns: 1fr; }
  .rd-sq-panel { width: 95%; padding: 20px 16px 18px; }
  .rd-sq-submit-row { flex-direction: column; align-items: stretch; }
  .rd-sq-submit-btn { justify-content: center; }
  .rd-sq-phone-wrap { flex-direction: column; }
  .rd-sq-phone-code { width: 100%; }
}
