/* PR313 — Lien Waiver AIA Form Templates
   TradeRail Field Management SaaS
   ─────────────────────────────────────────────── */

/* ── Overlay + Modal ──────────────────────────── */
.pr313-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pr313-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pr313-modal-sm {
  max-width: 520px;
}

.pr313-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.pr313-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
}

.pr313-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.pr313-close-btn:hover { background: #f3f4f6; color: #374151; }

.pr313-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Section Title ────────────────────────────── */
.pr313-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 14px 0;
}

/* ── Library Header ───────────────────────────── */
.pr313-library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.pr313-library-desc {
  font-size: 13px;
  color: #4b5563;
  margin: 0;
  flex: 1;
  line-height: 1.5;
}

/* ── Table ────────────────────────────────────── */
.pr313-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.pr313-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e5e7eb;
}

.pr313-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  color: #374151;
}

.pr313-template-row:hover td { background: #fafafa; }

.pr313-template-name {
  font-weight: 600;
  color: #1A1A2E;
}

.pr313-row-inactive .pr313-template-name { color: #9ca3af; }
.pr313-row-inactive td { color: #9ca3af; }

.pr313-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pr313-mapping-count {
  font-size: 12px;
  color: #6b7280;
}

/* ── Badges ───────────────────────────────────── */
.pr313-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pr313-badge-active    { background: #dcfce7; color: #166534; }
.pr313-badge-inactive  { background: #f3f4f6; color: #6b7280; }
.pr313-badge-generated { background: #dbeafe; color: #1d4ed8; }
.pr313-required        { color: #dc2626; font-weight: 700; }

/* ── Buttons ──────────────────────────────────── */
.pr313-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 14px;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.pr313-btn:hover:not(:disabled) { opacity: 0.86; }
.pr313-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.pr313-btn-sm       { padding: 4px 10px; font-size: 12px; }
.pr313-btn-primary  { background: #FF6B00; color: #fff; }
.pr313-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.pr313-btn-success  { background: #16a34a; color: #fff; }
.pr313-btn-warning  { background: #d97706; color: #fff; }
.pr313-btn-danger   { background: #dc2626; color: #fff; }
.pr313-btn-generate { background: #FF6B00; color: #fff; }
.pr313-btn-dl       { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

/* ── Form Fields ──────────────────────────────── */
.pr313-field {
  margin-bottom: 16px;
}

.pr313-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr313-input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  box-sizing: border-box;
}
.pr313-input:focus { outline: none; border-color: #FF6B00; box-shadow: 0 0 0 2px rgba(255,107,0,0.15); }

.pr313-select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1A1A2E;
  background: #fff;
  box-sizing: border-box;
}
.pr313-select:focus { outline: none; border-color: #FF6B00; }

/* ── File Upload Zone ─────────────────────────── */
.pr313-file-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  background: #fafafa;
  position: relative;
}
.pr313-file-zone:hover { border-color: #FF6B00; background: #fff8f5; }

.pr313-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.pr313-file-label {
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  display: block;
}

.pr313-file-name-display {
  margin: 6px 0 0 0;
  font-size: 12px;
  font-weight: 600;
}
.pr313-file-name-display.pr313-success { color: #16a34a; }
.pr313-file-name-display.pr313-error   { color: #dc2626; }

/* ── Field Mapping Table ──────────────────────── */
.pr313-map-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}

.pr313-map-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #e5e7eb;
}

.pr313-map-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.pr313-map-field {
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  width: 40%;
}

.pr313-map-input {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
}

/* ── Generate Modal — Waiver Summary ─────────── */
.pr313-waiver-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
}

.pr313-summary-row {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}

.pr313-summary-label {
  color: #6b7280;
  font-weight: 600;
  width: 110px;
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 1px;
}

.pr313-summary-val {
  color: #1A1A2E;
  font-weight: 500;
}

.pr313-single-template {
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1A1A2E;
}

/* ── Panel Actions ────────────────────────────── */
.pr313-panel-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
  margin-top: 16px;
}

/* ── Advisory / Hint ──────────────────────────── */
.pr313-advisory {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.5;
  margin: 12px 0;
  padding: 8px 12px;
  background: #fafafa;
  border-left: 3px solid #e5e7eb;
  border-radius: 0 4px 4px 0;
}

.pr313-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 6px 0 0 0;
  line-height: 1.5;
}

/* ── Empty State ──────────────────────────────── */
.pr313-empty {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 13px;
}

/* ── Upload Panel ─────────────────────────────── */
.pr313-upload-panel,
.pr313-mapping-panel {
  max-width: 640px;
}

/* ── Toast ────────────────────────────────────── */
.pr313-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  max-width: 360px;
}
.pr313-toast--success { background: #16a34a; color: #fff; }
.pr313-toast--error   { background: #dc2626; color: #fff; }
.pr313-toast--info    { background: #1d4ed8; color: #fff; }

/* ── Mobile ───────────────────────────────────── */
@media (max-width: 767px) {
  .pr313-modal      { border-radius: 10px 10px 0 0; max-height: 92vh; }
  .pr313-overlay    { align-items: flex-end; padding: 0; }
  .pr313-modal-body { padding: 16px; }
  .pr313-library-header { flex-direction: column; }
  .pr313-panel-actions  { flex-direction: column-reverse; }
  .pr313-panel-actions .pr313-btn { width: 100%; justify-content: center; }
  .pr313-row-actions    { flex-direction: column; }
  .pr313-table th:nth-child(4),
  .pr313-table td:nth-child(4) { display: none; }
}
