/* Material Design 3 - Simple Timer
 * Based on M3 guidelines: https://m3.material.io/styles/color/system/overview
 */

:root {
  /* Sport & Fitness Color System - Dynamic & Energetic */
  --md-sys-color-primary: #FF5722;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #FFE0D6;
  --md-sys-color-on-primary-container: #5C1900;
  
  --md-sys-color-secondary: #00BCD4;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #B3F5FF;
  --md-sys-color-on-secondary-container: #00363D;
  
  --md-sys-color-tertiary: #FF9100;
  --md-sys-color-on-tertiary: #FFFFFF;
  --md-sys-color-tertiary-container: #FFE0B2;
  --md-sys-color-on-tertiary-container: #4A2800;
  
  --md-sys-color-error: #D32F2F;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #FFCDD2;
  --md-sys-color-on-error-container: #5F0000;
  
  --md-sys-color-background: #FAFAFA;
  --md-sys-color-on-background: #212121;
  
  --md-sys-color-surface: #FFFFFF;
  --md-sys-color-on-surface: #212121;
  --md-sys-color-surface-variant: #F5F5F5;
  --md-sys-color-on-surface-variant: #616161;
  
  --md-sys-color-outline: #9E9E9E;
  --md-sys-color-outline-variant: #E0E0E0;
  
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #FCFCFC;
  --md-sys-color-surface-container: #F8F8F8;
  --md-sys-color-surface-container-high: #F3F3F3;
  --md-sys-color-surface-container-highest: #EEEEEE;
  
  --md-sys-color-inverse-surface: #212121;
  --md-sys-color-inverse-on-surface: #FAFAFA;
  --md-sys-color-inverse-primary: #FF8A65;
  
  /* M3 Elevation */
  --md-sys-elevation-0: 0px 0px 0px 0px rgba(0, 0, 0, 0);
  --md-sys-elevation-1: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-2: 0px 1px 2px 0px rgba(0, 0, 0, 0.3), 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-3: 0px 1px 3px 0px rgba(0, 0, 0, 0.3), 0px 4px 8px 3px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-4: 0px 2px 3px 0px rgba(0, 0, 0, 0.3), 0px 6px 10px 4px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-5: 0px 4px 4px 0px rgba(0, 0, 0, 0.3), 0px 8px 12px 6px rgba(0, 0, 0, 0.15);
  
  /* M3 Shape */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;
  
  /* M3 Typography */
  --md-sys-typescale-display-large: 400 57px/64px 'Roboto', sans-serif;
  --md-sys-typescale-display-medium: 400 45px/52px 'Roboto', sans-serif;
  --md-sys-typescale-display-small: 400 36px/44px 'Roboto', sans-serif;
  
  --md-sys-typescale-headline-large: 400 32px/40px 'Roboto', sans-serif;
  --md-sys-typescale-headline-medium: 400 28px/36px 'Roboto', sans-serif;
  --md-sys-typescale-headline-small: 400 24px/32px 'Roboto', sans-serif;
  
  --md-sys-typescale-title-large: 400 22px/28px 'Roboto', sans-serif;
  --md-sys-typescale-title-medium: 500 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-title-small: 500 14px/20px 'Roboto', sans-serif;
  
  --md-sys-typescale-body-large: 400 16px/24px 'Roboto', sans-serif;
  --md-sys-typescale-body-medium: 400 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-body-small: 400 12px/16px 'Roboto', sans-serif;
  
  --md-sys-typescale-label-large: 500 14px/20px 'Roboto', sans-serif;
  --md-sys-typescale-label-medium: 500 12px/16px 'Roboto', sans-serif;
  --md-sys-typescale-label-small: 500 11px/16px 'Roboto', sans-serif;
  
  /* State Layers */
  --md-sys-state-hover-opacity: 0.08;
  --md-sys-state-focus-opacity: 0.12;
  --md-sys-state-pressed-opacity: 0.12;
  --md-sys-state-dragged-opacity: 0.16;
}

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

body {
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-background);
  background: linear-gradient(180deg, #FAFAFA 0%, #F5F5F5 100%);
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 50%, rgba(255, 87, 34, 0.03) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(0, 188, 212, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile */
  align-items: center;
  justify-content: flex-start;
}

/* Header - M3 Top App Bar - Sport Edition */
.app-header {
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-tertiary) 100%);
  color: #FFFFFF;
  padding: 16px 24px;
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

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

.app-title {
  font: var(--md-sys-typescale-title-large);
  font-size: 32px;
  color: #FFFFFF;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  text-align: center;
  margin: 0 auto;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 700px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.content-section {
  display: none;
  width: 100%;
}

.content-section.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.3s ease-out;
  width: 100%;
}

/* Workout Selector */
.workout-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 600px;
}

.workout-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  background-color: var(--md-sys-color-surface-container);
  border: 2px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  min-height: 80px;
  position: relative;
  overflow: hidden;
}

.workout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-tertiary) 100%);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
  z-index: 0;
}

.workout-btn:hover::before {
  opacity: 0.08;
}

.workout-btn:hover {
  border-color: var(--md-sys-color-primary);
  transform: translateY(-2px);
  box-shadow: var(--md-sys-elevation-2);
}

.workout-btn.active {
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-tertiary) 100%);
  border-color: var(--md-sys-color-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.4);
  transform: translateY(-1px);
}

.workout-btn.active::before {
  opacity: 1;
}

.workout-btn-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}

.workout-btn.active .workout-btn-title {
  color: #FFFFFF;
}

.workout-btn-desc {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  position: relative;
  z-index: 1;
}

.workout-btn.active .workout-btn-desc {
  color: rgba(255, 255, 255, 0.9);
}

/* Interval Info Display */
.interval-info {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(255, 87, 34, 0.05) 0%, rgba(0, 188, 212, 0.05) 100%);
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid rgba(255, 87, 34, 0.1);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.interval-name {
  font-size: 32px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow: 0 2px 4px rgba(255, 87, 34, 0.2);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.interval-description {
  font-size: 18px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 12px;
  font-style: italic;
}

.workout-progress {
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Interval type-specific styles */
.interval-info.work {
  background: linear-gradient(135deg, rgba(255, 87, 34, 0.1) 0%, rgba(255, 145, 0, 0.08) 100%);
  border-color: rgba(255, 87, 34, 0.2);
}

.interval-info.work .interval-name {
  color: #FF5722;
  animation: pulse 1.5s ease-in-out infinite;
}

.interval-info.rest {
  background: linear-gradient(135deg, rgba(0, 188, 212, 0.1) 0%, rgba(0, 172, 193, 0.08) 100%);
  border-color: rgba(0, 188, 212, 0.2);
}

.interval-info.rest .interval-name {
  color: #00BCD4;
}

.interval-info.prepare {
  background: linear-gradient(135deg, rgba(255, 145, 0, 0.1) 0%, rgba(255, 87, 34, 0.08) 100%);
  border-color: rgba(255, 145, 0, 0.2);
}

.interval-info.prepare .interval-name {
  color: #FF9100;
}

.interval-info.cooldown {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(0, 188, 212, 0.08) 100%);
  border-color: rgba(76, 175, 80, 0.2);
}

.interval-info.cooldown .interval-name {
  color: #4CAF50;
}

/* Intervals List */
.intervals-list {
  margin-top: 32px;
  width: 100%;
  max-width: 600px;
}

.intervals-list-title {
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 16px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--md-sys-shape-corner-small);
  transition: background-color 0.2s ease;
}

.intervals-list-title:hover {
  background-color: var(--md-sys-color-surface-container);
}

.toggle-icon {
  font-size: 12px;
  transition: transform 0.3s cubic-bezier(0.2, 0, 0, 1);
  display: none; /* Hidden on desktop */
}

.intervals-list-title.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

/* Show toggle icon only on mobile */
@media (max-width: 640px) {
  .toggle-icon {
    display: inline-block;
  }
  
  .intervals-list-title {
    cursor: pointer;
  }
}

/* Hide toggle on desktop */
@media (min-width: 641px) {
  .intervals-list-title {
    cursor: default;
  }
}

.intervals-container {
  max-height: 400px;
  transition: max-height 0.3s cubic-bezier(0.2, 0, 0, 1), opacity 0.3s ease;
  overflow: hidden;
  opacity: 1;
}

.intervals-container.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding: 0;
}

/* Override duplicate - merge properties */
.intervals-container:not(.collapsed) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-medium);
  scroll-behavior: smooth;
  overscroll-behavior: contain; /* Prevent scroll chaining to page */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Custom scrollbar for intervals list */
.intervals-container::-webkit-scrollbar {
  width: 8px;
}

.intervals-container::-webkit-scrollbar-track {
  background: var(--md-sys-color-surface-variant);
  border-radius: 4px;
}

.intervals-container::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-primary);
  border-radius: 4px;
}

.intervals-container::-webkit-scrollbar-thumb:hover {
  background: var(--md-sys-color-tertiary);
}

.interval-item {
  display: grid;
  grid-template-columns: 40px 1fr 60px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-small);
  border-left: 4px solid var(--md-sys-color-outline);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.interval-item:hover {
  box-shadow: var(--md-sys-elevation-1);
  transform: translateX(4px);
}

.interval-item.active {
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.25);
  transform: translateX(8px) scale(1.02);
  border-left-width: 6px;
}

.interval-item.active .interval-item-number {
  transform: scale(1.1);
  font-weight: 900;
}

.interval-item.active .interval-item-name {
  font-weight: 700;
  font-size: 15px;
}

.interval-item.work {
  border-left-color: #FF5722;
  background: linear-gradient(90deg, rgba(255, 87, 34, 0.03) 0%, var(--md-sys-color-surface) 100%);
}

.interval-item.rest {
  border-left-color: #00BCD4;
  background: linear-gradient(90deg, rgba(0, 188, 212, 0.03) 0%, var(--md-sys-color-surface) 100%);
}

.interval-item.prepare {
  border-left-color: #FF9100;
  background: linear-gradient(90deg, rgba(255, 145, 0, 0.03) 0%, var(--md-sys-color-surface) 100%);
}

.interval-item.cooldown {
  border-left-color: #4CAF50;
  background: linear-gradient(90deg, rgba(76, 175, 80, 0.03) 0%, var(--md-sys-color-surface) 100%);
}

.interval-item-number {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-full);
  font-weight: 700;
  font-size: 14px;
  color: var(--md-sys-color-on-surface-variant);
}

.interval-item.work .interval-item-number {
  background-color: rgba(255, 87, 34, 0.15);
  color: #FF5722;
}

.interval-item.rest .interval-item-number {
  background-color: rgba(0, 188, 212, 0.15);
  color: #00BCD4;
}

.interval-item.prepare .interval-item-number {
  background-color: rgba(255, 145, 0, 0.15);
  color: #FF9100;
}

.interval-item.cooldown .interval-item-number {
  background-color: rgba(76, 175, 80, 0.15);
  color: #4CAF50;
}

.interval-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.interval-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--md-sys-color-on-surface);
}

.interval-item-desc {
  font-size: 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-style: italic;
}

.interval-item-time {
  font-weight: 700;
  font-size: 16px;
  color: var(--md-sys-color-primary);
  text-align: right;
}

/* About Tabata Section */
.about-tabata {
  width: 100%;
  max-width: 600px;
  margin: 24px auto 0;
}

.about-tabata-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  padding: 12px 16px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-medium);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
}

.about-tabata-title:hover {
  background-color: var(--md-sys-color-surface-container-high);
  box-shadow: var(--md-sys-elevation-1);
}

.about-tabata-title .toggle-icon {
  display: inline-block;
}

.about-tabata-title.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.about-container {
  max-height: 800px;
  transition: max-height 0.4s cubic-bezier(0.2, 0, 0, 1), opacity 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 1;
}

.about-container.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding: 0;
  overflow: hidden;
}

.about-container:not(.collapsed) {
  padding: 16px;
  background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-medium);
  scroll-behavior: smooth;
}

.about-section {
  padding: 16px;
  margin-bottom: 12px;
  background-color: var(--md-sys-color-surface);
  border-radius: var(--md-sys-shape-corner-small);
  border-left: 4px solid var(--md-sys-color-primary);
}

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

.about-section.warning {
  border-left-color: #FF9100;
  background: linear-gradient(135deg, #FFF3E0 0%, var(--md-sys-color-surface) 100%);
}

.about-section h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--md-sys-color-primary);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-section.warning h4 {
  color: #FF9100;
}

.about-section p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.about-section ul {
  margin: 8px 0 0 0;
  padding-left: 20px;
}

.about-section li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--md-sys-color-on-surface);
  margin-bottom: 6px;
}

.about-section li:last-child {
  margin-bottom: 0;
}

.about-section strong {
  color: var(--md-sys-color-primary);
  font-weight: 600;
}

/* Card - M3 Elevated Card - Sport Edition */
.card {
  background: linear-gradient(145deg, #FFFFFF 0%, var(--md-sys-color-surface-container) 100%);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-2);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  border: 1px solid rgba(255, 87, 34, 0.08);
  width: 100%;
  max-width: 600px;
}

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

/* Card urgent state - for last 3 seconds */
.card.urgent {
  border-color: rgba(211, 47, 47, 0.3);
  box-shadow: 0 0 30px rgba(211, 47, 47, 0.25);
  animation: cardPulse 0.6s ease-in-out infinite;
}

@keyframes cardPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(211, 47, 47, 0.2);
  }
  50% {
    box-shadow: 0 0 40px rgba(211, 47, 47, 0.4);
  }
}

.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.card-title {
  font: var(--md-sys-typescale-headline-small);
  color: var(--md-sys-color-on-surface);
  margin-bottom: 8px;
}

.card-subtitle {
  font: var(--md-sys-typescale-body-medium);
  color: var(--md-sys-color-on-surface-variant);
}

/* Timer Display */
.timer-display {
  text-align: center;
  margin: 48px 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.timer-time {
  font-size: 96px;
  font-weight: 700;
  line-height: 1;
  color: var(--md-sys-color-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  transition: all 0.5s cubic-bezier(0.2, 0, 0, 1);
  text-shadow: 0 2px 8px rgba(255, 87, 34, 0.15);
  will-change: color, transform;
}

/* Timer Controls */
.timer-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap; /* Always in a row */
  width: 100%;
}

/* Buttons - M3 Filled Button, Filled Tonal Button */
.btn {
  position: relative;
  padding: 10px 24px;
  border: none;
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  min-width: 100px;
  overflow: hidden;
  box-shadow: var(--md-sys-elevation-0);
}

/* Icon buttons - circular for symbols */
.btn-icon-large {
  min-width: 64px;
  width: 64px;
  height: 64px;
  max-width: 64px;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  justify-content: center;
  border-radius: var(--md-sys-shape-corner-full);
}

.btn-symbol {
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
}

/* Hover effects for symbols */
.btn:hover .btn-symbol {
  transform: scale(1.1);
}

.btn:active .btn-symbol {
  transform: scale(0.9);
}

/* Specific symbol adjustments */
.btn-primary .btn-symbol {
  /* Play button - slight offset for visual balance */
  padding-left: 3px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.btn:hover::before {
  opacity: var(--md-sys-state-hover-opacity);
}

.btn:focus::before {
  opacity: var(--md-sys-state-focus-opacity);
}

.btn:active {
  box-shadow: var(--md-sys-elevation-1);
  transform: translateY(0) scale(0.98);
}

.btn:active::before {
  opacity: var(--md-sys-state-pressed-opacity);
}

/* Primary Button - M3 Filled Button - Sport Edition */
.btn-primary {
  background: linear-gradient(135deg, var(--md-sys-color-primary) 0%, var(--md-sys-color-tertiary) 100%);
  color: var(--md-sys-color-on-primary);
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.95);
}

/* Secondary Button - M3 Filled Tonal Button - Sport Edition */
.btn-secondary {
  background: linear-gradient(135deg, var(--md-sys-color-secondary) 0%, #00ACC1 100%);
  color: #FFFFFF;
  font-weight: 600;
}

.btn-secondary:hover {
  box-shadow: 0 4px 16px rgba(0, 188, 212, 0.35);
  transform: translateY(-2px);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.95);
}

/* Tertiary Button - M3 Outlined Button */
.btn-tertiary {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

/* Disabled State */
.btn:disabled {
  background-color: rgba(28, 27, 31, 0.12);
  color: rgba(28, 27, 31, 0.38);
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled::before {
  display: none;
}

/* Form Input - M3 Filled Text Field - Sport Edition */
.form-input {
  padding: 12px 16px;
  border: 2px solid transparent;
  border-bottom: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small) 0 0;
  background-color: var(--md-sys-color-surface-container-highest);
  font: var(--md-sys-typescale-body-large);
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  transition: all 0.3s cubic-bezier(0.2, 0, 0, 1);
  outline: none;
  text-align: center;
}

.form-input:hover {
  border-bottom-color: var(--md-sys-color-primary);
  background-color: var(--md-sys-color-surface);
}

.form-input:focus {
  border-bottom-width: 3px;
  border-bottom-color: var(--md-sys-color-primary);
  padding-bottom: 11px;
  box-shadow: 0 4px 12px rgba(255, 87, 34, 0.15);
  background-color: #FFFFFF;
}

.form-input::placeholder {
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.6;
}

/* Animations - Sport Edition */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ripple {
  from {
    transform: scale(0);
    opacity: 0.4;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    text-shadow: 0 2px 8px rgba(255, 87, 34, 0.15);
  }
  50% {
    transform: scale(1.02);
    text-shadow: 0 4px 16px rgba(255, 87, 34, 0.3);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
  }
  50% {
    box-shadow: 0 6px 24px rgba(255, 87, 34, 0.5);
  }
}

@keyframes urgentPulse {
  0%, 100% {
    transform: scale(1) translateX(0);
    text-shadow: 
      0 0 25px rgba(211, 47, 47, 0.9),
      0 0 50px rgba(255, 87, 34, 0.7),
      0 0 75px rgba(255, 145, 0, 0.5),
      0 0 100px rgba(255, 87, 34, 0.3);
  }
  25% {
    transform: scale(1.06) translateX(-3px);
    text-shadow: 
      0 0 35px rgba(211, 47, 47, 1),
      0 0 70px rgba(255, 87, 34, 0.9),
      0 0 105px rgba(255, 145, 0, 0.7),
      0 0 140px rgba(255, 87, 34, 0.5);
  }
  50% {
    transform: scale(1.1) translateX(0);
    text-shadow: 
      0 0 45px rgba(211, 47, 47, 1),
      0 0 90px rgba(255, 87, 34, 1),
      0 0 135px rgba(255, 145, 0, 0.9),
      0 0 180px rgba(255, 87, 34, 0.7);
  }
  75% {
    transform: scale(1.06) translateX(3px);
    text-shadow: 
      0 0 35px rgba(211, 47, 47, 1),
      0 0 70px rgba(255, 87, 34, 0.9),
      0 0 105px rgba(255, 145, 0, 0.7),
      0 0 140px rgba(255, 87, 34, 0.5);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-5px) rotate(-1deg); }
  20% { transform: translateX(5px) rotate(1deg); }
  30% { transform: translateX(-4px) rotate(-0.8deg); }
  40% { transform: translateX(4px) rotate(0.8deg); }
  50% { transform: translateX(-3px) rotate(-0.6deg); }
  60% { transform: translateX(3px) rotate(0.6deg); }
  70% { transform: translateX(-2px) rotate(-0.4deg); }
  80% { transform: translateX(2px) rotate(0.4deg); }
  90% { transform: translateX(-1px) rotate(-0.2deg); }
}

/* Add pulse animation to timer when running */
.timer-time.active {
  animation: pulse 2s ease-in-out infinite;
}

/* Urgent state - LAST 3 SECONDS with intense glow and shake */
.timer-time.urgent {
  animation: urgentPulse 0.6s ease-in-out infinite, shake 0.4s ease-in-out infinite !important;
  filter: brightness(1.3) saturate(1.2);
  transform-origin: center center;
}

/* Warning state - approaching end */
.timer-time.warning {
  animation: pulse 1s ease-in-out infinite;
  text-shadow: 
    0 0 15px rgba(255, 145, 0, 0.6),
    0 0 30px rgba(255, 87, 34, 0.4);
}

.btn-primary.active {
  animation: glow 2s ease-in-out infinite;
}

/* Mobile Optimization - Priority: Timer → Buttons → Intervals */
@media (max-width: 640px) {
  /* Reduce body padding to maximize viewport */
  body {
    overflow-x: hidden;
  }
  
  .main-content {
    padding: 12px;
    max-width: 100%;
  }
  
  /* Timer display - PRIORITY #1 - Always visible */
  .timer-time {
    font-size: 80px !important;
    margin-bottom: 8px;
  }
  
  .timer-display {
    margin: 16px 0 !important;
  }
  
  /* Card - less padding for more space */
  .card {
    padding: 12px;
    max-width: 100%;
  }
  
  /* Interval info - compact */
  .interval-info {
    padding: 10px;
    margin-bottom: 12px;
  }
  
  .interval-name {
    font-size: 18px;
    margin-bottom: 4px;
  }
  
  .interval-description {
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .workout-progress {
    font-size: 11px;
  }
  
  /* Timer controls - PRIORITY #2 */
  .timer-controls {
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: nowrap !important;
  }
  
  .btn-icon-large {
    width: 56px;
    height: 56px;
    min-width: 56px;
    max-width: 56px;
    flex-shrink: 0;
  }
  
  .btn-symbol {
    font-size: 24px;
  }
  
  /* Workout selector - compact */
  .workout-selector {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 100%;
    margin-bottom: 12px;
  }
  
  .workout-btn {
    min-height: 60px;
    padding: 8px 6px;
  }
  
  .workout-btn-title {
    font-size: 15px;
  }
  
  .workout-btn-desc {
    font-size: 10px;
  }
  
  /* Intervals list - MINIMIZED on mobile */
  .intervals-list {
    max-width: 100%;
    margin-top: 16px;
  }
  
  .intervals-list-title {
    font-size: 14px;
    margin-bottom: 8px;
    padding: 12px;
    background-color: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-corner-small);
  }
  
  .toggle-icon {
    font-size: 14px;
    font-weight: bold;
  }
  
  .intervals-container:not(.collapsed) {
    max-height: 180px !important; /* Much smaller on mobile */
    padding: 4px;
  }
  
  .interval-item {
    padding: 8px;
    gap: 6px;
    grid-template-columns: 32px 1fr 50px;
  }

  /* About Tabata - compact on mobile */
  .about-tabata {
    margin-top: 16px;
  }

  .about-tabata-title {
    font-size: 14px;
    padding: 12px;
  }

  .about-container:not(.collapsed) {
    max-height: 400px;
  }

  .about-section {
    padding: 12px;
    margin-bottom: 8px;
  }

  .about-section h4 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .about-section p,
  .about-section li {
    font-size: 13px;
  }
  
  .interval-item-number {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }
  
  .interval-item-name {
    font-size: 12px;
  }
  
  .interval-item-desc {
    font-size: 10px;
    display: none; /* Hide descriptions on mobile to save space */
  }
  
  .interval-item-time {
    font-size: 13px;
  }
  
  /* Card header - compact */
  .card-header {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }
  
  .card-title {
    font-size: 16px;
    margin-bottom: 4px;
  }
  
  .card-subtitle {
    font-size: 11px;
  }
  
  /* Workout selector - very compact */
  .workout-btn-title {
    font-size: 14px;
    margin-bottom: 2px;
  }
  
  .workout-btn-desc {
    font-size: 9px;
  }
  
  /* Header - compact on mobile */
  .app-header {
    padding: 12px 16px;
  }
  
  .app-title {
    font-size: 24px;
  }
}

/* Extra small mobile - even more compact */
@media (max-width: 480px) {
  .timer-time {
    font-size: 64px !important;
  }
  
  .app-header {
    padding: 10px 12px;
  }
  
  .app-title {
    font-size: 22px;
  }
  
  .card-title {
    font-size: 15px;
  }
  
  .main-content {
    padding: 8px;
  }
  
  .card {
    padding: 10px;
  }
  
  .interval-name {
    font-size: 16px;
  }
  
  .interval-description {
    font-size: 12px;
  }
  
  .workout-progress {
    font-size: 10px;
  }
  
  .intervals-container:not(.collapsed) {
    max-height: 150px !important; /* Even smaller */
  }
  
  .btn-icon-large {
    width: 52px;
    height: 52px;
    min-width: 52px;
    max-width: 52px;
    flex-shrink: 0;
  }
  
  .btn-symbol {
    font-size: 22px;
  }
  
  .timer-controls {
    gap: 10px;
  }
  
  .workout-btn {
    min-height: 50px;
    padding: 6px 4px;
  }
  
  .workout-btn-title {
    font-size: 13px;
  }
  
  .workout-btn-desc {
    font-size: 8px;
  }
  
  .interval-info {
    padding: 8px;
    margin-bottom: 10px;
  }
  
  .timer-display {
    margin: 12px 0 !important;
  }
  
  .timer-controls {
    margin-bottom: 10px;
  }
}

/* Landscape mode on mobile - optimize horizontal space */
@media (max-width: 768px) and (orientation: landscape) {
  .timer-time {
    font-size: 56px !important;
    margin: 8px 0;
  }
  
  .timer-display {
    margin: 16px 0 !important;
  }
  
  .interval-info {
    padding: 8px;
    margin-bottom: 12px;
  }
  
  .intervals-container {
    max-height: 120px !important;
  }
  
  .card {
    padding: 12px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Visible for Keyboard Navigation */
.btn:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.form-input:focus-visible {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -2px;
}

/* Dark Theme Support (system preference) - Sport Edition */
@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #FF8A65;
    --md-sys-color-on-primary: #5C1900;
    --md-sys-color-primary-container: #8E2800;
    --md-sys-color-on-primary-container: #FFD0BC;
    
    --md-sys-color-secondary: #4DD0E1;
    --md-sys-color-on-secondary: #00363D;
    --md-sys-color-secondary-container: #00627A;
    --md-sys-color-on-secondary-container: #B3F5FF;
    
    --md-sys-color-tertiary: #FFB74D;
    --md-sys-color-on-tertiary: #4A2800;
    --md-sys-color-tertiary-container: #6F3800;
    --md-sys-color-on-tertiary-container: #FFE0B2;
    
    --md-sys-color-error: #EF5350;
    --md-sys-color-on-error: #5F0000;
    --md-sys-color-error-container: #B71C1C;
    --md-sys-color-on-error-container: #FFCDD2;
    
    --md-sys-color-background: #1A1A1A;
    --md-sys-color-on-background: #EEEEEE;
    
    --md-sys-color-surface: #1A1A1A;
    --md-sys-color-on-surface: #EEEEEE;
    --md-sys-color-surface-variant: #424242;
    --md-sys-color-on-surface-variant: #BDBDBD;
    
    --md-sys-color-outline: #757575;
    --md-sys-color-outline-variant: #424242;
    
    --md-sys-color-surface-container-lowest: #0D0D0D;
    --md-sys-color-surface-container-low: #1A1A1A;
    --md-sys-color-surface-container: #1F1F1F;
    --md-sys-color-surface-container-high: #2A2A2A;
    --md-sys-color-surface-container-highest: #333333;
    
    --md-sys-color-inverse-surface: #EEEEEE;
    --md-sys-color-inverse-on-surface: #212121;
    --md-sys-color-inverse-primary: #FF5722;
  }
  
  .btn:disabled {
    background-color: rgba(238, 238, 238, 0.12);
    color: rgba(238, 238, 238, 0.38);
  }

  .app-footer {
    background: rgba(30, 30, 30, 0.95);
    border-top: 1px solid rgba(255, 87, 34, 0.15);
  }

  .footer-text,
  .footer-subtext {
    color: rgba(238, 238, 238, 0.8);
  }

  .footer-text strong {
    color: #FFB74D;
  }
}

/* Footer Styles */
.app-footer {
  width: 100%;
  background: linear-gradient(135deg, rgba(255, 87, 34, 0.05) 0%, rgba(0, 188, 212, 0.05) 100%);
  border-top: 1px solid rgba(255, 87, 34, 0.1);
  padding: 24px 16px;
  margin-top: 32px;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-text {
  font-size: 15px;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 8px 0;
  font-weight: 400;
}

.footer-text strong {
  font-weight: 700;
  color: var(--md-sys-color-primary);
  font-size: 16px;
}

.footer-subtext {
  font-size: 13px;
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
  opacity: 0.8;
}

/* Footer responsive */
@media (max-width: 640px) {
  .app-footer {
    padding: 16px 12px;
    margin-top: 24px;
  }

  .footer-text {
    font-size: 14px;
  }

  .footer-text strong {
    font-size: 15px;
  }

  .footer-subtext {
    font-size: 12px;
  }
}
