/* --- CSS RESET & FONT --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

html, body {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #0f1624, #1b2735);
  color: #fff;
  transition: background 0.4s, color 0.4s;
  overflow: hidden;
}

/* --- THEME LIGHT --- */
.light-mode {
  background: linear-gradient(145deg, #e2e8f0, #ffffff);
  color: #111;
}

/* Fallback for browsers that don't support backdrop-filter */
.container {
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-radius: 25px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  padding: 2.5rem;
  max-width: 480px;
  width: 90%;
  transition: background 0.5s ease;
  animation: fadeIn 1s ease-out;
}

/* --- ANIMATION --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 2.7rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, #00ffd5, #00aaff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.quote {
  font-style: italic;
  margin-bottom: 1.5rem;
  color: #ccc;
  text-align: center;
}

/* --- TIMER --- */
.timer h2 {
  font-size: 4rem;
  margin: 1rem 0;
  letter-spacing: 2px;
  font-weight: 600;
  color: #00ffc6;
  text-align: center;
}

.controls button,
.modes button {
  padding: 0.6rem 1.4rem;
  margin: 0.3rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(145deg, #00f2ff, #006aff);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 170, 255, 0.3);
  transition: all 0.3s ease;
  outline: none;
}

.controls button:hover,
.modes button:hover {
  background: linear-gradient(145deg, #ffffff, #00f0ff);
  color: #000;
  transform: scale(1.05);
}

.modes {
  margin: 1.5rem 0;
  text-align: center;
}

.modes button.active {
  background: #00ffc6;
  color: #000;
  font-weight: bold;
  box-shadow: 0 0 10px #00ffc6;
}

/* --- MUSIC --- */
.music {
  margin-top: 2rem;
  text-align: left;
}

.music label {
  font-weight: bold;
  font-size: 1rem;
  color: #aaa;
}

.music select {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(10px);
  transition: all 0.3s;
}

.music select:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- CHART + PROGRESS --- */
.progress {
  margin-top: 1rem;
}

canvas {
  margin-top: 1rem;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.05);
  width: 100% !important;
}

/* --- THEME TOGGLE --- */
.theme-toggle {
  position: absolute;
  top: 15px;
  right: 15px;
}

#toggleTheme {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #00ffc6;
  transition: color 0.3s;
  outline: none;
}

#toggleTheme:hover {
  color: #ffffff;
}

/* --- LIGHT MODE OVERRIDES --- */
.light-mode .container {
  background: rgba(255, 255, 255, 0.6);
}

.light-mode .timer h2 {
  color: #004dff;
}

.light-mode .quote {
  color: #444;
}

.light-mode .controls button,
.light-mode .modes button {
  background: linear-gradient(145deg, #006aff, #00cfff);
  color: #fff;
}

.light-mode .modes button.active {
  background: #00cfff;
  color: #fff;
}

/* --- CUSTOM TIMER / ALARM / CLOCK --- */
.custom-timer,
.set-alarm,
.world-clock {
  margin-top: 2rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  border-radius: 15px;
  backdrop-filter: blur(10px);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.05);
}

.custom-timer h3,
.set-alarm h3,
.world-clock h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.custom-timer input,
.set-alarm input {
  padding: 0.4rem 0.6rem;
  margin: 0.3rem;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.custom-timer button,
.set-alarm button {
  margin-top: 0.6rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(145deg, #0ff, #0af);
  border: none;
  border-radius: 8px;
  color: #000;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.custom-timer button:hover,
.set-alarm button:hover {
  transform: scale(1.05);
  background: linear-gradient(145deg, #fff, #0ff);
}

#setAlarmMsg {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #0ff;
}

/* --- MEDIA QUERIES --- */
@media screen and (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .timer h2 {
    font-size: 3rem;
  }

  .container {
    padding: 1.5rem;
  }
}
