/* RESET & BOX-SIZING */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* BODY & HTML */
html,
body {
  width: 100%;
  height: 100%;
}
body {
  /* iOS-like system font stack */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: #f9f9f9;
  color: #222;
  overflow-x: hidden; /* hide horizontal scroll if any */
  background-image: url("texture.png"); /* Add texture background */
  background-size: cover;
}

/* A "dark-mode" class toggles a darker theme */
body.dark-mode {
  background-color: #111;
}

/* Container class for padding and centering */
.container {
  padding: 20px;
  margin: 0 auto;
  max-width: 800px;
}

/* Card class for individual elements */
.card {
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

/* Dark mode for card */
body.dark-mode .card {
  background-color: #333;
  color: #fff;
}

/* TOP BAR: refresh icon, title, dark-mode container */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.icon-button {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #007aff;
  padding: 0.25rem 0.5rem;
  transition: color 0.2s;
}
.icon-button:hover {
  color: #006ae6;
}
.title {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  flex: 1;
}

/* Dark Mode Container: label + bigger toggle switch */
.dark-mode-container {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* spacing between label and switch */
}
.dark-mode-label {
  font-size: 0.9rem;
}

/* TOGGLE SWITCH (iOS style, bigger) */
.toggle-switch {
  position: relative;
  width: 60px;
  height: 34px;
}
.toggle-switch input {
  display: none; /* hide the actual checkbox */
}
.toggle-switch label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ccc;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch label::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + label {
  background: #007aff; /* iOS blue */
}
.toggle-switch input:checked + label::after {
  transform: translateX(26px);
}

/* CONTROLS (time input) */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.time-input {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.time-input select {
  width: 60px;
  font-size: 0.9rem;
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fff;
  appearance: none;
  text-align: center;
}

/* CIRCLE AREA (3rd row) */
.circle-area {
  width: 100%;
  padding: 10px; /* Add some padding around the circle */
  box-sizing: border-box;
}

.circle-area svg {
  display: block;
  width: 90vmin; /* Use vmin to ensure circle fits in both width and height */
  max-width: 400px; /* Slightly reduced from 450px */
  height: auto;
  margin: 0 auto;
  aspect-ratio: 1; /* Ensure perfect circle */
}
.circle-icon {
  position: absolute;
  font-size: 3rem;
  pointer-events: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #000;
}
.timer-text {
  margin-top: 1rem;
  font-size: 2rem;
  color: inherit;
  text-align: center;
}

/* FOOTER (4th row): BuyMeACoffee link */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem;
}
.footer a img {
    max-height: 25px;
    width: auto;  
}

/* DARK MODE TWEAKS */
body.dark-mode .icon-button {
  color: #aaa;
}
body.dark-mode .time-input select {
  background-color: #333;
  color: #eee;
  border-color: #555;
}

/* Add these gradient styles */
body:not(.dark-mode) #trailGradient stop:first-child {
  stop-color: #4CAF50;
}

body:not(.dark-mode) #trailGradient stop:last-child {
  stop-color: #4CAF50;
}

body.dark-mode #trailGradient stop:first-child {
  stop-color: #81C784;
}

body.dark-mode #trailGradient stop:last-child {
  stop-color: #81C784;
}

/* Add transition for smooth color changes */
#circleForeground {
  transition: fill 0.3s ease;
}

@media screen and (max-width: 480px) {
  .container {
    padding: 10px; /* Reduce padding on mobile */
  }

  .card {
    padding: 15px; /* Reduce card padding on mobile */
  }

  .circle-area svg {
    width: 85vmin; /* Slightly smaller on mobile to ensure margins */
  }
}
