/* ═══════════════════════════════════════════════
   Are You a Notary — RON Platform Styles v2.0
   ═══════════════════════════════════════════════ */

* { box-sizing: border-box; }

:root {
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --border: #e5e7eb;
  --border-s: #d1d5db;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --radius: 10px;
  --radius-sm: 6px;
}

#ayn-ron-app {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background: #f3f4f6;
}

/* ── Topbar ── */
.ron-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ron-topbar-left .ron-session-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 1px; }
.ron-topbar-left .ron-session-name  { font-size: 13px; font-weight: 600; }
.ron-topbar-right { display: flex; align-items: center; gap: 12px; }

/* ── Layout ── */
.ron-layout {
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  gap: 12px;
  padding: 12px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 900px) {
  .ron-layout { grid-template-columns: 1fr; }
}

/* ── Cards ── */
.ron-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: .85rem;
  color: var(--text);
}

/* ── Video ── */
.ron-video-box {
  background: #0d1117;
  border-radius: var(--radius);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.ron-video-box iframe { width: 100%; height: 100%; border: none; border-radius: var(--radius); }
.video-placeholder { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.video-placeholder p { font-size: 12px; color: #4a5568; }

/* ── PDF viewer ── */
.ron-doc-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.ron-field-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-s);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.ron-field-btn:hover, .ron-field-btn.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }

.ron-pdf-wrapper {
  background: #e5e7eb;
  border-radius: var(--radius);
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 16px;
}
.ron-pdf-placeholder { text-align: center; }

#pdf-canvas-container { position: relative; box-shadow: 0 4px 20px rgba(0,0,0,.15); }
#pdf-canvas { display: block; max-width: 100%; }

/* ── Field overlay ── */
.fields-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.doc-field {
  position: absolute;
  pointer-events: all;
  cursor: pointer;
  border: 1.5px dashed var(--blue);
  border-radius: 3px;
  background: rgba(37,99,235,.07);
  display: flex;
  align-items: center;
  padding: 2px 5px;
  transition: background .15s;
  font-size: 11px;
  color: var(--blue);
  font-family: inherit;
  overflow: hidden;
}

.doc-field:hover { background: rgba(37,99,235,.13); }
.doc-field.filled { border-color: var(--green); background: rgba(22,163,74,.07); color: var(--green); border-style: solid; }
.doc-field.sig-field { border-color: #7c3aed; background: rgba(124,58,237,.07); color: #7c3aed; }
.doc-field.sig-field.filled { border-color: var(--green); background: rgba(22,163,74,.07); color: var(--green); }

.doc-field input,
.doc-field textarea {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  cursor: text;
  padding: 0;
}

.doc-field .field-delete {
  position: absolute;
  top: -8px; right: -8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  display: none;
  z-index: 10;
  border: none;
  font-weight: 700;
}
.doc-field:hover .field-delete { display: block; }

/* ── Buttons ── */
.ron-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-s);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
  line-height: 1;
}
.ron-btn:hover { background: var(--surface2); }
.ron-btn:disabled { opacity: .45; cursor: not-allowed; }
.ron-btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.ron-btn-primary:hover { background: #1d4ed8; }
.ron-btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.ron-btn-success:hover { background: #15803d; }
.ron-btn-ghost { background: none; border-color: transparent; color: var(--text2); padding: 5px 8px; }
.ron-btn-ghost:hover { background: var(--surface2); }
.ron-btn-sm { padding: 5px 10px; font-size: 12px; }
.ron-btn-full { width: 100%; justify-content: center; padding: 9px; margin-top: 8px; }

/* ── Controls ── */
.ron-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ron-ctrl-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-s);
  background: var(--surface);
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.ron-ctrl-btn.recording { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

/* ── Client link ── */
.ron-client-link-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; margin-bottom: 8px; }
.client-link-label { font-size: 11px; color: var(--text3); margin-bottom: 5px; }
.client-link-row { display: flex; gap: 6px; align-items: center; }
.client-link-url { flex: 1; font-size: 10px; font-family: monospace; background: var(--surface2); padding: 5px 8px; border-radius: var(--radius-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text2); }

/* ── Upload area ── */
.ron-upload-area { background: var(--surface); border: 1.5px dashed var(--border-s); border-radius: var(--radius); padding: .85rem; text-align: center; margin-bottom: 8px; }

/* ── Forms ── */
.form-row { margin-bottom: 12px; }
.field-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 4px; }
input[type="text"], input[type="email"], input[type="tel"], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-s);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.ron-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .85rem;
  margin-bottom: 10px;
  font-size: 12px;
  cursor: pointer;
}
.ron-check-row input { margin-top: 2px; flex-shrink: 0; width: 15px; height: 15px; }

.ron-note { font-size: 11px; color: var(--text3); background: var(--surface2); border-radius: var(--radius-sm); padding: .5rem .75rem; }
.ron-journal-preview { font-size: 11px; color: var(--text3); background: var(--surface2); border-radius: var(--radius-sm); padding: .5rem .75rem; margin-bottom: 10px; font-family: monospace; }

/* ── Stepper ── */
.ron-stepper { display: flex; align-items: center; }
.step-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.step-line { flex: 1; height: 1px; background: var(--border); margin: 0 4px; margin-bottom: 14px; }
.step-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border-s);
  background: var(--surface2); color: var(--text3);
}
.step-dot.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-border); }
.step-dot.done   { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.step-label { font-size: 10px; color: var(--text3); white-space: nowrap; }
.step-item.active .step-label { color: var(--text); font-weight: 600; }

/* ── Signature canvas ── */
.sig-wrapper { background: #fff; border: 1px solid var(--border-s); border-radius: var(--radius-sm); position: relative; overflow: hidden; margin-bottom: 4px; transition: border-color .2s; }
.sig-wrapper.signed { border-color: var(--green); }
.sig-canvas { display: block; width: 100%; height: 70px; touch-action: none; cursor: crosshair; }
.sig-placeholder { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 11px; color: #cbd5e1; pointer-events: none; }

/* ── Seal ── */
.seal-preview { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-align: center; margin-bottom: 10px; }
.seal-placeholder-circle { width: 90px; height: 90px; border: 1.5px dashed var(--border-s); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; color: var(--text3); font-size: 11px; }
.seal-circle { width: 90px; height: 90px; border: 2px solid var(--blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto; padding: 3px; }
.seal-inner { width: 100%; height: 100%; border: 1.5px solid var(--blue); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--blue); }
.seal-inner div { font-size: 7px; font-weight: 600; text-align: center; line-height: 1.3; }
.seal-date { font-size: 6px !important; font-weight: 400 !important; color: var(--text2) !important; }

/* ── Field list (panel) ── */
.field-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.field-list-item:last-child { border-bottom: none; }
.field-type-tag { padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 500; background: var(--blue-bg); color: var(--blue); flex-shrink: 0; }
.field-filled-tag { padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 500; background: var(--green-bg); color: var(--green); }
.field-empty-tag { padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 500; background: var(--amber-bg); color: #92400e; }

/* ── Field popup ── */
.field-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}
.field-popup-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  width: 280px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
}

/* ── Recording indicator ── */
.rec-hidden { display: none; }
.rec-indicator { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--red); }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; display: inline-block; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 26px; height: 26px; border: 2.5px solid rgba(255,255,255,.2); border-top-color: #60a5fa; border-radius: 50%; animation: spin .7s linear infinite; }

/* ── Client fields ── */
.client-field-item { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem .85rem; margin-bottom: 8px; }
.client-field-item label { display: block; font-size: 11px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.client-field-item input,
.client-field-item textarea { width: 100%; padding: 6px 9px; border: 1px solid var(--border-s); border-radius: var(--radius-sm); font-size: 12px; font-family: inherit; }
.client-field-item .sig-wrapper { margin-top: 4px; }
.client-field-item .sig-canvas { height: 60px; }

/* ── Conn status ── */
.conn-dot-waiting { font-size: 12px; color: var(--text3); }
.conn-dot-ok      { font-size: 12px; color: var(--green); }
