/* ================================================================
   NEXUS ERP — Modal System v1.1
   Sharp enterprise aesthetic — no rounded borders.
   ================================================================ */

/* ── Backdrop ─────────────────────────────────────────────────── */
.modal-backdrop { background-color: #0C0F1A; }
.modal-backdrop.show {
  opacity: .5;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Dialog: slide-up + fade entrance ────────────────────────── */
.modal.fade .modal-dialog {
  transform: translateY(20px);
  opacity: 0;
  transition: transform .3s cubic-bezier(.22,1,.36,1), opacity .25s ease;
}
.modal.show .modal-dialog {
  transform: translateY(0);
  opacity: 1;
}

/* ── Content card ────────────────────────────────────────────── */
.modal-content {
  border: 1px solid #E5E7EB;
  border-radius: 0 !important;
  box-shadow: 0 20px 60px rgba(12,15,26,.25), 0 4px 12px rgba(12,15,26,.10);
  overflow: hidden;
  font-family: 'Nexa', 'Inter', sans-serif;
}

/* ── Header ──────────────────────────────────────────────────── */
.modal-header {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  padding: 1.25rem 1.75rem;
  align-items: center;
  border-radius: 0 !important;
}
.modal-title {
  font-family: 'Nexa', 'Inter', sans-serif !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  color: #0C0F1A !important;
  letter-spacing: -.01em;
}
.modal-header .close {
  width: 30px; height: 30px;
  border-radius: 0;
  background: #F3F4F6;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; padding: 0; margin: -4px -4px -4px auto;
  font-size: 1.125rem; color: #6B7280;
  transition: background .15s ease, color .15s ease;
}
.modal-header .close:hover { background: #E5E7EB; color: #111827; }

/* ── Body ────────────────────────────────────────────────────── */
.modal-body {
  background: #F9FAFB;
  padding: 1.75rem;
}

/* ── Footer ──────────────────────────────────────────────────── */
.modal-footer {
  background: #fff;
  border-top: 1px solid #E5E7EB;
  padding: 1rem 1.75rem;
  gap: .625rem;
  justify-content: flex-end;
  border-radius: 0 !important;
}

/* ── Section labels inside modal body ────────────────────────── */
.modal-section {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: #9CA3AF;
  margin: 1.25rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid #E5E7EB;
}
.modal-section:first-child { margin-top: 0; }

/* ── Form labels ─────────────────────────────────────────────── */
.modal .form-label,
.modal label.form-label {
  font-size: .75rem !important;
  font-weight: 500 !important;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #374151 !important;
  margin-bottom: .35rem;
  display: block;
}

/* ── Form controls ───────────────────────────────────────────── */
.modal .form-control,
.modal select.form-control,
.modal textarea.form-control {
  border: 1px solid #E5E7EB;
  border-radius: 0 !important;
  padding: .6rem .875rem;
  font-size: .875rem;
  font-family: 'Nexa', 'Inter', sans-serif;
  color: #111827;
  background: #fff;
  height: auto;
  transition: border-color .15s ease;
  box-shadow: none;
}
.modal .form-control:focus,
.modal select.form-control:focus,
.modal textarea.form-control:focus {
  border-color: #1D4ED8;
  box-shadow: none;
  outline: none;
  background: #fff;
}
.modal .form-control::placeholder { color: #C1C7D0; }
.modal textarea.form-control { resize: vertical; }

/* ── Input group ─────────────────────────────────────────────── */
.modal .input-group-text {
  border: 1px solid #E5E7EB;
  border-right: none;
  border-radius: 0 !important;
  background: #F3F4F6;
  color: #6B7280;
  font-size: .8125rem;
  font-weight: 600;
}
.modal .input-group .form-control {
  border-radius: 0 !important;
  border-left: none;
}

/* ── Buttons inside modals ───────────────────────────────────── */
.modal .btn-primary {
  background: #1D4ED8;
  border: none;
  border-radius: 0 !important;
  padding: .6rem 1.5rem;
  font-family: 'Nexa', 'Inter', sans-serif;
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .01em;
  transition: background .15s ease;
}
.modal .btn-primary:hover { background: #1E3A8A; }
.modal .btn-primary:active { opacity: .9; }
.modal .btn-primary:disabled {
  background: #93C5FD;
  cursor: not-allowed;
}

.modal .btn-light,
.modal .btn-secondary {
  background: transparent;
  border: 1px solid #E5E7EB;
  border-radius: 0 !important;
  padding: .5625rem 1.25rem;
  font-family: 'Nexa', 'Inter', sans-serif;
  font-size: .875rem;
  font-weight: 500;
  color: #374151;
  transition: background .15s ease, border-color .15s ease;
}
.modal .btn-light:hover,
.modal .btn-secondary:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
  color: #111827;
}

/* ── Alerts inside modal ─────────────────────────────────────── */
.modal .alert-danger {
  border-radius: 0 !important;
  border-left: 3px solid #DC2626;
  border-top: none; border-right: none; border-bottom: none;
  background: #FEF2F2;
  color: #991B1B;
  font-size: .8125rem;
  padding: .75rem 1rem;
}

/* ── Line-items table (PO / Factura) ─────────────────────────── */
.modal .lines-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .8125rem;
}
.modal .lines-table thead th {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9CA3AF;
  border-bottom: 1px solid #E5E7EB;
  padding: .5rem .5rem .625rem;
}
.modal .lines-table tbody tr td {
  padding: .4rem .4rem;
  vertical-align: middle;
}
.modal .lines-table tfoot td {
  padding: .5rem .5rem;
  border-top: 1px solid #E5E7EB;
}
.modal .lines-table .form-control {
  padding: .4rem .6rem;
  font-size: .8125rem;
  border-radius: 0 !important;
}
.modal .line-delete-btn {
  width: 28px; height: 28px;
  border-radius: 0;
  border: none;
  background: #FEF2F2;
  color: #DC2626;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .875rem;
  transition: background .15s ease;
}
.modal .line-delete-btn:hover { background: #FEE2E2; }

/* ── Totals summary panel ────────────────────────────────────── */
.modal .totals-panel {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 0;
  padding: 1.125rem 1.25rem;
  font-size: .8125rem;
}
.modal .totals-panel .total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .25rem 0;
  color: #6B7280;
}
.modal .totals-panel .total-row.grand {
  padding-top: .625rem;
  margin-top: .375rem;
  border-top: 1px solid #E5E7EB;
  font-size: .9375rem;
  font-weight: 700;
  color: #0C0F1A;
}
.modal .totals-panel .total-row .val { font-weight: 500; color: #111827; }

/* ── Loading spinner (stays circular) ───────────────────────── */
@keyframes nx-spin { to { transform: rotate(360deg); } }
.nx-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: nx-spin .65s linear infinite;
  vertical-align: middle;
  margin-right: .375rem;
}
