/* ── Overlay ─────────────────────────────────────────────── */
#tf-root .tf-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#tf-root .tf-overlay.hidden,
#tf-root .tf-overlay.tf-hidden { display: none !important; visibility: hidden !important; }

/* ── Modal container ─────────────────────────────────────── */
#tf-root .tf-modal {
  background: var(--tf-white);
  border-radius: var(--tf-radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: rcaSlideUp 0.2s ease both;
}
#tf-root .tf-modal-header { flex-shrink: 0; }
#tf-root .tf-modal-footer { flex-shrink: 0; }

/* ── Modal header ────────────────────────────────────────── */
#tf-root .tf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tf-border);
}
#tf-root .tf-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--tf-text);
}
#tf-root .tf-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tf-text-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
#tf-root .tf-modal-close:hover { background: var(--tf-bg); color: var(--tf-text); }

/* ── Modal body ──────────────────────────────────────────── */
#tf-root .tf-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow-y: auto;
}

/* ── Upload zone ─────────────────────────────────────────── */
#tf-root .tf-upload-zone {
  border: 2px dashed var(--tf-border);
  border-radius: var(--tf-radius-md);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--tf-bg);
  position: relative;
}
#tf-root .tf-upload-zone:hover,
#tf-root .tf-upload-zone.dragover {
  border-color: var(--tf-primary);
  background: var(--tf-primary-light);
}
#tf-root .tf-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
#tf-root .tf-upload-zone-icon { margin-bottom: 8px; display: flex; justify-content: center; }
#tf-root .tf-upload-zone-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tf-text-secondary);
}
#tf-root .tf-upload-zone-sub {
  font-size: 0.75rem;
  color: var(--tf-text-muted);
  margin-top: 4px;
}
#tf-root .tf-upload-zone.has-file {
  border-color: var(--tf-primary);
  background: var(--tf-primary-light);
}
#tf-root .tf-upload-zone.has-file .tf-upload-zone-label { color: var(--tf-primary); }

/* ── Upload option picker (gallery / camera) ─────────────── */
#tf-root .tf-upload-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
#tf-root .tf-upload-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 18px;
  border: 1.5px solid var(--tf-border);
  border-radius: var(--tf-radius-md);
  background: var(--tf-white);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tf-text-secondary);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-width: 100px;
}
#tf-root .tf-upload-option:hover {
  border-color: var(--tf-primary);
  background: var(--tf-primary-light);
  color: var(--tf-primary);
}
#tf-root .tf-upload-option svg {
  width: 20px;
  height: 20px;
}

/* ── Upload zones row (CI: front + back) ─────────────────── */
#tf-root .tf-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Status states ───────────────────────────────────────── */
#tf-root .tf-modal-status {
  text-align: center;
  padding: 24px 0;
}
#tf-root .tf-modal-status .tf-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--tf-border);
  border-top-color: var(--tf-primary);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: rcaSpin 1s linear infinite;
}
#tf-root .tf-modal-status-text {
  font-size: 0.875rem;
  color: var(--tf-text-muted);
}
#tf-root .tf-modal-status-sub {
  font-size: 0.8rem;
  color: var(--tf-text-muted);
  opacity: 0.75;
  margin-top: 6px;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
#tf-root .tf-modal-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--tf-radius-md);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: #991b1b;
}

/* ── Review panel (field-by-field) ───────────────────────── */
#tf-root .tf-review-panel { display: flex; flex-direction: column; gap: 6px; }
#tf-root .tf-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--tf-radius-sm);
  background: var(--tf-bg);
  gap: 12px;
}
#tf-root .tf-field-row.applied { background: #f0fdf4; }
#tf-root .tf-field-info { flex: 1; min-width: 0; }
#tf-root .tf-field-key {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tf-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#tf-root .tf-field-val {
  font-size: 0.875rem;
  color: var(--tf-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#tf-root .tf-field-conf {
  font-size: 0.7rem;
  margin-top: 2px;
}
#tf-root .tf-field-conf.high   { color: #16a34a; }
#tf-root .tf-field-conf.medium { color: #d97706; }
#tf-root .tf-field-conf.low    { color: var(--tf-danger); }
#tf-root .tf-field-apply-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
#tf-root .tf-field-apply-btn.pending {
  background: var(--tf-primary-light);
  color: var(--tf-primary);
}
#tf-root .tf-field-apply-btn.pending:hover { background: #c7dff2; }
#tf-root .tf-field-apply-btn.done {
  background: #dcfce7;
  color: #15803d;
}

/* ── Modal footer ────────────────────────────────────────── */
#tf-root .tf-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--tf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* -- Webcam capture UI */
#tf-root .tf-webcam-container { display:flex; flex-direction:column; align-items:center; gap:12px; width:100%; }
#tf-root .tf-webcam-container video { width:100%; max-height:300px; object-fit:cover; border-radius:var(--tf-radius-md); background:#000; }
#tf-root .tf-webcam-hint { font-size:0.82rem; color:var(--tf-text-secondary); margin:0; text-align:center; }

/* -- Confirm data modal */
#tf-root .tf-modal-confirm { max-width: 560px; }
#tf-root .tf-confirm-modal-body { max-height: 60vh; overflow-y: auto; }
#tf-root .tf-confirm-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tf-text-muted);
  margin-bottom: 8px;
}

/* -- Confirmation preview (after upload / camera capture) */
#tf-root .tf-confirm-preview { display:flex; flex-direction:column; align-items:center; gap:12px; margin:-20px -20px 0; }
#tf-root .tf-confirm-img { width:100%; max-height:320px; object-fit:contain; border-radius:0; background:#000; }
#tf-root .tf-confirm-hint { font-size:0.88rem; color:var(--tf-text-secondary); text-align:center; margin-top:4px; }

/* -- Legal modal (Alege) */
#tf-root .tf-modal-legal { max-width: 660px; }
#tf-root .tf-legal-body { padding: 0; gap: 0; }
#tf-root .tf-legal-intro {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tf-border);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--tf-primary);
}
#tf-root .tf-legal-scroll {
  max-height: 54vh;
  overflow-y: auto;
  padding: 16px 18px;
  font-size: 0.95rem;
  color: var(--tf-text);
  line-height: 1.55;
}
#tf-root .tf-legal-scroll h4 {
  margin: 14px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tf-text);
}
#tf-root .tf-legal-scroll p { margin: 0 0 10px; }
#tf-root .tf-legal-scroll ul { margin: 0 0 10px 18px; padding: 0; }
#tf-root .tf-legal-scroll ul li { margin-bottom: 4px; }
#tf-root .tf-legal-scroll strong { color: var(--tf-text); }
#tf-root .tf-legal-scroll .tf-legal-effective {
  font-size: 0.85rem;
  color: var(--tf-muted, #666);
  font-style: italic;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--tf-border, #ddd);
}
#tf-root .tf-legal-footer { flex-direction: column; align-items: center; }
#tf-root .tf-legal-footer .tf-btn-primary { min-width: 230px; justify-content: center; }
