/* Base styles and CSS Variables */
:root {
  --primary-color: #3a86ff;
  --primary-hover: #2563eb;
  --success-color: #2ecc71;
  --danger-color: #e74c3c;
  --text-color: #f0f0f0; /* Light text for dark background */
  --bg-color: rgba(0, 0, 0, 0.95); /* Dark semi-transparent background */
  --card-color: #1e1e1e; /* Dark card color */
  --border-color: #333; /* Dark border color */
  --border-radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --focus-ring: 0 0 0 3px rgba(58, 134, 255, 0.4);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* Container */
.container {
  width: 100%;
  max-width: 90vw;
  padding: 2rem;
  text-align: center;
}

/* Typography */
h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Timer */
.timer {
  font-family: "Roboto Mono", monospace;
  font-size: clamp(3rem, 10vw, 8rem); /* Reduced from clamp(5rem, 15vw, 12rem) */
  font-weight: 300;
  margin: 0.5rem 0; /* Reduced from 1rem 0 */
  line-height: 1.1; /* Slightly reduced line height */
  color: var(--primary-color);
}

/* Status */
.status {
  font-size: clamp(1.2rem, 4vw, 2rem);
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.8);
}

/* Task Form */
.task-form {
  margin: 1.5rem 0;
}

.task-form input {
  width: 100%;
  max-width: 500px;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1.2rem;
  transition: var(--transition);
  background-color: #2d2d2d; /* Dark input background */
  color: var(--text-color);
}

.task-form input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: var(--focus-ring);
}

/* Buttons */
.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.buttons button {
  padding: 1rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  color: #fff;
  min-width: 120px;
}

.start {
  background-color: var(--primary-color);
}

.start:hover {
  background-color: var(--primary-hover);
}

.break {
  background-color: var(--success-color);
}

.stop {
  background-color: var(--danger-color);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Stats section */
.stats {
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  width: 100%;
  max-width: 500px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Noise Controls */
.noise-controls {
  background: var(--card-color);
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  text-align: center;
  margin-top: 1.5rem;
}

.noise-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.noise-buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.noise-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--border-radius);
  background-color: var(--primary-color);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.noise-btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.noise-stop {
  background-color: var(--danger-color);
}

.noise-stop:hover {
  background-color: darken(var(--danger-color), 10%);
}

.volume-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--text-color);
  margin-top: 8px;
}

.volume-control input {
  appearance: none;
  width: 120px;
  height: 8px;
  border-radius: 5px;
  background: var(--border-color);
  outline: none;
  transition: var(--transition);
}

.volume-control input::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
}

.volume-control input::-webkit-slider-thumb:hover {
  background: var(--primary-hover);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .buttons {
    flex-direction: column;
    gap: 0.5rem;
  }

  .buttons button {
    width: 100%;
  }

  .stats {
    padding-top: 0.5rem;
  }

  .stat-row {
    font-size: 0.9rem;
  }

  .noise-controls {
    padding: 0.75rem;
  }

  .noise-title {
    font-size: 1.1rem;
  }

  .noise-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
  }

  .volume-control {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .timer {
    font-size: 3rem; /* Reduced from 4rem */
  }

  .buttons {
    flex-direction: column;
  }

  .buttons button {
    width: 100%;
  }

  .task-form input {
    font-size: 1rem;
    padding: 0.75rem;
  }

  .stat-row {
    font-size: 0.8rem;
  }

  .noise-controls {
    padding: 0.5rem;
  }

  .noise-title {
    font-size: 0.9rem;
  }

  .noise-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }

  .volume-control {
    font-size: 0.75rem;
  }
}

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