/* ===================================================================
   PULSO — BASE STYLES & CSS VARIABLES
   Common foundation for all Pulso pages (NR-1/NR-17 compliance app)
   Last updated: 2026-04-05
=================================================================== */

/* ======= CSS VARIABLES (Theme System) ======= */
:root {
  --bg: #060918;              /* Dark background */
  --card: #0d1117;            /* Card surface */
  --card2: #161b22;           /* Secondary card (slightly lighter) */
  --border: #1e2a3a;          /* Border color (subdued) */
  --teal: #14b8a6;            /* Primary accent (MioSpace) */
  --cyan: #06b6d4;            /* Secondary cyan */
  --purple: #8b5cf6;          /* Purple accent */
  --amber: #f59e0b;           /* Warning / Attention */
  --red: #ef4444;             /* Error / Critical */
  --green: #22c55e;           /* Success / Positive */
  --text: #f1f5f9;            /* Primary text */
  --dim: #94a3b8;             /* Secondary text (dimmed) */

  /* Region colors (Body Map regions) */
  --pe: #f97316;              /* Orange: Pé (Foot) */
  --tornozelo: #fb923c;       /* Amber: Tornozelo (Ankle) */
  --quadril: #a78bfa;         /* Purple: Quadril (Hip) */
  --lombar: #60a5fa;          /* Blue: Lombar (Lower back) */
  --toracica: #34d399;        /* Green: Torácica (Thoracic) */
  --ombro: #f472b6;           /* Pink: Ombro (Shoulder) */
  --cervical: #38bdf8;        /* Cyan: Cervical (Neck) */
  --atm: #e879f9;             /* Purple: ATM (Jaw) */
  --respiracao: #14b8a6;      /* Teal: Respiração (Breathing) */
}

/* ======= CSS RESET ======= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* ======= ACCESSIBILITY: PREFERS-REDUCED-MOTION ======= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ======= BASE BODY STYLES ======= */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ======= SKIP LINK (Accessibility) ======= */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--teal);
  color: var(--bg);
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  z-index: 99999;
  transition: top 0.2s ease-out;
}

.skip-link:focus {
  top: 0;
}

/* ======= CONTAINER STYLES ======= */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ======= CARD STYLES (Glass Morphism Pattern) ======= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ======= KPI STYLES (Key Performance Indicators) ======= */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: clamp(20px, 5vw, 32px);
  font-weight: 800;
  color: var(--teal);
  line-height: 1.2;
}

/* ======= TYPOGRAPHY ======= */
.page-title {
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--teal) 0%, #a78bfa 60%, #f472b6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 15px;
  color: var(--dim);
  line-height: 1.6;
  max-width: 600px;
}

.page-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

/* ======= FOCUS STYLES (Keyboard Navigation) ======= */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ======= LAYOUT WRAPPERS ======= */
.page-wrapper {
  padding-top: 68px;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* ======= ANIMATIONS ======= */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes skeleton-loading {
  0%, 100% {
    background: var(--card);
    opacity: 0.5;
  }
  50% {
    background: var(--card2);
    opacity: 1;
  }
}

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

/* ======= SPINNER (Loading state) ======= */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ======= UTILITY: HIDDEN ======= */
.hidden {
  display: none !important;
}

/* ======= RESPONSIVE BREAKPOINTS ======= */
@media (max-width: 768px) {
  .container-main {
    padding: 0 16px;
  }

  .page-wrapper {
    padding-top: 60px;
    padding-bottom: 60px;
  }

  .kpi-row {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .container-main {
    padding: 0 12px;
  }

  .page-title {
    font-size: 20px;
  }

  .kpi-row {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 24px;
  }
}
