/* --- Scoped Modern Focus Theme for WordPress --- */
.timer-container {
  /* Variables (Scoped) */
  --bg-color: #1e293b;
  --card-bg: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-work: #ef4444;
  /* Tomato Red */
  --accent-break: #10b981;
  /* Refresh Green */
  --accent-primary: #3b82f6;
  /* Action Blue */
  --input-bg: #1e293b;
  --border-radius: 12px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", "Menlo", monospace;

  /* Layout & Reset within container */
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  margin: 2rem auto;
  box-sizing: border-box;
}

/* Reset inner elements to avoid WP theme conflicts */
.timer-container *,
.timer-container *::before,
.timer-container *::after {
  box-sizing: inherit;
}

/* Typography override */
.timer-container h2,
.timer-container h3,
.timer-container p,
.timer-container label {
  color: var(--text-main);
  line-height: 1.5;
  margin: 0;
}

/* --- Components --- */

/* Usage Count Badge */
.timer-container .sticky-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 1.5rem;
  display: block;
  opacity: 0.8;
}

/* Input Rows */
.timer-container .timer-input,
.timer-container .row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* Labels */
.timer-container label {
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
}

/* Inputs */
.timer-container input[type="number"],
.timer-container input[type="text"],
.timer-container select {
  background-color: var(--bg-color);
  /* Darker than card */
  border: 1px solid #475569;
  color: var(--text-main);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: auto;
}

.timer-container input[type="number"]:focus,
.timer-container select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.timer-container input[type="number"] {
  width: 70px;
  width: 70px;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
  /* Remove spinner */
}

.timer-container input[type="number"]::-webkit-inner-spin-button,
.timer-container input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Unit Spacing */
.timer-container .unit {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
  margin-right: 0.75rem;
  /* Added margin after "min" */
}

/* Range Input - Remove Default Outline/Border */
.timer-container input[type="range"]:focus {
  outline: none;
  box-shadow: none;
  /* Removed glow from volume slider itself */
}

/* Buttons - Uniform Properties */
.timer-container button {
  font-family: var(--font-family);
  font-weight: 600;
  padding: 0.75rem 1rem;
  /* Slightly reduced horizontal padding for better fit */
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  height: 48px;
  /* Fixed height for alignment */
  flex: 1;
  /* Make buttons expand equally */
  min-width: 120px;
  /* Minimum width */
}

.timer-container #start-button {
  background: linear-gradient(135deg, var(--accent-primary), #2563eb);
  color: white;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.timer-container #start-button.stop-mode {
  background: linear-gradient(135deg, var(--accent-work), #dc2626);
  /* Red for Stop */
  box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.timer-container #start-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

.timer-container #start-button.stop-mode:hover {
  box-shadow: 0 6px 8px -1px rgba(239, 68, 68, 0.4);
}

.timer-container #start-button:active {
  transform: translateY(0);
}

.timer-container #reset-button,
.timer-container #expand-button {
  background-color: var(--card-bg);
  /* Match card background or slightly lighter */
  border: 1px solid #475569;
  color: var(--text-main);
  /* Brighter text */
  margin-left: 0.5rem;
}

.timer-container #reset-button:hover,
.timer-container #expand-button:hover {
  background-color: #475569;
  border-color: #64748b;
}

.timer-container #reset-button:disabled,
.timer-container #expand-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: transparent;
  border-color: #334155;
  color: var(--text-muted);
}

/* Timer Display Area */
/* Task Input Section */
.timer-container .task-section {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.timer-container #task-input {
  width: 100%;
  max-width: 600px;
  /* Increased width */
  background-color: var(--card-bg);
  border: 1px solid #475569;
  border-radius: 8px;
  color: var(--text-main);
  padding: 0.8rem 1rem;
  font-size: 1.1rem;
  text-align: center;
  transition: all 0.2s;
}

.timer-container #task-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background-color: #40526b;
  /* Slightly lighter on focus */
}

.timer-container #task-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Timer Display Area (Visual Timer) */
.timer-container .timer {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto 2rem auto;
  border-top: none;
  /* Removed the previous separator line */
  padding-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Modal Timer Specifics */
.timer-container .modal-timer-container {
  width: 400px;
  height: 400px;
  margin-bottom: 1rem;
}

.timer-container .progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.timer-container .progress-ring__circle-bg {
  width: 100%;
  height: 100%;
}

.timer-container .progress-ring__circle {
  transition: stroke-dashoffset 0.35s;
  transform-origin: 50% 50%;
  stroke-linecap: round;
  /* Circumference = 2 * PI * r = 2 * 3.14159 * 140 ≈ 879.64 */
  stroke-dasharray: 879.64;
  stroke-dashoffset: 0;
}

.timer-container .timer-text-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 100%;
}

#timer-display {
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  font-family: var(--font-mono);
  /* Monospace for stability */
  letter-spacing: -2px;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  margin-bottom: 0.5rem;
}

#timer-display.finished {
  color: var(--accent-break);
  text-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

#cycle-display {
  font-size: 1.1rem;
  color: var(--accent-primary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Modal Styling (Scoped) */
.timer-container #modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.85);
  /* Dark Blur Overlay */
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 10000;
  /* High z-index */
}

#modal-content {
  color: var(--text-main);
  transform: scale(0.9);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modalPop {
  to {
    transform: scale(1);
  }
}

#modal-time {
  font-size: 8rem;
  /* Massive time in modal */
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}

#modal-time.finished {
  color: var(--accent-work);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  }

  50% {
    transform: scale(1.05);
    text-shadow: 0 0 40px rgba(239, 68, 68, 0.6);
  }

  100% {
    transform: scale(1);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  }
}

#modal-cycle {
  font-size: 1.5rem;
  color: var(--text-muted);
}

/* Modal Task Display */
#modal-task-display {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 2rem;
  min-height: 3rem;
  /* Prevent layout shift if empty */
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid var(--accent-primary);
  /* Underline for style */
  display: inline-block;
  /* Wrap to text width */
  padding: 0 1rem 0.5rem 1rem;
}

.modal-info {
  margin-top: 2rem;
  color: #64748b;
  font-size: 0.9rem;
}

#close-modal {
  margin-top: 2rem;
  background: transparent;
  border: 1px solid var(--text-muted);
  color: var(--text-main);
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

#close-modal:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
}

/* Loading Dots */
#count-display.loading::after {
  content: ".";
  animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {

  0%,
  20% {
    content: ".";
  }

  40% {
    content: "..";
  }

  60% {
    content: "...";
  }

  90%,
  100% {
    content: "";
  }
}

/* Responsive */
@media (max-width: 600px) {
  .timer-container {
    padding: 1.5rem 1rem;
    margin: 10px;
  }

  #timer-display {
    font-size: 3.5rem;
  }

  #modal-time {
    font-size: 4rem;
  }

  .timer-container .row {
    gap: 0.5rem;
  }

  .timer-container input[type="number"] {
    padding: 0.5rem 0.2rem;
  }
}