/* ═══════════════════════════════════════════════════════════
   C to C Title Solutions — Commission Disbursement Portal
   styles.css
═══════════════════════════════════════════════════════════ */

/* ─── CSS CUSTOM PROPERTIES ─────────────────────────────── */
:root {
  --teal:        #4A9F9E;
  --teal-dark:   #3a8080;
  --teal-mid:    #5DAEAE;
  --teal-pale:   #e8f5f5;
  --teal-bg:     #f0fafa;
  --dark:        #0d2424;
  --dark-2:      #0e2e2e;
  --gray-900:    #1a1a1a;
  --gray-700:    #4a4a4a;
  --gray-500:    #6b7280;
  --gray-300:    #d1d5db;
  --gray-100:    #f3f4f6;
  --white:       #ffffff;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --green:       #16a34a;
  --green-bg:    #f0fdf4;
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:   0 8px 32px rgba(74,159,158,0.14);
  --radius:      14px;
  --radius-sm:   8px;
  --transition:  0.22s ease;
}

/* ─── RESET & BASE ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--teal-bg);
  color: var(--gray-700);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── HEADER ────────────────────────────────────────────── */
.portal-header {
  background: linear-gradient(135deg, #081818 0%, #0d2424 50%, #0a1e1e 100%);
  padding: 32px 24px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.portal-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -30%, rgba(74,159,158,0.22) 0%, transparent 60%);
  pointer-events: none;
}

.portal-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--teal-mid), var(--teal), transparent);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}

.logo-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.logo-company {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1.1;
}

.logo-tagline {
  font-size: 10px;
  font-weight: 600;
  color: var(--teal-mid);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-title-block h1 {
  font-size: clamp(18px, 3.5vw, 26px);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.25;
  position: relative;
}

.header-title-block p {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  margin-top: 8px;
  position: relative;
}

/* ─── MAIN LAYOUT ───────────────────────────────────────── */
.portal-main {
  padding: 32px 16px 56px;
}

.form-container {
  max-width: 860px;
  margin: 0 auto;
}

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

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

.card-header {
  background: linear-gradient(90deg, #0a1e1e, #0d2828);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--teal);
}

.sec-badge {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(74,159,158,0.4);
}

.sec-badge.alt {
  background: linear-gradient(135deg, #5b7a9e, #4a6b8a);
  box-shadow: 0 2px 8px rgba(74,107,138,0.4);
}

.sec-label { flex: 1; }

.sec-label h2 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.sec-label p {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  margin-top: 1px;
}

.sec-icon {
  font-size: 20px;
  opacity: 0.75;
}

.card-body {
  padding: 22px 24px;
}

/* ─── FORM GRID ─────────────────────────────────────────── */
.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.form-grid.three-col {
  grid-template-columns: 1fr 1fr 1fr;
}

.full-width {
  grid-column: 1 / -1;
}

.two-small {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 640px) {
  .form-grid.two-col,
  .form-grid.three-col { grid-template-columns: 1fr; }
  .full-width { grid-column: 1; }
  .two-small { grid-template-columns: 80px 1fr; }
}

/* ─── FIELD ─────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.req {
  color: var(--teal);
  font-weight: 700;
}

.auto-label {
  background: rgba(74,159,158,0.12);
  color: var(--teal-dark);
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
  font-weight: 700;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--gray-900);
  background: #fafcfc;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(74,159,158,0.14);
}

.field input[readonly] {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
  border-color: var(--gray-300);
}

.field input.input-error,
.field select.input-error {
  border-color: var(--red);
  background: var(--red-bg);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.08);
}

.field-error {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
  min-height: 16px;
  display: block;
}

.field-hint {
  font-size: 10.5px;
  color: var(--gray-500);
  line-height: 1.4;
}

/* ─── INPUT WITH PREFIX ($) ─────────────────────────────── */
.input-prefix-wrap {
  position: relative;
}

.input-prefix {
  position: absolute;
  top: 50%;
  left: 11px;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 700;
  color: var(--teal);
  pointer-events: none;
  font-family: 'Courier New', monospace;
}

.input-prefix-wrap input {
  padding-left: 24px;
  font-family: 'Courier New', monospace;
}

.input-prefix-wrap input[readonly] {
  font-family: 'Courier New', monospace;
  color: var(--teal-dark);
  font-weight: 600;
}

/* ─── RADIO CARDS ───────────────────────────────────────── */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-card {
  display: block;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-300);
  background: #fafcfc;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.radio-card input[type="radio"] {
  display: none;
}

.radio-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
}

.radio-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.radio-card-inner > div {
  flex: 1;
}

.radio-card-inner strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 2px;
}

.radio-card-inner span {
  font-size: 12px;
  color: var(--gray-500);
}

.radio-check-mark {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  flex-shrink: 0;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.radio-check-mark::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--transition);
}

/* Selected state */
.radio-card:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-pale);
  box-shadow: 0 2px 10px rgba(74,159,158,0.15);
}

.radio-card:has(input:checked) .radio-check-mark {
  background: var(--teal);
  border-color: var(--teal);
}

.radio-card:has(input:checked) .radio-check-mark::after {
  transform: translate(-50%, -50%) scale(1);
}

.radio-card:has(input:checked) .radio-card-inner strong {
  color: var(--teal-dark);
}

.radio-card:hover:not(:has(input:checked)) {
  border-color: var(--teal-mid);
  background: #f5fbfb;
}

/* ─── CONDITIONAL SECTIONS ──────────────────────────────── */
.conditional-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin-bottom 0.3s ease;
  pointer-events: none;
}

.conditional-section.visible {
  max-height: 700px;
  opacity: 1;
  margin-bottom: 20px;
  pointer-events: all;
}

/* ─── WIRE NOTICE ───────────────────────────────────────── */
.wire-notice {
  display: flex;
  gap: 12px;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.wire-notice-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.wire-notice p {
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}

/* ─── CHECKBOX CARD ─────────────────────────────────────── */
.checkbox-card {
  display: block;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-300);
  background: #fafcfc;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 6px;
}

.checkbox-card input[type="checkbox"] {
  display: none;
}

.checkbox-card-inner {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  align-items: flex-start;
}

.checkbox-box {
  width: 22px;
  height: 22px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: border-color var(--transition), background var(--transition);
  margin-top: 1px;
}

.check-svg {
  opacity: 0;
  transition: opacity var(--transition);
}

.checkbox-card-inner p {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.6;
}

.checkbox-card:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.checkbox-card:has(input:checked) .checkbox-box {
  background: var(--teal);
  border-color: var(--teal);
}

.checkbox-card:has(input:checked) .check-svg {
  opacity: 1;
}

.checkbox-error {
  display: block;
  margin-top: 4px;
  padding-left: 2px;
}

/* ─── SIGNATURE SECTION ─────────────────────────────────── */
.signature-input {
  font-family: 'Georgia', 'Times New Roman', serif !important;
  font-size: 18px !important;
  font-style: italic;
  color: #1a3a6e !important;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--teal) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding-left: 4px !important;
}

.signature-input:focus {
  box-shadow: none !important;
  border-bottom-color: var(--teal-dark) !important;
}

.readonly-date {
  font-weight: 600;
  color: var(--gray-500) !important;
  font-size: 13px !important;
}

/* ─── SUBMIT AREA ───────────────────────────────────────── */
.submit-row {
  text-align: center;
  padding: 8px 0 16px;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 16px 48px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(74,159,158,0.38);
  transition: all var(--transition);
  margin-bottom: 14px;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(74,159,158,0.5);
}

.btn-submit:active {
  transform: translateY(0);
}

.btn-submit .btn-icon {
  font-size: 18px;
}

.submit-note {
  font-size: 12px;
  color: var(--gray-500);
}

/* ─── SUCCESS SCREEN ────────────────────────────────────── */
.success-screen {
  text-align: center;
  padding: 20px 0;
}

.success-screen.hidden {
  display: none;
}

.success-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1.5px solid rgba(22,163,74,0.2);
  padding: 48px 40px;
  max-width: 620px;
  margin: 0 auto;
  animation: fadeSlideUp 0.45s ease forwards;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.success-icon-wrap {
  margin-bottom: 20px;
}

.success-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 12px;
}

.success-main-msg {
  font-size: 15px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 24px;
}

.success-summary {
  background: var(--teal-pale);
  border: 1px solid rgba(74,159,158,0.25);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  text-align: left;
  margin-bottom: 20px;
}

.success-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid rgba(74,159,158,0.1);
  font-size: 13px;
  gap: 12px;
}

.success-summary .summary-row:last-child {
  border-bottom: none;
}

.summary-row .label {
  color: var(--gray-500);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.6px;
  min-width: 130px;
}

.summary-row .value {
  color: var(--gray-900);
  font-weight: 600;
  text-align: right;
}

.success-note {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.6;
  margin-bottom: 28px;
}

.success-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-new {
  background: none;
  border: 2px solid var(--teal);
  color: var(--teal-dark);
  border-radius: 50px;
  padding: 12px 28px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.btn-new:hover {
  background: var(--teal);
  color: #fff;
}

/* ─── FOOTER ────────────────────────────────────────────── */
.portal-footer {
  background: var(--dark);
  padding: 20px 24px;
  text-align: center;
  border-top: 2px solid var(--teal);
}

.footer-inner p {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  line-height: 1.8;
}

.footer-inner p strong {
  color: rgba(255,255,255,0.7);
}

/* ─── ERROR BANNER (global form error) ──────────────────── */
.error-banner {
  background: var(--red-bg);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--red);
  font-weight: 600;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  60%       { transform: translateX(5px); }
}

/* ─── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 580px) {
  .portal-header { padding: 24px 16px 20px; }
  .logo-block { gap: 10px; }
  .logo-company { font-size: 15px; }
  .header-title-block h1 { font-size: 17px; }
  .card-body { padding: 16px; }
  .card-header { padding: 12px 16px; gap: 10px; }
  .sec-label h2 { font-size: 13px; }
  .sec-icon { display: none; }
  .radio-card-inner { padding: 12px 14px; gap: 10px; }
  .radio-icon { font-size: 18px; }
  .btn-submit { padding: 14px 32px; font-size: 14px; }
  .success-card { padding: 32px 20px; }
  .success-card h2 { font-size: 18px; }
  .signature-input { font-size: 16px !important; }
}

@media (max-width: 400px) {
  .form-grid.two-col { grid-template-columns: 1fr; }
  .two-small { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════
   PDF PREVIEW MODAL — Document Preview Section
   Opens automatically after a valid form submission.
   The overlay dims the page, the modal contains:
     • Dark header with title
     • iframe showing the generated PDF
     • Action bar with Download and Close buttons
═══════════════════════════════════════════════════════════ */

/* ─── OVERLAY (full-screen backdrop) ────────────────────── */
.pdf-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInOverlay 0.25s ease;
}

.pdf-preview-overlay.hidden {
  display: none;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── MODAL CONTAINER ───────────────────────────────────── */
.pdf-preview-modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.45);
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUpModal 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes slideUpModal {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── MODAL HEADER ──────────────────────────────────────── */
.pdf-preview-header {
  background: linear-gradient(90deg, #081818, #0d2828);
  padding: 16px 22px;
  border-bottom: 2px solid var(--teal);
  flex-shrink: 0;
}

.preview-title-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-header-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.pdf-preview-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.2px;
  margin: 0;
}

.pdf-preview-header p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 3px;
}

/* ─── MODAL BODY (PDF VIEWER AREA) ─────────────────────── */
/*
 * This section holds the <iframe> that renders the PDF.
 * flex:1 + min-height:0 allows it to shrink inside the
 * flex column so the footer always stays visible.
 */
.pdf-preview-body {
  flex: 1;
  min-height: 0;
  background: #d1d5db;
  position: relative;
  overflow: hidden;
}

/* Loading indicator shown while iframe is loading */
.pdf-preview-body::before {
  content: 'Loading preview…';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--gray-500);
  font-style: italic;
  pointer-events: none;
  z-index: 0;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  min-height: 520px;
  border: none;
  display: block;
  position: relative;
  z-index: 1;
}

/* ─── MODAL FOOTER (action buttons) ────────────────────── */
.pdf-preview-footer {
  background: var(--white);
  border-top: 1.5px solid var(--gray-300);
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Download PDF — primary action */
.btn-download-pdf {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 32px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 4px 16px rgba(74, 159, 158, 0.42);
  transition: all var(--transition);
  font-family: inherit;
}

.btn-download-pdf:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(74, 159, 158, 0.55);
}

.btn-download-pdf:active {
  transform: translateY(0);
}

.btn-download-pdf .btn-icon {
  font-size: 16px;
}

/* Close Preview — secondary action */
.btn-close-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 2px solid var(--gray-300);
  color: var(--gray-700);
  border-radius: 50px;
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.2px;
}

.btn-close-preview:hover {
  border-color: #b91c1c;
  color: #b91c1c;
  background: #fef2f2;
}

/* ─── RESPONSIVE ADJUSTMENTS ────────────────────────────── */
@media (max-width: 640px) {
  .pdf-preview-overlay {
    padding: 8px;
  }
  .pdf-preview-modal {
    max-height: 96vh;
    border-radius: 10px;
  }
  .pdf-iframe {
    min-height: 380px;
  }
  .pdf-preview-footer {
    padding: 12px 16px;
    gap: 10px;
  }
  .btn-download-pdf,
  .btn-close-preview {
    padding: 11px 22px;
    font-size: 13px;
  }
  .preview-header-icon {
    font-size: 22px;
  }
  .pdf-preview-header h2 {
    font-size: 13px;
  }
}

@media (max-width: 400px) {
  .btn-download-pdf,
  .btn-close-preview {
    width: 100%;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════
   SIGNATURE PAD SECTION
   ──────────────────────
   Styles for the canvas-based drawing area in Section 7.
   The canvas pixel buffer is sized by signature.js; we only
   define the CSS (display) dimensions here.
═══════════════════════════════════════════════════════════ */

/* ─── Wrapper for the entire pad component ──────────────── */
.sig-pad-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── Label row: title on left, buttons on right ────────── */
.sig-pad-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.sig-pad-label-row > label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ─── Control buttons (Clear / Save) ────────────────────── */
.sig-pad-controls {
  display: flex;
  gap: 8px;
}

.btn-sig-clear,
.btn-sig-save {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1;
}

.btn-sig-clear {
  background: none;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-500);
}

.btn-sig-clear:hover {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-bg);
}

.btn-sig-save {
  background: var(--teal-pale);
  border: 1.5px solid var(--teal);
  color: var(--teal-dark);
}

.btn-sig-save:hover {
  background: var(--teal);
  color: #fff;
}

/* ─── Canvas container ──────────────────────────────────── */
.sig-canvas-container {
  position: relative;
  border-radius: var(--radius-sm);
  border: 2px dashed var(--gray-300);
  background: #fafcfc;
  overflow: hidden;
  transition: border-color var(--transition), border-style var(--transition),
              background var(--transition), box-shadow var(--transition);
}

/* While the user is actively drawing */
.sig-canvas-container.active {
  border-color: var(--teal);
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(74, 159, 158, 0.14);
}

/* Once at least one stroke has been drawn */
.sig-canvas-container.signed {
  border-color: var(--teal);
  border-style: solid;
  background: #fff;
}

/* Validation error state */
.sig-canvas-container.has-error {
  border-color: var(--red);
  border-style: solid;
  background: var(--red-bg);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

/* ─── The canvas element itself ─────────────────────────── */
/*
 * width: 100% makes the canvas fill its container CSS-wise.
 * The actual pixel buffer is set programmatically in signature.js
 * by reading offsetWidth/Height × devicePixelRatio.
 */
.sig-canvas {
  display: block;
  width: 100%;
  height: 150px;
  cursor: crosshair;
  touch-action: none; /* prevents scroll-interference on touch devices */
}

/* ─── "Sign here" hint text ─────────────────────────────── */
.sig-canvas-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--gray-300);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
  transition: opacity 0.3s ease;
  user-select: none;
}

/* Hide hint once any strokes have been drawn */
.sig-canvas-container.signed .sig-canvas-hint {
  opacity: 0;
}

/* ─── "Signature saved" confirmation badge ──────────────── */
.sig-saved-indicator {
  display: none;            /* toggled to flex by saveSignaturePad() */
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive adjustments ────────────────────────────── */
@media (max-width: 580px) {
  .sig-pad-label-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .sig-canvas {
    height: 120px;
  }
}


/* ═══════════════════════════════════════════════════════════
   SEND DOCUMENT BUTTON
   (in PDF preview modal footer, primary action)
═══════════════════════════════════════════════════════════ */

.btn-send-document {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, #0d2424, #1a4040);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 13px 32px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 4px 16px rgba(13, 36, 36, 0.35);
  transition: all var(--transition);
  font-family: inherit;
}

.btn-send-document:hover:not(:disabled) {
  background: linear-gradient(135deg, #163434, #204848);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(13, 36, 36, 0.45);
}

.btn-send-document:active {
  transform: translateY(0);
}

.btn-send-document:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-send-document .btn-icon {
  font-size: 16px;
}


/* ═══════════════════════════════════════════════════════════
   SEND CONFIRMATION BANNER
   ────────────────────────
   Shown inside the PDF preview modal footer after a send
   attempt. Green = success, Red = failure.
   Revealed by showSendConfirmation() in script.js.
═══════════════════════════════════════════════════════════ */

.send-confirmation {
  width: 100%;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeInConfirm 0.35s ease;
  margin-top: 4px;
}

.send-confirmation.hidden {
  display: none;
}

@keyframes fadeInConfirm {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Success state */
.send-confirmation.success {
  background: var(--green-bg);
  border: 1.5px solid rgba(22, 163, 74, 0.35);
  color: #15803d;
}

/* Failure state */
.send-confirmation.failure {
  background: var(--red-bg);
  border: 1.5px solid rgba(220, 38, 38, 0.3);
  color: var(--red);
}

.send-confirmation-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

@media (max-width: 580px) {
  .btn-send-document {
    padding: 11px 22px;
    font-size: 13px;
  }
}

@media (max-width: 400px) {
  .btn-send-document {
    width: 100%;
    justify-content: center;
  }
}


/* ═══════════════════════════════════════════════════════════
   SIGNATURE METADATA STRIP
   ────────────────────────
   Shown below the signature canvas after the user clicks
   "Save Signature". Displays signing timestamp, IP address,
   and electronic signature confirmation.

   Populated by updateMetadataStrip() in signature.js.
   Hidden by default; revealed by adding .visible class.
═══════════════════════════════════════════════════════════ */

.sig-metadata-strip {
  display: none;                  /* hidden until .visible is added */
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 14px;
  margin-top: 10px;
  background: linear-gradient(135deg, #f0fdf4, #f0f9f9);
  border: 1.5px solid rgba(22, 163, 74, 0.28);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #155e38;
  line-height: 1.4;
  animation: fadeInMeta 0.4s ease;
}

.sig-metadata-strip.visible {
  display: flex;
}

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

/* Lock icon on the left */
.meta-lock {
  color: #16a34a;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 1px;
}

/* Individual metadata items */
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: #166534;
}

.meta-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: #16a34a;
}

/* Separator dots between items */
.meta-sep {
  color: #86efac;
  font-size: 14px;
  line-height: 1;
}

/* IP address item — slightly different tint */
.meta-ip {
  color: #1e5a8c;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
}

/* Confirmation badge */
.meta-confirmed {
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.3);
  border-radius: 50px;
  padding: 1px 8px 1px 5px;
  font-weight: 600;
  font-size: 11px;
  color: #15803d;
}

/* ── Mobile metadata strip ─ */
@media (max-width: 600px) {
  .sig-metadata-strip {
    font-size: 11px;
    padding: 8px 11px;
    gap: 6px 8px;
  }
  .meta-item {
    font-size: 10.5px;
  }
}


/* ═══════════════════════════════════════════════════════════
   ELECTRONIC SIGNATURE DISCLOSURE
   ────────────────────────────────
   Small notice below the printed name fields informing
   the user that they are signing electronically.
═══════════════════════════════════════════════════════════ */

.esig-disclosure {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 14px;
  background: #f8f9fa;
  border: 1px solid #e2e8f0;
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 11.5px;
  color: var(--gray);
  line-height: 1.55;
}

.esig-disclosure svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--teal);
}

.esig-disclosure strong {
  color: var(--dark);
}


/* ═══════════════════════════════════════════════════════════
   AUDIT LOG PANEL  (Success Screen)
   ───────────────────────────────────
   Shown in the success screen after form submission. Provides
   a live preview of the Document Activity Record before the
   user downloads or sends the PDF. The full table with IP
   address and system info is on Page 2 of the PDF.

   Structure:
     .audit-log-section   — outer container (hidden by default)
     .audit-log-header    — title row with icon + "Page 2" badge
     .audit-log-entries   — container for .audit-entry rows
     .audit-entry         — single event row
     .audit-log-note      — footer note about PDF page 2
═══════════════════════════════════════════════════════════ */

.audit-log-section {
  margin: 20px 0 4px;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.audit-log-section.hidden {
  display: none;
}

/* ── Header bar ── */
.audit-log-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--dark), #1a3a3a);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.audit-log-header svg {
  flex-shrink: 0;
  opacity: 0.85;
}

/* "Included on PDF Page 2" badge */
.audit-log-badge {
  margin-left: auto;
  padding: 2px 9px;
  background: rgba(74, 159, 158, 0.25);
  border: 1px solid rgba(74, 159, 158, 0.5);
  border-radius: 50px;
  font-size: 10.5px;
  font-weight: 600;
  color: #9ededd;
  white-space: nowrap;
}

/* ── Entry rows ── */
.audit-log-entries {
  padding: 6px 0;
}

.audit-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  font-size: 12.5px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s;
}

.audit-entry:last-child {
  border-bottom: none;
}

.audit-entry:hover {
  background: #f8fafc;
}

/* Sequential number dot */
.audit-entry-index {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Event name */
.audit-entry-event {
  font-weight: 600;
  color: var(--dark);
  min-width: 180px;
  flex-shrink: 0;
}

/* Timestamp */
.audit-entry-time {
  font-size: 11.5px;
  color: var(--gray);
  font-family: 'Courier New', Courier, monospace;
  margin-left: auto;
}

/* ── Footer note ── */
.audit-log-note {
  padding: 8px 16px 10px;
  font-size: 11.5px;
  color: var(--gray);
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  margin: 0;
}

.audit-log-note strong {
  color: var(--dark);
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .audit-entry {
    flex-wrap: wrap;
    gap: 4px 8px;
    padding: 8px 12px;
  }
  .audit-entry-event {
    min-width: 0;
    flex: 1;
  }
  .audit-entry-time {
    width: 100%;
    margin-left: 28px;
    font-size: 10.5px;
  }
  .audit-log-badge {
    display: none;
  }
}
