/* =========================================================
   BASE RESET + SAFETY
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   RESPONSIVE ENHANCEMENTS (SAFE)
========================================================= */

/* CLOCK */
.clock {
  width: clamp(240px, 70vw, 420px);
  height: clamp(240px, 70vw, 420px);
}

@media (min-width: 1024px) {
  .clock {
    width: 384px;
    height: 384px;
  }
}

.clock span b {
  font-size: clamp(0.9rem, 2.5vw, 1.6rem);
}

/* DIGITAL CLOCK */
#time {
  font-size: clamp(1.3rem, 4vw, 2rem);
  padding: 0.6rem 1.2rem;
}

#time div {
  width: clamp(45px, 10vw, 70px);
}

#ampm {
  font-size: clamp(0.7rem, 2vw, 1rem);
}

/* TIMER DISPLAY */
#remainingDisplay {
  font-size: clamp(2rem, 7vw, 3.5rem);
}

/* INFO GRID */
@media (max-width: 600px) {
  .info-grid {
    gap: 0.5rem;
  }

  .info-card {
    flex: 1 1 45%;
    min-width: unset;
  }
}

/* BUTTONS */
@media (max-width: 600px) {
  .action-buttons {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .action-buttons .btn {
    flex: 1 1 30%;
    min-width: 90px;
    font-size: 0.8rem;
    padding: 0.6rem 0.8rem;
  }
}

/* MODE SWITCH */
@media (max-width: 768px) {
  .mode-switch {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .mode-switch button {
    flex: 0 0 auto;
    font-size: 0.75rem;
  }

  .mode-switch::-webkit-scrollbar {
    display: none;
  }
}

/* DURATION */
@media (max-width: 500px) {
  .duration-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .dur-input {
    width: 60px !important;
  }
}

/* FULLSCREEN MOBILE */
@media (max-width: 768px) {
  .fullscreen-enabled.hide-controls .clock {
    width: 80vw;
    height: 80vw;
  }

  .fullscreen-enabled.hide-controls #time {
    font-size: 10vw;
  }

  .fullscreen-enabled.hide-controls #remainingDisplay {
    font-size: 12vw;
  }
}

/* =========================================================
   CLOCK MECHANICS
========================================================= */

.circle {
  position: absolute;
  width: 200px;
  height: 200px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 10;
}

.circle i {
  position: absolute;
  width: 4px;
  height: 50%;
  background: var(--clr);
  opacity: 0.9;
  transform-origin: bottom;
  transform: scaleY(0.5);
  border-radius: 4px;
}

.circle:nth-child(1) i {
  width: 2px;
}

.circle:nth-child(2) i {
  width: 6px;
}

.circle2 {
  width: 170px;
  height: 170px;
  z-index: 9;
}

.circle3 {
  width: 135px;
  height: 135px;
  z-index: 8;
}

.circle::before {
  content: "";
  position: absolute;
  top: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--clr);
  box-shadow: 0 0 18px var(--clr);
}

.clock span {
  position: absolute;
  inset: 20px;
  color: #fff;
  text-align: center;
  transform: rotate(calc(30deg * var(--i)));
}

.clock span b {
  opacity: 0.35;
  font-weight: 600;
  display: inline-block;
  transform: rotate(calc(-30deg * var(--i)));
}

@keyframes animate {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

#time div:nth-child(2)::after {
  content: ":";
  position: absolute;
  right: -4px;
  color: #ddd;
  animation: animate 1s steps(1) infinite;
}

#time div:nth-child(1)::after {
  content: ":";
  position: absolute;
  right: -4px;
  color: #ddd;
}

/* =========================================================
   VIEW MODES (CRITICAL FOR JS)
========================================================= */

.dashboard.analog-mode .clock-card .clock {
  width: 420px;
  height: 420px;
}

.dashboard.analog-mode .clock span b {
  font-size: 2rem;
}

@media (min-width: 700px) {
  .dashboard.analog-mode .clock-card .clock {
    width: 480px;
    height: 480px;
  }

  .dashboard.analog-mode .clock span b {
    font-size: 2.4rem;
  }
}

@media (min-width: 1000px) {
  .dashboard.analog-mode .clock-card .clock {
    width: 540px;
    height: 540px;
  }
}

/* Digital mode */
.dashboard.digital-mode .clock-card #time {
  padding: 1rem 2rem;
  font-size: 3rem;
  border-radius: 80px;
}

.dashboard.digital-mode .clock-card #time div {
  width: 100px;
  font-size: 3rem;
}

.dashboard.digital-mode .clock-card #time div:last-child {
  font-size: 1.2rem;
}

/* Standard mode */
.dashboard.clock-mode .clock-card .clock {
  width: 300px;
  height: 300px;
}

.dashboard.clock-mode .clock-card #time {
  font-size: 1.8rem;
}

.dashboard.clock-mode .clock-card #time div {
  width: 65px;
}

/* Visibility rules */
.dashboard.analog-mode .timer-panel,
.dashboard.digital-mode .timer-panel,
.dashboard.clock-mode .timer-panel {
  display: none;
}

.dashboard.timer-mode .clock-card {
  display: none;
}

.dashboard.timer-mode .timer-panel {
  width: 100%;
  flex: 1;
}

.hide-analog .clock {
  display: none;
}
.hide-digital #time {
  display: none;
}

/* =========================================================
   UI STATES
========================================================= */

.duration-row.hidden {
  display: none !important;
}

.mode-switch .view-option.active {
  background-color: #f59e0b !important;
  color: #0f172a !important;
}

.progress-fill {
  transition: width 0.2s linear;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   FULLSCREEN
========================================================= */

.fullscreen-enabled .mode-switch {
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.fullscreen-enabled.hide-controls .mode-switch {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.fullscreen-enabled.hide-controls .main-content {
  flex: 1;
  justify-content: center;
  align-items: center;
}

.fullscreen-enabled.hide-controls.dashboard.timer-mode #remainingDisplay {
  font-size: 6rem;
}

/* =========================================================
   LIGHT THEME
========================================================= */

.light body {
  background-color: #f1f5f9;
  color: #0f172a;
}

.light .bg-panel {
  background-color: #ffffff;
}

.light .bg-card {
  background-color: #f1f5f9;
}

.light .text-white,
.light .text-slate-200,
.light .text-slate-300 {
  color: #1e293b;
}

.light .info-card {
  background-color: #ffffff;
}
