/* Trustro Financial Management System — shared component styles */

:root {
  --ts-blue: #2563eb;
  --ts-blue-dark: #1e40af;
  --ts-ink: #0f172a;
  --ts-muted: #64748b;
  --ts-line: #e2e8f0;
  --ts-bg: #eef2f7;
  --ts-card: #ffffff;
}

body {
  font-family: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
  background: var(--ts-bg);
  color: var(--ts-ink);
  -webkit-font-smoothing: antialiased;
}

.font-display { font-family: 'Space Grotesk', ui-sans-serif, sans-serif; }
.font-mono-app { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* --- form controls --- */
.form-input {
  width: 100%;
  border: 1px solid var(--ts-line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--ts-ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--ts-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.form-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ts-muted);
  margin-bottom: 0.375rem;
}
select.form-input { appearance-none; }
textarea.form-input { resize: vertical; }

/* --- cards / tables --- */
.card {
  background: var(--ts-card);
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px -6px rgba(15, 23, 42, .10);
}
.card-pad { padding: 1.25rem 1.5rem; }
.table-theme th {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ts-muted);
  background: #f1f5f9;
  text-align: left;
  padding: 0.625rem 0.85rem;
  white-space: nowrap;
}
.table-theme td {
  font-size: 0.8125rem;
  padding: 0.625rem 0.85rem;
  border-top: 1px solid var(--ts-line);
  vertical-align: middle;
}
.table-theme tr:hover td { background: #f8fafc; }

/* --- status chip --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03) inset;
  white-space: nowrap;
}

/* --- sidebar --- */
.side-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #cbd5e1;
  transition: all .15s;
}
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .22), rgba(37, 99, 235, .05));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .35);
}

/* --- metric icon tile --- */
.tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.65rem;
  font-weight: 800;
  font-size: 0.9rem;
}

/* --- progress bar --- */
.bar-track { height: 0.5rem; border-radius: 9999px; background: #e2e8f0; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9999px; }

/* --- toast --- */
.toast-wrap {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 21rem;
}

@media (max-width: 640px) {
  .toast-wrap {
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
  }
}

/* --- buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 1px 3px rgba(37, 99, 235, .25); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  transition: background .15s, border-color .15s;
}
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  color: #475569;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  transition: background .15s;
}
.btn-ghost:hover { background: #f1f5f9; }

.btn-money {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: #059669;
  color: #fff;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.btn-money:hover { background: #047857; box-shadow: 0 1px 3px rgba(5, 150, 105, .25); }
.btn-money:active { transform: scale(0.97); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.6875rem; }

/* --- modal backdrop (used by all modals) --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .60);
  backdrop-filter: blur(4px);
}
.modal-backdrop.is-open { display: flex; }

.modal-card {
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, .25);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card-sm { max-width: 28rem; }
.modal-card-md { max-width: 36rem; }
.modal-card-lg { max-width: 48rem; }

.modal-title {
  font-family: 'Space Grotesk', ui-sans-serif, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
}

/* --- empty state --- */
.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* --- login bg --- */
.login-bg {
  background:
    radial-gradient(1000px 500px at 90% -10%, rgba(37, 99, 235, .18), transparent 60%),
    radial-gradient(800px 400px at 0% 110%, rgba(16, 185, 129, .14), transparent 60%),
    #f8fafc;
}

/* ===================================================================
   Animations & micro-interactions
   =================================================================== */

/* --- progress bar grow --- */
@keyframes barGrow {
  from { width: 0; }
}
.bar-fill[data-animate] {
  animation: barGrow .8s cubic-bezier(.22, 1, .36, 1) forwards;
}

/* --- counter count-up --- */
@keyframes countUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.counter-animate {
  opacity: 0;
  animation: countUp .4s ease forwards;
}

/* --- card hover lift --- */
.card-lift {
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .08);
}

/* --- sidebar hover glow --- */
.side-link {
  position: relative;
}
.side-link:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  box-shadow: inset 2px 0 0 rgba(96, 165, 250, .5);
}
.side-link.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .25), rgba(37, 99, 235, .06));
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, .6), 0 0 12px rgba(37, 99, 235, .08);
}

/* --- page header gradient text --- */
.page-title {
  background: linear-gradient(135deg, #0f172a 40%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- content fade-in --- */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- toast slide-in --- */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-wrap > div {
  animation: toastIn .3s cubic-bezier(.22, 1, .36, 1) forwards;
}

/* --- toast slide-out --- */
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}

/* --- table row hover --- */
.table-theme tbody tr {
  transition: background .12s ease;
}
.table-theme tbody tr:hover td {
  background: #f1f5f9;
}

/* --- status chip pulse --- */
@keyframes chipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, .15); }
  50%      { box-shadow: 0 0 0 4px rgba(37, 99, 235, 0); }
}
.chip-pulse {
  animation: chipPulse 2s ease-in-out infinite;
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .bar-fill[data-animate],
  .toast-wrap > div {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .card-lift:hover { transform: none; }
}