/* ==========================================================================
   Apple Human Interface Guidelines (HIG) Theme for GymLog
   OLED Dark Foundation, Glassmorphism, SF Typography, iOS System Colors
   ========================================================================== */

:root {
  /* Color Palette: OLED Dark Foundation */
  --bg-primary: #000000;
  --bg-secondary: #1C1C1E;
  --bg-tertiary: #2C2C2E;
  --bg-elevated: #242426;
  --bg-glass: rgba(28, 28, 30, 0.78);
  --bg-glass-heavy: rgba(18, 18, 20, 0.88);
  
  /* Separators & Hairlines */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-highlight: rgba(255, 255, 255, 0.25);
  
  /* Text Colors (Apple Vibrancy Hierarchy) */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(235, 235, 245, 0.65);
  --text-tertiary: rgba(235, 235, 245, 0.38);
  --text-quaternary: rgba(235, 235, 245, 0.20);
  
  /* Apple Dynamic System Accents */
  --apple-blue: #0A84FF;
  --apple-blue-rgb: 10, 132, 255;
  --apple-green: #30D158;
  --apple-green-rgb: 48, 209, 88;
  --apple-orange: #FF9F0A;
  --apple-orange-rgb: 255, 159, 10;
  --apple-red: #FF453A;
  --apple-red-rgb: 255, 69, 58;
  --apple-purple: #BF5AF2;
  --apple-purple-rgb: 191, 90, 242;
  --apple-indigo: #5E5CE6;
  --apple-mint: #63E6E2;
  --apple-cyan: #64D2FF;
  
  /* Component Accents */
  --accent-primary: var(--apple-blue);
  --accent-success: var(--apple-green);
  --accent-warning: var(--apple-orange);
  --accent-danger: var(--apple-red);

  /* Apple Corner Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Typography: SF Pro Stacks */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px rgba(10, 132, 255, 0.25);
  --shadow-glass: 0 4px 30px rgba(0, 0, 0, 0.5);

  /* Layout and Safe Areas */
  --max-width: 680px;
  --header-height: 56px;
  --tab-bar-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Base Reset & Smooth Rendering */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-system);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.015em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overscroll-behavior-y: none;
}

/* Typography Hierarchy */
h1, .apple-title-1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

h2, .apple-title-2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h3, .apple-title-3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

h4, .apple-headline {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

p, .apple-body {
  font-size: 15px;
  color: var(--text-secondary);
}

.apple-caption {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Application Container */
#app-container {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 32px);
}

/* Glass Header */
.apple-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 20px 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  object-fit: cover;
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Main Viewport Container */
.view-viewport {
  flex: 1;
  padding: 16px 20px;
}

.view-section {
  display: none;
  animation: appleFadeIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.view-section.active {
  display: block;
}

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

/* Universal SVG Icon System for Apple HIG & iOS Safari */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  min-width: 1em;
  min-height: 1em;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}

.svg-icon svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

