/* JNOC Portal — reusable UI components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg4); border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg2); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; }

/* Card */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}
.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Stat tile */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); }
.stat-hint { font-size: 12px; color: var(--muted); }
.stat.accent .stat-value { color: var(--accent-light); }
.stat.success .stat-value { color: #4ad97f; }
.stat.danger .stat-value { color: #ff5e6e; }
.stat.warn .stat-value { color: var(--warn); }

/* Tables */
.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: auto;
}
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--bg1);
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky; top: 0; z-index: 1;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg3); }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge.accent { background: var(--accent-glow); color: var(--accent-light); border-color: var(--accent); }
.badge.success { background: rgba(26,122,58,.15); color: #4ad97f; border-color: var(--success); }
.badge.danger { background: rgba(212,43,43,.15); color: #ff5e6e; border-color: var(--danger); }
.badge.warn { background: rgba(224,160,32,.15); color: var(--warn); border-color: var(--warn); }
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
}

/* Form rows */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Toast */
#toast-host {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 240px;
  max-width: 360px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toast-in .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: fade-in .15s ease;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 15px; font-weight: 600; margin: 0; }
.modal-body { padding: 18px; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* Section header (page header) */
.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}
.page-head .sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.page-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 36px; margin-bottom: 10px; opacity: .5; }
.empty-title { font-size: 15px; color: var(--text); margin-bottom: 4px; }
