:root {
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --accent-blue: #38bdf8;
  --accent-work: #ef4444;
  --accent-rest: #22c55e;
  --accent-prepare: #f59e0b;
  --accent-set-rest: #a855f7; /* Purple for longer recovery between sets */
  --accent-cooldown: #14b8a6; /* Teal for cooldown */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  transition: background-color 0.5s ease;
}

/* Background Dynamic Themes - High Contrast */
body.theme-idle { background-color: #0f172a; }       /* Deep Slate (Default) */
body.theme-prepare { background-color: #d97706; }    /* Vibrant Amber */
body.theme-work { background-color: #dc2626; }       /* Intense Red */
body.theme-rest { background-color: #16a34a; }       /* Bright Green */
body.theme-set-rest { background-color: #7e22ce; }   /* Rich Purple */
body.theme-cooldown { background-color: #0d9488; }   /* Calming Teal */

.app-container {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header h1 {
  text-align: center;
  font-size: 1.2rem;
  letter-spacing: 4px;
  color: #94a3b8;
  font-weight: 800;
}

.timer-display {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 32px 20px;
  text-align: center;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

#phase-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--accent-blue);
  margin-bottom: 8px;
  transition: color 0.3s;
}

.time {
  font-size: 5.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 16px 0 24px 0;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-box .label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 700;
  letter-spacing: 1px;
}

.stat-box .value {
  font-size: 1.25rem;
  font-weight: 800;
}

/* Controls */
.controls {
  display: flex;
  gap: 12px;
}

button {
  flex: 1;
  padding: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

button:active { transform: scale(0.97); }

.primary-btn { background: var(--accent-blue); color: #0f172a; }
.warning-btn { background: #f59e0b; color: #0f172a; }
.secondary-btn { background: #334155; color: #f8fafc; }

.hidden { display: none !important; }

/* Settings Card */
.settings {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
}

.settings h3 {
  font-size: 1rem;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.full-width {
  grid-column: span 2;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}

.input-field input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: #0f172a;
  color: #f8fafc;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: #cbd5e1;
}

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

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

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

/* --- Info Box Accordion --- */
.info-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
}

details {
  color: #cbd5e1;
}

summary {
  font-weight: 700;
  cursor: pointer;
  outline: none;
  list-style: none; /* Hides default triangle in Firefox */
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.95rem;
}

summary::-webkit-details-marker {
  display: none; /* Hides default triangle in Chrome/Safari */
}

/* Custom Plus/Minus Icon */
summary::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--accent-blue);
  line-height: 1;
}

details[open] summary::after {
  content: '−';
}

.info-content {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-content strong {
  color: #f8fafc;
  font-weight: 600;
}
