/* =========================================================
   TRYTRACK BASE.CSS
   Foundation layer: reset, design tokens, typography,
   body styling, accessibility, scrollbars and utilities.
========================================================= */

/* =========================================================
   RESET
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* =========================================================
   DESIGN TOKENS
========================================================= */

:root {
  --bg: #07111f;
  --bg-deep: #020617;
  --bg-soft: #0f172a;

  --surface: rgba(15, 23, 42, 0.84);
  --surface-strong: rgba(15, 23, 42, 0.94);
  --surface-soft: rgba(30, 41, 59, 0.62);
  --surface-muted: rgba(2, 6, 23, 0.44);
  --surface-glass: rgba(15, 23, 42, 0.72);

  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --border-glow: rgba(56, 189, 248, 0.35);

  --text: #f8fafc;
  --text-soft: #e2e8f0;
  --muted: #94a3b8;
  --muted-strong: #cbd5e1;

  --primary: #38bdf8;
  --primary-dark: #2563eb;
  --primary-soft: rgba(56, 189, 248, 0.14);
  --primary-faint: rgba(56, 189, 248, 0.07);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --success-faint: rgba(34, 197, 94, 0.07);

  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --warning-faint: rgba(245, 158, 11, 0.07);

  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.14);
  --danger-faint: rgba(239, 68, 68, 0.07);

  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-dark));
  --gradient-surface: linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(2, 6, 23, 0.72));
  --gradient-card-glow: radial-gradient(circle at top right, rgba(56, 189, 248, 0.14), transparent 36%);

  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-2xl: 32px;
  --radius-pill: 999px;

  --shadow-xs: 0 4px 12px rgba(0, 0, 0, 0.16);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.20);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.26);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.32);
  --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.12);

  --sidebar-width: 300px;
  --sidebar-gap: 20px;
  --page-pad: 32px;
  --content-max: 1600px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 36px;
  --space-10: 40px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;

  --font-xs: 11px;
  --font-sm: 12px;
  --font-md: 13px;
  --font-base: 14px;
  --font-lg: 15px;
  --font-xl: 18px;
  --font-2xl: 22px;
  --font-3xl: 30px;
  --font-4xl: 40px;
  --font-5xl: 54px;

  --ease: 0.20s ease;
  --ease-slow: 0.32s cubic-bezier(0.22, 1, 0.36, 1);

  --z-sidebar: 20;
  --z-overlay: 99998;
  --z-menu: 99999;
  --z-toast: 99999;
  --z-loader: 99999;
}

/* =========================================================
   BODY / GLOBAL THEME
========================================================= */

body {
  font-family:
    Inter,
    SF Pro Display,
    SF Pro Text,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);
  font-size: var(--font-lg);
  line-height: 1.6;

  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.10), transparent 28%),
    linear-gradient(180deg, #07111f 0%, #020617 100%);

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.menu-open {
  overflow: hidden;
}

/* =========================================================
   TYPOGRAPHY
========================================================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h1 { font-size: clamp(28px, 3.8vw, 44px); line-height: 1.02; }
h2 { font-size: clamp(22px, 2.8vw, 30px); }
h3 { font-size: 18px; }
h4 { font-size: 15px; }

p {
  color: inherit;
  line-height: 1.65;
}

small {
  color: var(--muted);
  font-size: 12px;
}

strong {
  font-weight: 800;
}

::selection {
  background: rgba(56, 189, 248, 0.28);
  color: #ffffff;
}

/* =========================================================
   GLOBAL TRANSITIONS / FOCUS STATES
========================================================= */

a,
button,
input,
select,
textarea,
.content-card,
.form-card,
.stat-card,
.report-card,
.team-status-item,
.notification-item,
.list-item {
  transition:
    background var(--ease),
    border-color var(--ease),
    box-shadow var(--ease),
    color var(--ease),
    opacity var(--ease),
    transform var(--ease);
}

:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 3px;
}

/* =========================================================
   SCROLLBARS
========================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.35) rgba(15, 23, 42, 0.5);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}

*::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.32);
  border-radius: 999px;
  border: 2px solid rgba(15, 23, 42, 0.5);
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.52);
}

/* =========================================================
   TEXT HELPERS
========================================================= */

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;

  padding: 6px 12px;

  border-radius: var(--radius-pill);

  background: var(--primary-soft);
  color: var(--primary);

  font-size: 11px;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.small-text,
.section-subtitle,
.chart-subtitle {
  color: var(--muted);
  line-height: 1.5;
}

.small-text { font-size: var(--font-md); }
.section-subtitle { margin-top: 6px; font-size: 14px; }
.chart-subtitle { margin-top: -10px; margin-bottom: 16px; font-size: 13px; }

.text-muted    { color: var(--muted) !important; }
.text-soft     { color: var(--text-soft) !important; }
.text-success  { color: #86efac !important; }
.text-warning  { color: #fcd34d !important; }
.text-danger   { color: #fca5a5 !important; }
.text-primary  { color: var(--primary) !important; }

/* =========================================================
   SURFACE HELPERS
========================================================= */

.glass-surface {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.soft-surface {
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.faint-surface {
  background: var(--surface-muted);
  border: 1px solid rgba(148, 163, 184, 0.10);
}

/* =========================================================
   GLOBAL UTILITIES
========================================================= */

.hidden     { display: none !important; }
.invisible  { visibility: hidden !important; }
.full-width { width: 100% !important; }
.full-height { height: 100% !important; }
.no-wrap    { white-space: nowrap; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.center-content { display: grid; place-items: center; }

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.flex-start {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: var(--space-4);
}

.flex-column { display: flex; flex-direction: column; }

.gap-sm { gap: var(--space-3); }
.gap-md { gap: var(--space-5); }
.gap-lg { gap: var(--space-8); }

.mt-sm { margin-top: var(--space-3); }
.mt-md { margin-top: var(--space-5); }
.mt-lg { margin-top: var(--space-8); }

.mb-sm { margin-bottom: var(--space-3); }
.mb-md { margin-bottom: var(--space-5); }
.mb-lg { margin-bottom: var(--space-8); }

/* =========================================================
   EMPTY / ACCESS STATES
========================================================= */

.access-empty-state,
.empty-state {
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  background: rgba(2, 6, 23, 0.38);
  border: 1px dashed rgba(148, 163, 184, 0.22);
  color: var(--muted);
}

.access-empty-state strong,
.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 15px;
}

.access-empty-state p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

/* =========================================================
   SAFARI-SAFE
========================================================= */

canvas {
  display: block;
  max-width: 100%;
}

/* =========================================================
   RESPONSIVE BASE TOKENS
========================================================= */

@media (max-width: 1200px) {
  :root { --page-pad: 24px; }
}

@media (max-width: 700px) {
  :root { --page-pad: 18px; }
  h1 { font-size: 28px; }
}

@media (max-width: 480px) {
  :root { --page-pad: 14px; }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
