@import url('/css/tokens.css');

/**
 * ux-utils.css — shared UX utility styles for ECP dashboards
 * Toast notifications, empty states, skeleton loading, focus styles,
 * mobile table scroll, z-index layer system
 */

/* ─── Focus visible (keyboard navigation) ────────────────────────────────────  */
:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
/* Remove outline only for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}
/* ─── Toast container ────────────────────────────────────────────────────────  */
#ux-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.ux-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  background: #1e293b;
  color: #f1f5f9;
  border-left: 4px solid #3b82f6;
}
.ux-toast.ux-toast-visible {
  opacity: 1;
  transform: translateX(0);
}
.ux-toast.ux-toast-hiding {
  opacity: 0;
  transform: translateX(20px);
}

.ux-toast-success { border-left-color: #10b981; }
.ux-toast-error   { border-left-color: #ef4444; }
.ux-toast-warning { border-left-color: #f59e0b; }
.ux-toast-info    { border-left-color: #3b82f6; }

.ux-toast-icon {
  flex-shrink: 0;
  font-size: 15px;
  margin-top: 1px;
}
.ux-toast-success .ux-toast-icon { color: #10b981; }
.ux-toast-error   .ux-toast-icon { color: #ef4444; }
.ux-toast-warning .ux-toast-icon { color: #f59e0b; }
.ux-toast-info    .ux-toast-icon { color: #3b82f6; }

.ux-toast-msg {
  flex: 1;
}
.ux-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(241,245,249,0.5);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  margin-top: -1px;
  transition: color 0.15s;
}
.ux-toast-close:hover { color: #f1f5f9; }

/* Light theme toast */
/* ─── Table empty state ───────────────────────────────────────────────────────  */
.ux-empty-state {
  text-align: center;
  padding: 48px 20px !important;
}
.ux-empty-icon {
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.6;
}
.ux-empty-msg {
  display: block;
  font-size: 14px;
  color: rgba(148, 163, 184, 0.9);
}
/* ─── Skeleton loading rows ──────────────────────────────────────────────────  */
.ux-skeleton {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.07) 25%, rgba(255,255,255,0.14) 50%, rgba(255,255,255,0.07) 75%);
  background-size: 400% 100%;
  animation: ux-shimmer 1.4s ease infinite;
}
@keyframes ux-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}
.ux-skeleton-row td { padding: 10px 12px !important; }
.ux-skeleton-row td .ux-skeleton:nth-child(1) { width: 70%; }
.ux-skeleton-row:nth-child(2) td .ux-skeleton { width: 55%; }
.ux-skeleton-row:nth-child(3) td .ux-skeleton { width: 80%; }
.ux-skeleton-row:nth-child(4) td .ux-skeleton { width: 60%; }
.ux-skeleton-row:nth-child(5) td .ux-skeleton { width: 75%; }

/* ─── Inline field error ─────────────────────────────────────────────────────  */
.ux-field-error {
  display: none;
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
  padding-left: 2px;
}
/* ─── Mobile-friendly tables ─────────────────────────────────────────────────  */
@media (max-width: 768px) {
  .table-wrapper,
  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* subtle scroll indicator */
    background:
      linear-gradient(to right, transparent 90%, rgba(59,130,246,0.08)) local,
      linear-gradient(to right, rgba(59,130,246,0.08), transparent) local;
    background-attachment: local, local;
  }
  .table-wrapper table,
  .table-scroll table {
    min-width: 600px;
  }
}

/* ─── Wizard breadcrumb ───────────────────────────────────────────────────────  */
.ux-wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  font-size: 13px;
}
.ux-wizard-step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(148,163,184,0.7);
}
.ux-wizard-step.active {
  color: #3b82f6;
  font-weight: 600;
}
.ux-wizard-step.done {
  color: #10b981;
}
.ux-wizard-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.ux-wizard-step.done .ux-wizard-step-num {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}
.ux-wizard-step.active .ux-wizard-step-num {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
.ux-wizard-sep {
  width: 24px;
  height: 2px;
  background: rgba(148,163,184,0.25);
  margin: 0 4px;
  flex-shrink: 0;
}
/* ─── Confirmation modal (used on index.html) ───────────────────────────────── */
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 20px 20px 0 0;
}
.modal-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  flex-shrink: 0;
}
.modal-icon.warning { background-color: #f59e0b; color: #fff; }
.modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}
.modal-body {
  padding: 24px;
  font-size: 16px;
  line-height: 1.6;
  color: #475569;
}
.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 0 0 20px 20px;
}
.modal-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
  transition: background 0.15s, transform 0.15s;
}
.modal-btn.danger    { background: #ef4444; color: #fff; }
.modal-btn.danger:hover { background: #dc2626; transform: translateY(-1px); }
.modal-btn.secondary { background: #6b7280; color: #fff; }
.modal-btn.secondary:hover { background: #4b5563; transform: translateY(-1px); }
