/* CSS Variables for theming */
:root {
  --color-primary: #6b46c1;
  --color-primary-dark: #553c9a;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-background: #f9fafb;
  --color-surface: #ffffff;
  --color-text: #111827;
  --color-text-secondary: #6b7280;
  --border-radius: 12px;
  --spacing-unit: 8px;
  --transition-speed: 0.2s;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation; /* Prevent double-tap zoom */
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  padding: calc(var(--spacing-unit) * 2);
}

/* Header */
.app-header {
  text-align: center;
  padding: calc(var(--spacing-unit) * 3) 0;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

/* Main Content */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 3);
}

/* Statistics Section */
.statistics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(var(--spacing-unit) * 2);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 2);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-unit);
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  font-weight: 600;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
}

/* Timer Display */
.timer-display {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 4);
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timer-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--spacing-unit);
}

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

/* Controls */
.controls {
  margin-top: auto;
  padding: calc(var(--spacing-unit) * 2) 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--spacing-unit) * 2);
}

.btn-primary {
  width: 100%;
  min-height: 60px;
  font-size: 20px;
  font-weight: 600;
  color: white;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition:
    background-color var(--transition-speed),
    transform var(--transition-speed);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:active {
  transform: scale(0.98);
  background-color: var(--color-primary-dark);
}

.btn-cancel {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 2px solid var(--color-text-secondary);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition:
    background-color var(--transition-speed),
    transform var(--transition-speed),
    border-color var(--transition-speed);
  -webkit-tap-highlight-color: transparent;
}

.btn-cancel:active {
  transform: scale(0.98);
  background-color: var(--color-background);
  border-color: var(--color-text);
}

.btn-undo {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
  font-weight: 600;
  color: white;
  background-color: #f59e0b;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition:
    background-color var(--transition-speed),
    transform var(--transition-speed);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  -webkit-tap-highlight-color: transparent;
}

.btn-undo:active {
  transform: scale(0.98);
  background-color: #d97706;
}

#undo-timer {
  font-size: 14px;
  opacity: 0.9;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: calc(var(--spacing-unit) * 2) 0;
}

.disclaimer {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Responsive breakpoints */
@media (min-width: 768px) {
  .stat-value {
    font-size: 32px;
  }

  .timer-value {
    font-size: 64px;
  }
}

/* Empty State */
.empty-state {
  background: var(--color-surface);
  border-radius: var(--border-radius);
  padding: calc(var(--spacing-unit) * 4);
  text-align: center;
  margin-bottom: calc(var(--spacing-unit) * 2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.empty-state p {
  color: var(--color-text-secondary);
  margin-bottom: calc(var(--spacing-unit) * 1);
}

.empty-state-hint {
  font-size: 14px;
  font-style: italic;
}

/* Pulsing animation for active timer */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.pulsing {
  animation: pulse 2s ease-in-out infinite;
}

/* Enhanced button states */
.btn-primary:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

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

/* Loading state (if needed) */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  .pulsing {
    animation: none;
  }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #111827;
    --color-surface: #1f2937;
    --color-text: #f9fafb;
    --color-text-secondary: #9ca3af;
  }
}
