/* ============================================
   Pomodoro Timer — Styles
   NatureTimers.com/pomodoro
   ============================================ */

/* CSS Variables */
:root {
  --nature-green: #34c759;
  --dark-green: #207848;
  --light-green: #66e58b;
  --break-blue: #007aff;
  --break-blue-dark: #0051d5;
  --long-break-purple: #af52de;
  --urgent-orange: #ff9500;
  --critical-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: border-color 0.5s ease;
  position: relative;
  overflow: hidden;
}

.timer-container.break-mode {
  border-color: rgba(0, 122, 255, 0.4);
}

.timer-container.long-break-mode {
  border-color: rgba(175, 82, 222, 0.4);
}

/* 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;
}

.timer-container.break-mode .timer-display {
  color: var(--break-blue);
}

.timer-container.long-break-mode .timer-display {
  color: var(--long-break-purple);
}

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

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

.timer-display.critical {
  color: var(--critical-red) !important;
  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 bar */
.timer-progress {
  width: 100%;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  margin: 0 auto 1.5rem;
  overflow: hidden;
  max-width: 320px;
}

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

.timer-container.break-mode .timer-progress-bar {
  background: var(--break-blue);
}

.timer-container.long-break-mode .timer-progress-bar {
  background: var(--long-break-purple);
}

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

/* Session dots */
.session-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.session-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-card);
  transition: var(--transition);
  position: relative;
}

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

.session-dot.current {
  border: 2px solid var(--nature-green);
  background: transparent;
}

.timer-container.break-mode .session-dot.current {
  border-color: var(--break-blue);
}

/* 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-break {
  background: var(--break-blue);
  color: white;
}
.btn-break:not(:disabled):hover {
  background: var(--break-blue-dark);
}

/* ============================================
   Nature Sounds
   ============================================ */
.nature-sounds {
  margin: 2rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
}

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

.sounds-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.volume-control label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  background: var(--bg-card);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--nature-green);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--nature-green);
  cursor: pointer;
  border: none;
}

.sound-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.sound-btn {
  padding: 0.625rem 1rem;
  border: 2px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  background: var(--bg-light);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

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

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

/* ============================================
   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(--urgent-orange);
}

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

.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;
}

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

/* ============================================
   Toast Notification (replaces alert())
   ============================================ */
.toast-container {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--bg-subtle);
  border: 2px solid var(--nature-green);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  pointer-events: auto;
  animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
}

.toast.break-toast {
  border-color: var(--break-blue);
}

.toast-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.toast-body {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

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

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(-10px); }
}

/* Flash overlay */
.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.break-flash {
  background: rgba(0, 122, 255, 0.15);
}

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

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

/* ============================================
   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;
}

/* ============================================
   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;
}

/* ============================================
   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%;
  }

  .sound-buttons {
    flex-direction: column;
  }

  .sound-btn {
    width: 100%;
    justify-content: center;
  }

  .progress-stats {
    gap: 0.5rem;
  }

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

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

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

  .volume-control {
    display: none;
  }
}

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