/* ============================================================
   Fine Dashboard — Base Styles
   Reset, typography, global utilities
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  overflow-x: hidden;
  min-height: 100vh;
}

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

/* ── Scrollbar (Webkit) ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

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

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

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

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

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

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

button {
  cursor: pointer;
}

/* ── Utility Classes ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-accent    { color: var(--color-accent); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }

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

/* ── Animation Keyframes ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

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

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

.animate-fade-in {
  animation: fadeIn 0.5s var(--transition-base) forwards;
}

.animate-fade-in-scale {
  animation: fadeInScale 0.4s var(--transition-base) forwards;
}

/* ── Skeleton Loading ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    var(--color-bg) 37%,
    var(--color-border) 63%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 12px;
  margin-bottom: 8px;
  width: 100%;
}

.skeleton-text--lg {
  height: 24px;
  width: 60%;
  margin-bottom: 6px;
}

.skeleton-text--md {
  height: 16px;
  width: 80%;
}

.skeleton-text--sm {
  height: 10px;
  width: 50%;
}

/* Mirrors the real .kpi-tile shape: a small eyebrow (icon + label) sitting
   above a separate value card — kept in sync with css/components.css so the
   loading state doesn't flash/jump into a differently-shaped card once real
   data lands */
.skeleton-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  animation: fadeIn 0.5s var(--transition-base) forwards;
  opacity: 0;
}

.skeleton-kpi:nth-child(1) { animation-delay: 0.05s; }
.skeleton-kpi:nth-child(2) { animation-delay: 0.10s; }
.skeleton-kpi:nth-child(3) { animation-delay: 0.15s; }
.skeleton-kpi:nth-child(4) { animation-delay: 0.20s; }
.skeleton-kpi:nth-child(5) { animation-delay: 0.25s; }
.skeleton-kpi:nth-child(6) { animation-delay: 0.30s; }

.skeleton-kpi__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 2px;
}

.skeleton-kpi .skeleton-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-kpi__card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: calc(var(--space-5) + 2px) var(--space-5) var(--space-5) var(--space-6);
  border: 1px solid var(--color-border-light);
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.skeleton-table-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
}

.skeleton-table-row:last-child {
  border-bottom: none;
}

.skeleton-table-row .skeleton-cell {
  height: 14px;
  border-radius: var(--radius-sm);
}

/* ── Sidebar Skeleton ── */
.skeleton-sidebar-filter {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.skeleton-sidebar-filter__header {
  margin-bottom: var(--space-2);
}

.skeleton-sidebar-filter__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
