/* Timer-specific styles */

/* Mode Toggle */
.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: #e5e5e5;
  border-radius: 10px;
  padding: 6px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  background: transparent;
  color: #666;
  cursor: pointer;
  min-height: 44px;
  transition: background-color 0.2s, color 0.2s, transform 0.1s;
}

.mode-btn:active {
  transform: scale(0.98);
}

.mode-btn.active {
  background: #fff;
  color: #333;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover:not(.active) {
  color: #333;
}

/* Timer Display */
.timer-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2rem 0;
}

.timer-time {
  min-width: 8ch;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2.8rem, 10vw, 4rem);
  font-variant-numeric: tabular-nums;
  color: #333;
  letter-spacing: -1.5px;
  text-align: center;
}

.timer-time.running {
  color: #007aff;
}

.timer-time.finished {
  color: #34c759;
  animation: pulse 0.5s ease-in-out 3;
}

.timer-time.completed {
  color: #4d8448;
}

.overtime-display {
  display: block;
  min-height: 1.5rem;
  font-size: 1.25rem;
  font-weight: 400;
  color: #ff3b30;
  margin-top: 0.25rem;
  visibility: hidden;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Countdown Input */
.countdown-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.time-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.time-input-group input {
  width: 84px;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  padding: 0.6rem;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.time-input-group input:focus {
  outline: none;
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}


.time-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
}

.time-separator {
  font-size: 1.5rem;
  font-weight: 500;
  color: #333;
  margin-bottom: 1rem;
}

/* Quick Presets */
.quick-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.preset-btn {
  padding: 0.65rem 1.15rem;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  min-height: 40px;
  transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
}

.preset-btn:active {
  transform: scale(0.98);
}

.preset-btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

.preset-btn:active {
  background: #007aff;
  border-color: #007aff;
  color: #fff;
}

/* Controls */
.timer-controls {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.control-btn {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s;
  border: none;
}

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

.control-btn.primary {
  background: #34c759;
  color: #fff;
}

.control-btn.primary:hover {
  background: #2db84e;
}

.control-btn.primary.stop {
  background: #ff3b30;
}

.control-btn.primary.stop:hover {
  background: #e6352b;
}

.control-btn.secondary {
  background: #e5e5e5;
  color: #333;
}

.control-btn.secondary:hover {
  background: #d5d5d5;
}

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

/* Laps Section */
.laps-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
}

.laps-heading {
  font-size: 0.875rem;
  font-weight: 600;
  color: #666;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.laps-list {
  max-height: 300px;
  overflow-y: auto;
}

.laps-list,
.history-list {
  overscroll-behavior: contain;
}

.lap-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.95rem;
}

.lap-item:last-child {
  border-bottom: none;
}

.lap-number {
  color: #666;
  font-weight: 500;
}

.lap-time {
  font-variant-numeric: tabular-nums;
  color: #333;
}

.lap-diff {
  font-size: 0.8rem;
  color: #666;
}

.lap-item.best .lap-time {
  color: #34c759;
}

.lap-item.worst .lap-time {
  color: #ff3b30;
}

/* History Section */
.history-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
}

.history-heading {
  font-size: 0.875rem;
  font-weight: 600;
  color: #666;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.85rem;
  background: #f8f8f8;
  border-radius: 10px;
  font-size: 0.95rem;
}

.history-duration {
  font-weight: 600;
  color: #333;
}

.history-time {
  font-size: 0.8rem;
  color: #999;
}

/* Hidden state */
.hidden {
  display: none !important;
}

/* Responsive */
@media (min-width: 600px) {
  .timer-time {
    font-size: 5rem;
  }

  .time-input-group input {
    width: 100px;
    font-size: 2rem;
  }

  .control-btn {
    width: 120px;
    height: 120px;
    font-size: 1.1rem;
  }
}

@media (max-width: 520px) {
  .mode-toggle {
    max-width: 100%;
  }

  .countdown-input {
    gap: 0.35rem;
  }

  .time-input-group input {
    width: 72px;
  }

  .time-separator {
    margin-bottom: 0.75rem;
  }

  .preset-btn {
    min-width: 64px;
  }

  .timer-controls {
    gap: 1rem;
  }

  .control-btn {
    width: 96px;
    height: 96px;
    font-size: 0.95rem;
  }

  .lap-item,
  .history-item {
    min-height: 48px;
  }
}
