/* ═══════════════════════════════════════════════════════════════════
   VELTRIX OS — UI Components (Buttons, Cards, Forms, Tags)
   ═══════════════════════════════════════════════════════════════════ */

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  transition: all var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background: var(--brand-primary-2);
  border-color: var(--brand-primary-2);
  color: #fff;
}

.btn-secondary {
  background: var(--brand-dark);
  color: #fff;
  border-color: var(--brand-dark);
}

.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover { background: var(--surface-2); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-block { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ═══ CARDS ═══ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: var(--sh-sm);
  transition: background var(--t-base), border-color var(--t-base);
}

.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  letter-spacing: -0.2px;
}

.card-title-lg {
  font-size: 16px;
  margin-bottom: 16px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: -8px;
  margin-bottom: 14px;
}

/* ═══ STATS ═══ */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-sm);
}

.stat-lbl {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.stat-val {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -1px;
}

.stat-ch { font-size: 11px; margin-top: 5px; }
.stat-ch.up { color: var(--green); }
.stat-ch.dn { color: var(--red); }

/* ═══ GRIDS ═══ */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 900px) {
  .g4 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: 1fr; }
  .g2 { grid-template-columns: 1fr; }
}

/* ═══ FORMS ═══ */
.fg { margin-bottom: 14px; }

.fl {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
  display: block;
}

.fl-req::after { content: ' *'; color: var(--red); }

.fi, .fs, .fta {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast);
}

.fi:focus, .fs:focus, .fta:focus { border-color: var(--brand-primary); }
.fta { resize: vertical; min-height: 80px; }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fr-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ═══ TAGS / BADGES ═══ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}

.tag-orange { background: var(--acc-bg); color: var(--brand-primary); }
.tag-green  { background: var(--green-bg); color: var(--green); }
.tag-red    { background: var(--red-bg); color: var(--red); }
.tag-amber  { background: var(--amber-bg); color: var(--amber); }
.tag-blue   { background: var(--blue-bg); color: var(--blue); }
.tag-gray   { background: var(--surface-2); color: var(--text-2); }

/* ═══ STATUS PILLS ═══ */
.status {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.s-hot   { background: var(--red-bg); color: var(--red); }
.s-warm  { background: var(--amber-bg); color: var(--amber); }
.s-cold  { background: var(--blue-bg); color: var(--blue); }
.s-conv  { background: var(--green-bg); color: var(--green); }

/* ═══ SECTION HEADER ═══ */
.sec-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.sec-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.sec-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ═══ DIVIDER ═══ */
.hr {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}

/* ═══ EMPTY STATE ═══ */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-text { font-size: 13px; }
.empty-sub { font-size: 12px; margin-top: 4px; opacity: 0.8; }

/* ═══ AI LOADING ═══ */
.ai-load {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13px;
  padding: 14px 0;
}

.dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--brand-primary);
  border-radius: 50%;
  animation: dotBounce 1.2s infinite;
  margin: 0 1.5px;
}

.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40% { transform: translateY(-7px); opacity: 1; }
}

/* ═══ AI OUTPUT BOX ═══ */
.ai-output {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
  position: relative;
}

.ai-output-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--brand-primary);
  margin-bottom: 8px;
}

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base);
  backdrop-filter: blur(4px);
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  width: 500px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--sh-lg);
  transform: translateY(12px);
  transition: transform var(--t-base);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  cursor: pointer;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-3);
  line-height: 1;
  font-family: inherit;
  padding: 0 4px;
}

.modal-close:hover { color: var(--text); }

/* ═══ TABLES ═══ */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  background: var(--bg-2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--surface-2); }

/* ═══ COPY BUTTON ═══ */
.cp-btn {
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-family: inherit;
  transition: all var(--t-fast);
}

.cp-btn:hover { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.cp-btn.ok { background: var(--green); color: #fff; border-color: var(--green); }

/* ═══ TOAST NOTIFICATION ═══ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--brand-dark);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-size: 13px;
  z-index: 200;
  box-shadow: var(--sh-md);
  opacity: 0;
  transform: translateY(20px);
  transition: all var(--t-base);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
