/* POC Leypal — estilos minimal compartidos */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background: #f3f4f6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.container--narrow {
  max-width: 480px;
}

.container--wide {
  max-width: 1280px;
}

/* Header / navbar */
.navbar {
  background: #1f2937;
  color: white;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar a {
  color: white;
  text-decoration: none;
  margin-right: 16px;
}

.navbar a:hover {
  text-decoration: underline;
}

.navbar-brand {
  font-weight: 700;
  font-size: 18px;
}

.navbar-user {
  font-size: 13px;
  opacity: 0.85;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 24px;
  margin-bottom: 16px;
}

.card h1,
.card h2 {
  margin-top: 0;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
  color: #374151;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e5e7eb;
  color: #1f2937;
}

.btn-secondary:hover:not(:disabled) {
  background: #d1d5db;
}

.btn-danger {
  background: #dc2626;
  color: white;
}

.btn-success {
  background: #16a34a;
  color: white;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

.table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
}

.table tr:hover {
  background: #f9fafb;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-completed {
  background: #dcfce7;
  color: #166534;
}

.badge-waiting {
  background: #dbeafe;
  color: #1e40af;
}

.badge-refused,
.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

/* Signature canvas */
.signature-canvas-container {
  border: 2px dashed #d1d5db;
  border-radius: 6px;
  background: #fafafa;
  position: relative;
  margin-bottom: 12px;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 200px;
  background: white;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
}

.signature-canvas-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
}

/* PDF viewer */
.pdf-viewer {
  background: #e5e7eb;
  padding: 16px;
  border-radius: 6px;
  max-height: 600px;
  overflow: auto;
}

.pdf-viewer canvas {
  display: block;
  margin: 0 auto 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Signer rows (dynamic list) */
.signer-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: end;
}

.signer-row .remove-btn {
  align-self: end;
}

/* Utilities */
.text-muted {
  color: #6b7280;
}

.text-sm {
  font-size: 12px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.text-right {
  text-align: right;
}

.hidden {
  display: none !important;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Copy URL with one-click button */
.copy-url {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-url input {
  font-family: monospace;
  font-size: 12px;
  background: #f9fafb;
}

/* ============================================================
   Pipeline progress indicator (dashboard + detail view)
   ============================================================ */
.pipeline {
  display: flex;
  gap: 4px;
  align-items: center;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.pipeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e5e7eb;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  font-weight: bold;
  z-index: 2;
  position: relative;
}

.pipeline-step--done .pipeline-dot {
  background: #16a34a;
  border-color: #16a34a;
}

.pipeline-step--done .pipeline-dot::after {
  content: "✓";
}

.pipeline-line {
  position: absolute;
  top: 8px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: #d1d5db;
  z-index: 1;
}

.pipeline-step--done + .pipeline-step .pipeline-line {
  background: #16a34a;
}

.pipeline-step:last-child .pipeline-line {
  display: none;
}

.pipeline-label {
  font-size: 10px;
  color: #6b7280;
  margin-top: 4px;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

.pipeline-step--done .pipeline-label {
  color: #166534;
  font-weight: 600;
}

/* ============================================================
   Filter buttons (active state)
   ============================================================ */
.filter-btn {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}

.filter-btn:hover {
  background: #e5e7eb;
}

.filter-btn--active {
  background: #2563eb !important;
  color: white !important;
  border-color: #2563eb;
}

/* ============================================================
   Form input (search)
   ============================================================ */
.form-input {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
}

/* ============================================================
   Detail view — signer cards
   ============================================================ */
.signer-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
}

.signer-card--completed {
  background: #f0fdf4;
  border-color: #86efac;
}

.signer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.signer-card-meta {
  font-size: 12px;
  color: #6b7280;
}

/* ============================================================
   PDF embed (detail view)
   ============================================================ */
.pdf-embed {
  width: 100%;
  height: 800px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
}

/* ============================================================
   Two-column grid (detail view)
   ============================================================ */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
