/* ===================================================================
   ProCure Haiti — custom styles
   =================================================================== */
:root {
  --primary: 79 109 245;
  --primary-hover: 66 87 224;
  --accent:  245 158 11;
  --destructive: 239 68 68;
  --border:  226 232 240;
  --muted:   148 163 184;
}

* { box-sizing: border-box; }

body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.font-inter { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* ---------- Card primitive ---------- */
.card        { background:#fff; border:1px solid rgb(var(--border)); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { padding: 16px 16px 8px; }
.card-title  { font-size: 14px; font-weight: 600; color: #0f172a; }
.card-body   { padding: 16px; }

/* ---------- Inputs ---------- */
.input,
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: #0f172a;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(79,109,245,.12);
}
.input:disabled, .form-select:disabled, .form-textarea:disabled {
  background: #f8fafc; color: #94a3b8; cursor: not-allowed;
}
.input.is-invalid, .form-select.is-invalid, .form-textarea.is-invalid {
  border-color: rgb(var(--destructive));
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-label    { display: block; font-size: 12px; font-weight: 500; color: #475569; margin-bottom: 4px; }
.form-label .req { color: rgb(var(--destructive)); margin-left: 2px; }
.form-help     { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.form-error    { font-size: 11px; color: rgb(var(--destructive)); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: rgb(var(--primary)); color: #fff; }
.btn-primary:hover:not(:disabled) { background: rgb(var(--primary-hover)); }
.btn-outline { background: #fff; border-color: rgb(var(--border)); color: #334155; }
.btn-outline:hover:not(:disabled) { background: #f1f5f9; }
.btn-ghost   { background: transparent; color: #475569; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; }
.btn-sm      { padding: 6px 10px; font-size: 12px; }
.btn-xs      { padding: 4px 8px; font-size: 11px; border-radius: 6px; }
.btn-danger  { background: rgb(var(--destructive)); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-icon    { padding: 6px; width: 32px; height: 32px; justify-content: center; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }

/* ---------- Tables ---------- */
.app-table { width:100%; font-size: 14px; border-collapse: collapse; }
.app-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 11px;
  color: #475569;
  background: #f8fafc;
  border-bottom: 1px solid rgb(var(--border));
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}
.app-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgb(var(--border));
  vertical-align: middle;
}
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover { background: #f8fafc; }
.app-table .text-right { text-align: right; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: none; align-items: center; justify-content: center;
  z-index: 60;
  padding: 24px;
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px -10px rgba(15,23,42,.3);
}
.modal-header {
  display:flex; justify-content:space-between; align-items:center;
  padding: 20px 24px; border-bottom: 1px solid rgb(var(--border));
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-body { padding: 24px; }

/* ---------- Status pills fallback ---------- */
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid #e2e8f0; border-top-color: rgb(var(--primary));
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 24px; color: #94a3b8; }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .5; }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #f1f5f9; border-radius: 10px; }
.tab  { padding: 6px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; }
.tab.is-active { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgba(15,23,42,.06); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  #main-wrap { margin-left: 0 !important; }
  #sidebar { transform: translateX(-100%); }
  #sidebar.is-open { transform: translateX(0); }
}

/* ---------- Print styles ---------- */
.print-only { display: none; }
@media print {
  #sidebar, header { display: none !important; }
  #main-wrap { margin-left: 0 !important; }
  main { padding: 0 !important; }
  .card { box-shadow: none; border-color: #cbd5e1; page-break-inside: avoid; }
  .no-print, .btn { display: none !important; }
  .print-only { display: block !important; }
  .print-header { display: flex !important; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0 16px; margin-bottom: 16px; border-bottom: 2px solid #1f2937; }
  .print-header .logo { max-height: 80px; max-width: 240px; object-fit: contain; }
  .print-header .meta { text-align: right; font-size: 11px; color: #475569; line-height: 1.4; }
  .print-header .meta strong { color: #0f172a; font-size: 13px; }
  body { color: #0f172a; font-size: 12px; }
  table { font-size: 11px; }
  a { color: inherit; text-decoration: none; }
}
