/* ============================================================
   components.css — UI Components tái sử dụng toàn hệ thống
   Import sau base.css
   ============================================================ */

/* ══════════════════════════════════════════
   NAV
   ══════════════════════════════════════════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: var(--gap-xl);
  flex-shrink: 0;
}

.nav-logo:hover { opacity: .85; }

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.logo-text {
  font-size: var(--fs-logo);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}

.logo-text small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: var(--fs-md);
  color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* Nav actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin-left: auto;
}

/* ══════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════ */

/* Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--btn-pad);
  border-radius: var(--radius);
  font-size: var(--fs-btn);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Ghost — chữ đen nền trắng */
.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

/* Primary — chữ trắng nền teal */
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

/* Danger */
.btn-danger {
  background: var(--cut-soft);
  color: var(--cut);
  border-color: var(--cut);
}
.btn-danger:hover {
  background: var(--cut);
  color: #fff;
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Sizes */
.btn-sm {
  padding: 5px 10px;
  font-size: var(--fs-xs);
}
.btn-lg {
  padding: 10px 22px;
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
}

/* ══════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--gap-lg);
}

.card-hover {
  cursor: pointer;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
.card-hover:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  padding-bottom: var(--gap-md);
  border-bottom: 1px solid var(--line);
}

.card-title {
  font-size: var(--fs-h3);
  font-weight: 500;
  color: var(--ink);
}

/* ══════════════════════════════════════════
   BADGES & PILLS
   ══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-span);
  font-weight: 500;
  line-height: 1.4;
}

.badge-brand   { background: var(--brand-soft);  color: var(--brand-dark);  border: 1px solid rgba(24,116,95,.2); }
.badge-cut     { background: var(--cut-soft);    color: var(--cut);         border: 1px solid rgba(224,68,56,.2); }
.badge-crease  { background: var(--crease-soft); color: var(--crease);      border: 1px solid rgba(37,99,217,.2); }
.badge-warn    { background: var(--warn-soft);   color: var(--warn);        border: 1px solid rgba(217,119,6,.2); }
.badge-ok      { background: var(--ok-soft);     color: var(--ok);          border: 1px solid rgba(22,163,74,.2); }
.badge-muted   { background: var(--bg);          color: var(--muted);       border: 1px solid var(--line); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 14px;
  border-radius: 99px;
  font-size: var(--fs-span);
  font-weight: 500;
}

/* ══════════════════════════════════════════
   MODULE ICON
   ══════════════════════════════════════════ */
.mod-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.mod-icon-teal { background: var(--brand-soft);  color: var(--brand); }
.mod-icon-blue { background: var(--crease-soft); color: var(--crease); }
.mod-icon-red  { background: var(--cut-soft);    color: var(--cut); }
.mod-icon-warn { background: var(--warn-soft);   color: var(--warn); }

/* ══════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink);
}

.form-input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--panel);
  transition: border-color var(--t-fast);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 116, 95, .1);
}

.form-input::placeholder { color: var(--subtle); }

.form-textarea {
  padding: 10px 12px;
  min-height: 100px;
  resize: vertical;
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--cut);
  margin-top: 4px;
}

/* ══════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

.table th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tr:hover td { background: var(--brand-soft); }

/* ══════════════════════════════════════════
   STATS ROW
   ══════════════════════════════════════════ */
.stats-row {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat-cell {
  flex: 1;
  padding: 18px 16px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.stat-cell:last-child { border-right: none; }

.stat-num {
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}

.stat-lbl {
  font-size: var(--fs-span);
  color: var(--muted);
  margin-top: 4px;
}

/* ══════════════════════════════════════════
   LOADING & EMPTY STATE
   ══════════════════════════════════════════ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap-3xl);
  color: var(--muted);
  font-size: var(--fs-base);
  gap: var(--gap-sm);
}

.empty-state {
  text-align: center;
  padding: var(--gap-3xl) var(--gap-lg);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: var(--gap-md);
  opacity: .4;
}

.empty-state h3 {
  font-size: var(--fs-h3);
  color: var(--ink);
  margin-bottom: var(--gap-sm);
}

.empty-state p {
  font-size: var(--fs-base);
  color: var(--muted);
  margin-bottom: var(--gap-lg);
}

/* ══════════════════════════════════════════
   TOAST NOTIFICATION
   ══════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff;
  font-size: var(--fs-base);
  box-shadow: var(--shadow-lg);
  animation: toast-in .2s ease;
  min-width: 240px;
  max-width: 360px;
}

.toast-ok      { background: var(--brand); }
.toast-error   { background: var(--cut); }
.toast-warn    { background: var(--warn); color: var(--ink); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════ */
.footer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .75);
  padding: 14px 0;
}

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

.footer p {
  font-size: var(--fs-footer);
  color: var(--muted);
  line-height: 1.4;
}

.footer-version {
  font-size: var(--fs-span);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid rgba(24, 116, 95, .2);
}
