/* ============================================
   FundVault — Base Styles
   Reset, typography, scrollbar, utilities
   ============================================ */

/* ── CSS Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  font-size: var(--fs-14);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background-color: var(--bg-page);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── Custom Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ── Selection ── */
::selection {
  background: var(--color-blue-light);
  color: var(--text-brand);
}

/* ── Links ── */
a {
  text-decoration: none;
  color: var(--text-link);
  transition: color var(--transition-fast);
}

a:hover {
  color: #006bbf;
}

/* ── Lists ── */
ul, ol {
  list-style: none;
}

/* ── Images ── */
img {
  max-width: 100%;
  display: block;
}

/* ── Buttons ── */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
  color: inherit;
}

/* ── Inputs ── */
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
  border: none;
  background: none;
  color: inherit;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

/* ── Tables ── */
table {
  border-collapse: collapse;
  border-spacing: 0;
  width: 100%;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-brand);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
}

h1 { font-size: var(--fs-28); }
h2 { font-size: var(--fs-24); }
h3 { font-size: var(--fs-20); }
h4 { font-size: var(--fs-18); }
h5 { font-size: var(--fs-16); }
h6 { font-size: var(--fs-14); }

p {
  line-height: var(--lh-normal);
  color: var(--text-secondary);
}

strong, b {
  font-weight: var(--fw-semibold);
}

small {
  font-size: var(--fs-12);
}

/* ── Utility: Text ── */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-brand { color: var(--text-brand); }
.text-white { color: var(--text-white); }
.text-link { color: var(--text-link); }
.text-up { color: var(--color-up); }
.text-down { color: var(--color-down); }
.text-warning { color: var(--color-warning-dark); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-medium { font-weight: var(--fw-medium); }
.text-semibold { font-weight: var(--fw-semibold); }
.text-bold { font-weight: var(--fw-bold); }

.text-xs { font-size: var(--fs-10); }
.text-sm { font-size: var(--fs-12); }
.text-base { font-size: var(--fs-14); }
.text-lg { font-size: var(--fs-16); }
.text-xl { font-size: var(--fs-18); }
.text-2xl { font-size: var(--fs-20); }
.text-3xl { font-size: var(--fs-24); }

.text-uppercase { text-transform: uppercase; }
.text-capitalize { text-transform: capitalize; }

.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-nowrap { white-space: nowrap; }

.numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ── Utility: Display ── */
.d-none { display: none !important; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

/* ── Utility: Flex ── */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); }
.gap-6 { gap: var(--sp-6); }
.gap-7 { gap: var(--sp-7); }
.gap-8 { gap: var(--sp-8); }

/* ── Utility: Spacing ── */
.m-0 { margin: 0; }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-7 { margin-top: var(--sp-7); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-7 { margin-bottom: var(--sp-7); }
.ml-3 { margin-left: var(--sp-3); }
.mr-3 { margin-right: var(--sp-3); }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0 { padding: 0; }
.p-3 { padding: var(--sp-3); }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.p-6 { padding: var(--sp-6); }
.p-7 { padding: var(--sp-7); }

/* ── Utility: Sizing ── */
.w-full { width: 100%; }
.w-fit { width: fit-content; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ── Utility: Position ── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ── Utility: Misc ── */
.pointer { cursor: pointer; }
.no-select { user-select: none; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn var(--transition-normal) both; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease-out both; }
.animate-scale-in { animation: scaleIn 0.3s ease-out both; }
.animate-slide-right { animation: slideInRight 0.4s ease-out both; }

/* Staggered animation delays */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-dark-grey) 25%, var(--border-light) 50%, var(--bg-dark-grey) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Page transition wrapper ── */
.page-enter {
  animation: fadeInUp 0.35s ease-out both;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  h1 { font-size: var(--fs-24); }
  h2 { font-size: var(--fs-20); }
  h3 { font-size: var(--fs-18); }
  h4 { font-size: var(--fs-16); }
}
