/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #a0c4ff, #ffc6ff);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  color: #333;
}

h1 {
  font-size: 3rem;
  margin-bottom: 2rem;
  color: #333;
}

#task-icon-wrapper {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1000;
}

#task-icon {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 1.75rem;
  color: #333;
  cursor: pointer;
  transition: transform 0.2s ease;
  z-index: 1000;
}

#task-icon:hover {
  transform: rotate(90deg);
}

body.dark-mode #task-icon {
  color: #ddd;
}

#task-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 320px;
  background: white;
  border-right: 1px solid #ddd;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  z-index: 1002;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
  overflow-y: auto;
}

#task-sidebar.show {
  transform: translateX(0);
}

#timer {
  font-size: 6rem;
  font-weight: bold;
  background: white;
  padding: 2rem 4rem;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  margin-bottom: 2rem;
  width: 400px;
  color: #333;
}

.controls {
  display: flex;
  gap: 1rem;
}

button {
  background-color: rgba(255, 255, 255, 0.8);
  color: #333;
  border: none;
  width: 60px;
  height: 60px;
  font-size: 1.25rem;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button i {
  pointer-events: none;
}

button:hover {
  background-color: white;
  transform: scale(1.05);
}

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

/* Settings Icon */
#settings-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.75rem;
  color: #333;
  cursor: pointer;
  transition: transform 0.2s ease;
  z-index: 1000;
}

#settings-icon:hover {
  transform: rotate(90deg);
}

/* Modal container */
#settings-modal {
  position: absolute;
  top: 60px;
  right: 20px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 1rem 1.5rem;
  width: 400px;
  display: none;
  flex-direction: column;
  z-index: 1001;
}

#settings-modal.show {
  display: flex;
}

.modal-content {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.modal-content h2 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 700;
  color: #333;
}

.modal-content label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: #333;
  gap: 0.25rem;
}

.modal-content input {
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: monospace;
  color: #333;
  background-color: white;
}

/* Save button */
#saveSettings {
  all: unset;
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-end;
  line-height: 1.2;
}

#saveSettings:hover {
  background: #e0e0e0;
}

/* New: Enable Notifications Button */
#enableNotifications {
  all: unset;
  background-color: #f0f0f0;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  margin-top: 0.5rem;
  line-height: 1.2;
}

#enableNotifications:hover {
  background: #e0e0e0;
}

/* Close X icon */
#closeSettings {
  all: unset;
  color: #333;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  line-height: 1;
  background-color: #4F46E5;
}

/* Toggle Label */
.toggle-label {
  display: flex;
  align-items: left;
  gap: 0.75rem;
  font-weight: 500;
  color: #333;
  font-size: 0.9rem;
  cursor: pointer;
  justify-content: flex-start;
  width: 100%;
  text-align: left;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-label .slider {
  position: relative;
  width: 40px;
  height: 20px;
  background-color: #f0e8ff;
  border-radius: 20px;
  border: 1px solid #ccc;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

.toggle-label .slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: #6b54d3;
  border-radius: 50%;
  top: 50%;
  transform: translateY(-50%) translateX(0);
  left: 2px;
  transition: transform 0.3s ease, background-color 0.3s ease;
  box-shadow: 0 0 3px rgba(0,0,0,0.1);
  box-sizing: border-box;
}

.toggle-label input[type="checkbox"]:checked + .slider {
  background-color: #4f46e5;
  border-color: #4f46e5;
}

.toggle-label input[type="checkbox"]:checked + .slider::before {
  transform: translateY(-50%) translateX(20px);
  background-color: white;
}

#presetSelector {
    width: 100%;
    padding: 0.3rem 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: white;
    color: #333;
    font-family: monospace;
  }
  
  body.dark-mode #presetSelector {
    background-color: #2C2C2C;
    color: #E0E0E0;
    border: 1px solid #444;
  }
  
  .top-left-icon,
  .top-right-icon {
    position: absolute;
    top: 1rem;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 1000;
    color: var(--icon-color, #666);
  }
  .top-left-icon {
    left: 1rem;
  }
  .top-right-icon {
    right: 1rem;
  }
  
  #task-sidebar h2 {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: #333;
    text-align: left;
  }
  
  #task-sidebar > label {
    color: #333;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: left;
  }
  
  #task-sidebar input[type="text"],
  #task-sidebar input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  #task-sidebar input:focus {
    outline: none;
    border-color: #a0c4ff;
    box-shadow: 0 0 0 2px rgba(160, 196, 255, 0.5);
  }
  
  #task-sidebar .radio-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: left;
  }
  
  #task-sidebar .radio-group label {
    color: #555;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
  
  #task-sidebar .add-task-btn {
    all: unset;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    margin-top: auto;
    line-height: 1;
  }
  
  #task-sidebar .add-task-btn:hover {
    background: #e0e0e0;
  }
  
  .task-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    color: #333;
    font-size: 0.9rem;
  }
  
  .task-number {
    font-size: 0.8rem;
    font-weight: bold;
    color: #666;
  }
  
  .task-title {
    flex-grow: 1;
  }
  
  .task-timer {
    font-family: monospace;
    font-weight: bold;
  }
  
  #confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow: visible;
    display: none;
  }
  
  .confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0.8;
    border-radius: 2px;
    animation-name: fall;
    animation-timing-function: ease-out;
    animation-iteration-count: 1;
    will-change: transform, opacity;
  }
  
  @keyframes fall {
    0% {
      transform: translateY(0) rotate(0deg);
      opacity: 1;
    }
    100% {
      transform: translateY(100vh) rotate(360deg);
      opacity: 0;
    }
  }
  

/* -------------------------- */
/* DARK MODE OVERRIDES BELOW */
/* -------------------------- */

body.dark-mode {
  background: #0D0D0D;
  color: #E5E5E5;
}

/* Text overrides */
body.dark-mode h1,
body.dark-mode #timer,
body.dark-mode .modal-content h2,
body.dark-mode .modal-content label,
body.dark-mode #settings-icon,
body.dark-mode .toggle-label {
  color: #E5E5E5 !important;
}

/* Slightly dimmer text for labels and secondary text */
body.dark-mode .modal-content label,
body.dark-mode .toggle-label {
  color: #A0A0A0 !important;
}

body.dark-mode #timer {
  background: #1E1E1E;
  color: #E5E5E5 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.dark-mode button {
  background-color: #2C2C2C;
  color: #E5E5E5;
  border: 1px solid #333;
}

body.dark-mode button:hover {
  background-color: #3C3C3C;
  border-color: #444;
}

body.dark-mode #settings-modal {
  background-color: #1E1E1E;
  border: 1px solid #2C2C2C;
  min-width: 400px;
  max-width: 100%;
}

body.dark-mode .modal-content input[type="text"],
body.dark-mode .modal-content input[type="number"] {
  background-color: #2C2C2C;
  color: #FFFFFF !important;
  border: 1px solid #444;
}

body.dark-mode #saveSettings {
  background-color: #6366F1;
  color: white;
  border: none;
}

body.dark-mode #saveSettings:hover {
  background-color: #4F46E5;
}

body.dark-mode .toggle-label .slider {
  background-color: #2C2C2C;
  border-color: #444;
}

body.dark-mode .toggle-label input[type="checkbox"]:checked + .slider {
  background-color: #6366F1;
  border-color: #6366F1;
}

body.dark-mode .toggle-label input[type="checkbox"]:checked + .slider::before {
  background-color: white;
}

body.dark-mode #task-sidebar {
  background-color: #1E1E1E;
  border-right: 1px solid #2C2C2C;
}

body.dark-mode #task-sidebar h2 {
  color: #E5E5E5;
}

body.dark-mode #task-sidebar > label {
  color: #A0A0A0;
}

body.dark-mode #task-sidebar input[type="text"],
body.dark-mode #task-sidebar input[type="number"] {
  background-color: #2C2C2C;
  color: #FFFFFF;
  border: 1px solid #444;
}

body.dark-mode #task-sidebar input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

body.dark-mode #task-sidebar .radio-group label {
  color: #A0A0A0;
}

body.dark-mode #task-sidebar .add-task-btn {
  background-color: #2C2C2C;
  color: #E5E5E5;
  border: 1px solid #333;
}

body.dark-mode #task-sidebar .add-task-btn:hover {
  background-color: #3C3C3C;
  border-color: #444;
}

/* New: Dark Mode for Enable Notifications Button */
body.dark-mode #enableNotifications {
  background-color: #2C2C2C;
  color: #E5E5E5;
  border: 1px solid #333;
}

body.dark-mode #enableNotifications:hover {
  background-color: #3C3C3C;
  border-color: #444;
}
