/* ===========================
   VARIABELEN & RESET
=========================== */
:root {
  --green:  #4ade80;
  --orange: #fb923c;
  --red:    #f87171;
  --bg:     #0f172a;
  --card:   #1e293b;
  --border: #334155;
  --text:   #f1f5f9;
  --muted:  #94a3b8;
  --accent: #38bdf8;

  --progress-color: var(--green);
  --radius: 140px;
  --circumference: 879.65px; /* 2 * π * 140 */
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(56,189,248,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(74,222,128,0.06) 0%, transparent 60%);
}

/* ===========================
   APP CONTAINER
=========================== */
.app {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 2rem 1.5rem 2.5rem;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 25px 60px rgba(0,0,0,0.5);
}

/* ===========================
   HEADER
=========================== */
header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.logo {
  font-family: 'Baloo 2', cursive;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

/* ===========================
   TIMER CIRKEL
=========================== */
.timer-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto 2rem;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.track {
  fill: none;
  stroke: var(--border);
  stroke-width: 18;
}

.progress {
  fill: none;
  stroke: var(--progress-color);
  stroke-width: 18;
  stroke-linecap: round;
  stroke-dasharray: var(--circumference);
  stroke-dashoffset: var(--circumference);
  transition: stroke-dashoffset 0.9s linear, stroke 0.6s ease;
  filter: drop-shadow(0 0 8px var(--progress-color));
}

.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.time-display {
  font-family: 'Baloo 2', cursive;
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  letter-spacing: -2px;
  transition: color 0.4s ease;
}

.timer-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Pulseer animatie als de timer loopt */
.timer-wrapper.running .time-display {
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.75; }
}

/* Eindeanimatie emoji */
.finish-emoji {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  opacity: 0;
  transform: scale(0.3);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.finish-emoji.show {
  animation: pop-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.6) forwards;
}

@keyframes pop-in {
  0%   { opacity: 0; transform: scale(0.2); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===========================
   KLEURSTATUS
=========================== */
body.state-orange {
  --progress-color: var(--orange);
}
body.state-red {
  --progress-color: var(--red);
}
body.state-green {
  --progress-color: var(--green);
}

/* ===========================
   SNELKNOPPEN
=========================== */
.quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.quick-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--muted);
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-btn:hover,
.quick-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(56,189,248,0.3);
}

/* ===========================
   EIGEN TIJD INSTELLEN
=========================== */
.custom-time {
  text-align: center;
  margin-bottom: 1.8rem;
}

.custom-time label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.6rem;
}

.custom-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.custom-inputs input {
  width: 70px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  color: var(--text);
  font-family: 'Baloo 2', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  padding: 0.4rem 0.3rem;
  transition: border-color 0.2s;
  appearance: textfield;
  -moz-appearance: textfield;
}

.custom-inputs input::-webkit-outer-spin-button,
.custom-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.custom-inputs input:focus {
  outline: none;
  border-color: var(--accent);
}

.custom-inputs span {
  font-family: 'Baloo 2', cursive;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--muted);
}

.set-btn {
  background: var(--accent);
  border: none;
  border-radius: 0.75rem;
  color: var(--bg);
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.set-btn:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

/* ===========================
   BESTURINGSKNOPPEN
=========================== */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.ctrl-btn {
  flex: 1;
  max-width: 130px;
  border: none;
  border-radius: 1rem;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ctrl-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
}

.ctrl-btn.start {
  background: var(--green);
  color: #052e16;
}
.ctrl-btn.start:not(:disabled):hover {
  background: #86efac;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74,222,128,0.35);
}

.ctrl-btn.pause {
  background: var(--orange);
  color: #431407;
}
.ctrl-btn.pause:not(:disabled):hover {
  background: #fdba74;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(251,146,60,0.35);
}

.ctrl-btn.reset {
  background: var(--border);
  color: var(--muted);
}
.ctrl-btn.reset:not(:disabled):hover {
  background: #475569;
  color: var(--text);
  transform: translateY(-2px);
}

/* ===========================
   GELUID TOGGLE
=========================== */
.sound-toggle {
  display: flex;
  justify-content: center;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}

.switch input:checked + .slider {
  background: rgba(56,189,248,0.3);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

/* ===========================
   SCHUD-ANIMATIE (bijna klaar)
=========================== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

.app.shaking {
  animation: shake 0.5s ease;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 400px) {
  .app { padding: 1.5rem 1rem 2rem; }
  .timer-wrapper { width: 220px; height: 220px; }
  .time-display { font-size: 2.8rem; }
}
