/* ======= Root Variables ======= */
:root {
  --primary-light: #6841F6;
  --primary-dark: #3C268D;
  --secondary-light: #D06BFF;
  --secondary-dark: #6F3888;
  --tertiary-light: #FDE9FF;
  --tertiary-dark: #1B171A;
  --text-color-light: #000000;
  --text-color-dark: #ffffff;
  --switch-on: #34C759;
  --switch-off: #CCCCCC;
  --fade-light: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), transparent);
  --fade-dark: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
  --selector-border: rgba(255, 255, 255, 0.2);
}

/* ======= General Reset ======= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}


body {
  padding-top: env(safe-area-inset-top, 24px); /* fallback 24px */
  font-family: 'SF Pro', sans-serif;
  background-color: var(--tertiary-light);
  color: var(--text-color-light);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease;
  --fade-top: var(--fade-light);
  --fade-bottom: var(--fade-light);
}

body:not(.dark) {
  --fade-top: var(--fade-light);
  --fade-bottom: var(--fade-light);
}

body.dark {
  background-color: var(--tertiary-dark);
  color: var(--text-color-dark);
  --fade-top: var(--fade-dark);
  --fade-bottom: var(--fade-dark);
}

/* ======= App Container ======= */
.app-container {
  width: 100%;
  max-width: 430px;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-color: var(--tertiary-light);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  transition: background-color 0.3s ease;
}

body.dark .app-container {
  background-color: var(--tertiary-dark);
}

/* ======= Time Picker ======= */
.time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  width: 100%;
  gap: 30px;
  
}

 .time-box {
  width: 140px;
  height: 140px;
  border-radius: 27px;
  font-family: 'SF Pro Rounded', sans-serif;
  font-weight: 100;
  font-size: 72px;
  background: rgba(255, 255, 255, 0.1); /* semi-transparent */
  backdrop-filter: blur(20px); /* frosted glass effect */
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3); /* subtle border */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  color: var(--text-color-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

body.dark .time-box{
  background: rgba(255,255,255, 0.05); /* dark variant with opacity */
  color: var(--text-color-dark);
  border: 1px solid rgba(255, 255, 255, 0.1); /* subtle border */
}

.time-separator {
  display: none;
}


body.dark .time-box {
  background: rgba(108, 79, 157, 0.2); /* dark variant with opacity */
  color: var(--text-color-dark);
}

/* ======= Play Button ======= */
.play-pause-container {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.play-button {
  width: 50px;
  height: 50px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.play-button img {
  width: 100%;
  height: 100%;
}

/* ======= Dark Mode Toggle ======= */

.dark-mode-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: "SF Pro", sans-serif;
  font-size: 14px;
  height: 100%; /* Ensures it fills parent height for alignment */
}

.dark-mode-toggle {
  width: 51px;
  height: 31px;
  border-radius: 16px;
  background-color: var(--switch-off);
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

body.dark .dark-mode-toggle {
  background-color: var(--switch-on);
}

.toggle-switch {
  width: 27px;
  height: 27px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.3s ease;
}

body.dark .toggle-switch {
  left: 22px;
}

/* ======= Bottom Bar ======= */
.bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  padding: 0 24px;
}

.tab-button {
  background: none;
  border: none;
  outline: none;
  cursor: pointer;
}

.icon-circle {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  background-color: var(--secondary-light);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.3s ease;
}

body.dark .icon-circle {
  background-color: var(--secondary-dark);
}

.icon-circle img {
  width: 32px;
  height: 32px;
  filter: none;
  transition: filter 0.3s ease;
}

body.dark .icon-circle img {
  filter: brightness(0) invert(1);
}

/* ======= Settings Panel ======= */
#settings-view {
  position: absolute;
  top: 0;
  right: -100%;
  width: 100%;
  height: 100%;
  background-color: var(--tertiary-light);
  transition: right 0.4s ease, background-color 0.3s ease;
  padding: 20px;
  overflow-y: auto;
  color: var(--text-color-light);
  -webkit-overflow-scrolling: touch;
}

body.dark #settings-view {
  background-color: var(--tertiary-dark);
  color: var(--text-color-dark);
}

#settings-view.active {
  right: 0;
}

.invisible {
  opacity: 0;
  pointer-events: none;
}


.settings-panel h2 {
  font-size: 24px;
  font-weight: 700;
  margin-top: 20px;
}
/*blur in settings panel */

.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  padding: 24px 16px 60px;
  background-color: rgba(255, 255, 255, 0.6); /* light mode */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translateX(100%);
  transition: transform 0.4s ease;
  overflow-y: auto;
  z-index: 1000;
}

body.dark .settings-panel {
  background-color: rgba(30, 30, 30, 0.6); /* dark mode */
}

.settings-panel.active {
  transform: translateX(0%);
}



input[type=range] {
  width: 100%;
  margin-top: 10px;
}

.stepper-group {
  margin-top: 16px;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stepper button {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}


.stepper span {
  min-width: 40px;
  text-align: center;
  font-weight: 700;
}

.step-up, .step-down {
  width: 32px;
  height: 32px;
  border: none;
  background-color: var(--primary-light);
  color: white;
  font-size: 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.step-up:hover, .step-down:hover {
  background-color: var(--primary-dark);
}

.close-settings-button {
  margin-top: 30px;
  padding: 12px 24px;
  background-color: var(--primary-dark);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.close-settings-button:hover {
  background-color: var(--primary-light);
}

/* ======= Responsive Fixes ======= */
@media screen and (max-height: 700px) {
  .bottom-bar {
    position: static;
    margin-top: 20px;
  }
}

/* Overlay container */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


/* Hide by default */
.overlay.hidden {
  display: none;
}

/* Picker Header */
.picker-header {
  display: flex;
  justify-content: space-between;
  width: 240px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px 12px 0 0;
  color: var(--text-color);
  font-family: 'SF Pro', sans-serif;
  font-weight: 600;
  font-size: 16px;
}

.picker-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.picker-header button {
  padding: 8px 16px;
  background-color: var(--primary-light);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
}

#picker-done {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
}

/* Carousel list */
/* Wrapper around the scrollable list to apply fading overlays */
.picker-scroll-wrapper {
  position: relative;
  width: 160px;
  height: 300px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-padding-top: calc(50% - 36px); /* Half of item height */
  scrollbar-width: none; /* Firefox */
}

.picker-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

/* Scrollable vertical list of numbers */
.picker-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 0;
}


/* Each number item in the carousel */
.picker-carousel div {
  height: 96px;
  line-height: 96px;
  font-size: 72px;
  font-weight: 100;
  font-family: 'SF Pro Rounded', sans-serif;
  scroll-snap-align: center;
  user-select: none;
  color: var(--text-color);
}

#picker-list > div {
  height: 120px;
  width: 100%;
  font-size: 120px;
  font-family: 'SF Pro Rounded', 'SF Pro Text', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 100;
  line-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
  text-align: center;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  scroll-snap-align: start;
}

#picker-list {
  max-height: 216px;
  overflow-y: auto;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  padding: 72px 0;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  scroll-snap-type: y mandatory;
  /* Hide scrollbar on all platforms */
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* IE/Edge */
}

#picker-list::-webkit-scrollbar {
  display: none;                 /* Chrome/Safari/Opera */
}

#picker-list div {
  height: 72px;
  font-size: 72px;
  font-weight: 200;
  font-family: 'SF Pro Rounded', sans-serif;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.picker-carousel div:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
}

.picker-carousel div:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* Fades 
.fade-top,
.fade-bottom {
  position: absolute;
  width: 160px;
  height: 60px;
  z-index: 10;
  pointer-events: none;
}

.fade-top {
  top: 68px;
  background: var(--fade-top);
}

.fade-bottom {
  bottom: 0;
  background: var(--fade-bottom);
}
*/

/* ====== smooth transition for the views ====== */
.view {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  z-index: 1;
}

.view.active {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  z-index: 1;
}

.view.hidden {
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

@keyframes resetBounce {
  0% {
    transform: scale(1);
  }
  25% {
    transform: scale(0.9);
  }
  50% {
    transform: scale(1.05);
  }
  75% {
    transform: scale(0.98);
  }
  100% {
    transform: scale(1);
  }
}

.time-box.animate-reset {
  animation: resetBounce 0.4s ease;
}
