/**
 * =========================================
 *    PWA Training Tracker - Global Styles
 *    (Web Components Version)
 * =========================================
 *
 * @format
 * 
 * Note: Component-specific styles are now in Shadow DOM.
 * This file contains only CSS variables, resets, and global states.
 */

:root {
  /* Core Colors */
  --bg-primary: #050505;
  --bg-secondary: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #1a1a1a;

  /* Accent Colors */
  --neon-green: #00ff41;
  --neon-green-dim: #00cc34;
  --neon-green-glow: rgba(0, 255, 65, 0.3);
  --safety-red: #ff3b3b;
  --safety-red-dim: #cc2f2f;
  --safety-red-glow: rgba(255, 59, 59, 0.3);

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #666666;

  /* Typography */
  --font-main:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-xxl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* =========================================
   Reset & Base Styles
   ========================================= */

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   App Container
   ========================================= */

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  /* Space for the fixed bottom nav, plus the safe-area inset it already
     grows by on notched/home-indicator devices (env() is 0 elsewhere). */
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.main-content > * {
  width: 100%;
  max-width: 700px;
}

body.workout-active .main-content {
  padding-bottom: 0;
}

body.workout-active .main-content > * {
  max-width: 100%;
}

/* =========================================
   Loading State
   ========================================= */

.loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

.loading__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--neon-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading__text {
  margin-top: var(--spacing-md);
  color: var(--text-secondary);
}

/* =========================================
   Error State
   ========================================= */

.error {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
  padding: var(--spacing-lg);
}

.error__icon {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
}

.error__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
}

.error__message {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
}

/* =========================================
   Button (for error screen only)
   ========================================= */

.btn {
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 1.25rem;
  font-weight: 700;
  padding: var(--spacing-md) var(--spacing-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn--primary {
  background: var(--neon-green);
  color: #000000;
  box-shadow: 0 0 20px var(--neon-green-glow);
}

.btn--primary:hover,
.btn--primary:focus {
  background: var(--neon-green-dim);
  transform: scale(1.02);
  box-shadow: 0 0 30px var(--neon-green-glow);
}

/* =========================================
   Utility Classes
   ========================================= */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
