/* ============================================
   Active Breaks — Styles
   NatureTimers.com/active-breaks
   ============================================ */

/* CSS Variables */
:root {
  --nature-green: #34c759;
  --dark-green: #207848;
  --light-green: #66e58b;
  --active-orange: #ff9500;
  --active-orange-dark: #cc7700;
  --urgent-red: #ff3b30;
  --text-primary: #1d1d1f;
  --text-secondary: #8e8e93;
  --bg-light: #ffffff;
  --bg-subtle: #f5f5f7;
  --bg-card: #f0f0f2;
  --glass-bg: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(52, 199, 89, 0.2);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --transition: all 0.3s ease;
  --border-radius: 16px;
  --border-radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-light: #1c1c1e;
    --bg-subtle: #2c2c2e;
    --bg-card: #3a3a3c;
    --text-primary: #f5f5f7;
    --text-secondary: #98989d;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--nature-green);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { top: 0; }

/* ============================================
   Header
   ============================================ */
header {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 1.5rem;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.1rem;
}
.logo:hover { color: var(--nature-green); }

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: var(--transition);
}
nav a:hover { color: var(--nature-green); }

/* ============================================
   Main Content
   ============================================ */
main {
  flex: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Hero */
.hero {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.tagline .highlight {
  color: var(--nature-green);
  font-weight: 500;
}

/* ============================================
   Timer Container
   ============================================ */
.timer-container {
  background: var(--bg-subtle);
  border: 2px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2.5rem 2rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

/* Mode indicator */
.mode-indicator {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Timer Display */
.timer-display {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 5rem;
  font-weight: 700;
  color: var(--nature-green);
  text-align: center;
  margin: 1rem 0 1.5rem;
  letter-spacing: 0.05em;
  transition: color 0.5s ease;
  position: relative;
}

.timer-display.running {
  animation: gentle-pulse 3s ease-in-out infinite;
}

.timer-display.urgent {
  color: var(--active-orange);
  animation: urgent-pulse 1s ease-in-out infinite;
}

.timer-display.critical {
  color: var(--urgent-red);
  animation: critical-pulse 0.5s ease-in-out infinite;
}

@keyframes gentle-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

@keyframes urgent-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes critical-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.02); }
}

/* Progress ring under timer */
.timer-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  margin: 0 auto 1.5rem;
  overflow: hidden;
  max-width: 300px;
}

.timer-progress-bar {
  height: 100%;
  background: var(--nature-green);
  border-radius: 3px;
  transition: width 1s linear, background-color 0.5s ease;
  width: 100%;
}

.timer-progress-bar.urgent { background: var(--active-orange); }
.timer-progress-bar.critical { background: var(--urgent-red); }

/* Controls */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: inherit;
  min-width: 120px;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:not(:disabled):active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--nature-green);
  color: white;
}
.btn-primary:not(:disabled):hover { background: var(--dark-green); }

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-primary);
  border: 2px solid var(--glass-border);
}
.btn-secondary:not(:disabled):hover {
  border-color: var(--nature-green);
  color: var(--nature-green);
}

.btn-warning {
  background: var(--active-orange);
  color: white;
}
.btn-warning:not(:disabled):hover { background: var(--active-orange-dark); }

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  min-width: auto;
  border-radius: 8px;
}

/* ============================================
   Squat Activity Screen
   ============================================ */
.squat-screen {
  display: none;
  text-align: center;
  animation: slideUp 0.4s ease;
}

.squat-screen.active {
  display: block;
}

.timer-screen.hidden {
  display: none;
}

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

.squat-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--active-orange);
  margin-bottom: 0.25rem;
}

.squat-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Squat figure */
.squat-figure {
  width: 120px;
  height: 160px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.squat-figure svg {
  width: 100%;
  height: 100%;
}

.squat-figure .figure-body { fill: none; stroke: var(--nature-green); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.squat-figure .figure-head { fill: var(--nature-green); }

/* Rep counter */
.rep-counter {
  margin: 1.5rem 0;
}

.rep-display {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--nature-green);
  margin-bottom: 0.25rem;
}

.rep-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rep-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--nature-green);
  color: white;
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 1.5rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(52, 199, 89, 0.3);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.rep-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(52, 199, 89, 0.4);
}

.rep-btn:active {
  transform: scale(0.95);
}

.rep-btn .rep-btn-icon {
  font-size: 2rem;
  line-height: 1;
}

.rep-btn .rep-btn-text {
  font-size: 0.85rem;
  opacity: 0.9;
}

.rep-btn.complete {
  background: var(--active-orange);
  box-shadow: 0 4px 20px rgba(255, 149, 0, 0.3);
}

.rep-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 1rem 0;
}

.rep-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-card);
  transition: var(--transition);
}

.rep-dot.filled {
  background: var(--nature-green);
  transform: scale(1.15);
}

.squat-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* ============================================
   Daily Progress
   ============================================ */
.progress-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-subtle);
  border-radius: var(--border-radius);
  border: 1px solid var(--glass-border);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.progress-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.15), rgba(255, 149, 0, 0.05));
  border: 1px solid rgba(255, 149, 0, 0.3);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--active-orange);
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--nature-green);
  display: block;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Workday progress bar */
.workday-progress {
  margin-top: 1rem;
}

.workday-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.workday-bar {
  width: 100%;
  height: 10px;
  background: var(--bg-card);
  border-radius: 5px;
  overflow: hidden;
}

.workday-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--nature-green), var(--light-green));
  border-radius: 5px;
  transition: width 0.5s ease;
}

/* Motivational message */
.motivation {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  min-height: 1.4em;
}

/* ============================================
   Presets / Settings
   ============================================ */
.settings-section {
  margin: 2rem 0;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: var(--transition);
}

.settings-toggle:hover {
  border-color: var(--nature-green);
  color: var(--nature-green);
}

.settings-toggle .chevron {
  transition: transform 0.3s ease;
  font-size: 0.7rem;
}

.settings-toggle.open .chevron {
  transform: rotate(180deg);
}

.settings-panel {
  display: none;
  margin-top: 1rem;
  padding: 1.5rem;
  background: var(--bg-subtle);
  border-radius: var(--border-radius);
  border: 1px solid var(--glass-border);
  animation: slideUp 0.3s ease;
}

.settings-panel.open {
  display: block;
}

/* Preset tabs */
.preset-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.preset-tab {
  flex: 1;
  padding: 0.65rem;
  border: 2px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  background: var(--bg-light);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  font-family: inherit;
}

.preset-tab:hover {
  border-color: var(--nature-green);
}

.preset-tab.active {
  background: var(--nature-green);
  color: white;
  border-color: var(--nature-green);
}

.preset-label {
  font-size: 0.7rem;
  display: block;
  opacity: 0.8;
  margin-top: 2px;
}

/* Custom settings fields */
.custom-fields {
  display: none;
}

.custom-fields.visible {
  display: block;
}

.field-group {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.field-input {
  flex: 1;
  padding: 0.625rem 0.875rem;
  border: 2px solid var(--glass-border);
  border-radius: 8px;
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition);
  -webkit-appearance: none;
}

.field-input:focus {
  outline: none;
  border-color: var(--nature-green);
}

.field-unit {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 40px;
}

select.field-input {
  cursor: pointer;
}

/* Workday scheduler */
.scheduler {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--glass-border);
}

.scheduler-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.scheduler-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 80px;
}

input[type="time"] {
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--glass-border);
  border-radius: 8px;
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

input[type="time"]:focus {
  outline: none;
  border-color: var(--nature-green);
}

/* Sound toggle */
.sound-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
}

.sound-toggle-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  background: var(--text-secondary);
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch.on {
  background: var(--nature-green);
}

.toggle-switch.on::after {
  left: 23px;
}

/* ============================================
   Info Section (SEO)
   ============================================ */
.info-section {
  background: var(--bg-subtle);
  border-radius: var(--border-radius);
  padding: 2rem;
  margin: 3rem 0;
}

.info-section h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.info-section p:last-child {
  margin-bottom: 0;
}

.citation {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 1rem;
}

.citation a {
  color: var(--nature-green);
  text-decoration: none;
}

.citation a:hover {
  text-decoration: underline;
}

/* ============================================
   Tool Links / CTA
   ============================================ */
.flagship-cta {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.1), rgba(52, 199, 89, 0.05));
  border-radius: var(--border-radius);
  border: 2px solid var(--nature-green);
  margin: 2rem 0;
}

.flagship-cta p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.flagship-cta a {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: var(--nature-green);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  transition: var(--transition);
}

.flagship-cta a:hover {
  background: var(--dark-green);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.tool-links {
  text-align: center;
  margin: 3rem 0 2rem;
  padding: 2rem;
  background: var(--glass-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--glass-border);
}

.tool-links h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.tool-grid {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-light);
  border: 2px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
}

.tool-link:hover {
  border-color: var(--nature-green);
  color: var(--nature-green);
  transform: translateY(-2px);
}

.tool-link.coming-soon {
  opacity: 0.6;
  cursor: not-allowed;
}

.tool-link.coming-soon:hover {
  transform: none;
  border-color: var(--glass-border);
  color: var(--text-primary);
}

/* ============================================
   Footer
   ============================================ */
footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--glass-border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

footer a {
  color: var(--nature-green);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ============================================
   Confetti / Celebration
   ============================================ */
.celebration-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.celebration-overlay.active {
  display: block;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(-10vh) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg);
  }
}

/* Flash notification */
.flash-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(52, 199, 89, 0.15);
  z-index: 999;
  pointer-events: none;
  animation: flash 0.6s ease-out;
}

.flash-overlay.active {
  display: block;
}

@keyframes flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
  h1 { font-size: 1.5rem; }
  .tagline { font-size: 1rem; }
  .timer-display { font-size: 3.5rem; }
  .timer-container { padding: 2rem 1.5rem; }

  .controls {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .squat-actions {
    flex-direction: column;
  }

  .squat-actions .btn {
    width: 100%;
  }

  .rep-btn {
    width: 120px;
    height: 120px;
  }

  .progress-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .preset-tabs {
    flex-direction: column;
  }

  .tool-grid {
    flex-direction: column;
  }

  .tool-link {
    width: 100%;
    justify-content: center;
  }

  .scheduler-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  header, footer, .controls, .settings-section, .tool-links, .flagship-cta, .squat-screen {
    display: none;
  }
}
