/* CSS Variables */
:root {
  --background: hsl(40, 30%, 96%);
  --foreground: hsl(210, 20%, 18%);
  --card: hsl(40, 35%, 98%);
  --card-foreground: hsl(210, 20%, 18%);
  --primary: hsl(185, 55%, 35%);
  --primary-foreground: hsl(40, 40%, 98%);
  --secondary: hsl(40, 20%, 92%);
  --secondary-foreground: hsl(210, 20%, 18%);
  --muted: hsl(40, 15%, 84%);
  --muted-foreground: hsl(210, 12%, 45%);
  --accent: hsl(25, 75%, 45%);
  --accent-foreground: hsl(40, 40%, 98%);
  --destructive: hsl(5, 70%, 50%);
  --destructive-foreground: hsl(40, 40%, 98%);
  --border: hsl(40, 15%, 82%);
  --input: hsl(40, 30%, 96%);
  --ring: hsl(185, 55%, 35%);
  --radius: 0.75rem;
  --gradient-start: hsl(25, 70%, 88%);
  --gradient-mid: hsl(45, 80%, 90%);
  --gradient-end: hsl(185, 60%, 88%);
  --glass-bg: hsla(40, 35%, 98%, 0.85);
  --glass-border: hsla(210, 20%, 25%, 0.08);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: var(--border);
}

body {
  background: var(--background);
  color: var(--foreground);
  font-family: 'Sora', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-container {
  min-height: 100vh;
  transition: all 1s ease;
}

.main-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ads */
.ad-banner {
  padding: 0.75rem 1rem 0;
}

.ad-banner-inner {
  max-width: 56rem;
  margin: 0 auto;
  min-height: 2.75rem;
  background: var(--secondary);
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.ad-banner .ad-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-bottom {
  padding: 0.5rem 1rem 1rem;
}

/* Background Animations */
.animated-gradient-bg {
  background: linear-gradient(
    135deg,
    var(--gradient-start) 0%,
    var(--gradient-mid) 50%,
    var(--gradient-end) 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

.static-gradient-bg {
  background: linear-gradient(
    135deg,
    var(--background) 0%,
    hsl(40, 35%, 92%) 100%
  );
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Header */
.header {
  padding: 1.5rem 1rem;
}

.header-content {
  max-width: 56rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.icon-wrapper {
  padding: 0.5rem;
  background: hsla(185, 55%, 35%, 0.2);
  border-radius: 0.75rem;
}

.timer-icon {
  color: var(--primary);
}

.title {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--foreground);
}

.tagline {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Status Badge */
.status-badge {
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-running {
  background: hsla(185, 55%, 35%, 0.2);
  color: var(--primary);
}

.status-paused {
  background: hsla(25, 75%, 45%, 0.2);
  color: var(--accent);
}

.status-finished {
  background: hsla(0, 70%, 55%, 0.2);
  color: var(--destructive);
}

.status-idle {
  background: var(--muted);
  color: var(--muted-foreground);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 0 1rem 2rem;
}

.content-wrapper {
  max-width: 56rem;
  margin: 0 auto;
}

/* Chosen Duration */
.chosen-duration {
  text-align: center;
  margin-bottom: 2rem;
}

.duration-text {
  color: var(--muted-foreground);
}

.duration-value {
  color: var(--primary);
  font-weight: 600;
}

/* Timer Display */
.timer-display-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
}

.timer-circle {
  position: relative;
  width: 16rem;
  height: 16rem;
}

@media (min-width: 768px) {
  .timer-circle {
    width: 20rem;
    height: 20rem;
  }
}

.circle-svg {
  width: 100%;
  height: 100%;
}

.circle-bg {
  stroke: var(--muted);
}

.circle-progress {
  stroke: var(--primary);
  transition: stroke-dashoffset 0.2s ease, stroke 0.2s ease;
}

.circle-progress.finished {
  stroke: var(--destructive);
}

.progress-ring {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.timer-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-text {
  font-size: 4rem;
  font-weight: 300;
  letter-spacing: -0.05em;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .timer-text {
    font-size: 6rem;
  }
}

.timer-message {
  margin-top: 0.5rem;
  font-size: 1.125rem;
  text-align: center;
}

.timer-message.running {
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-direction: column;
}

.timer-message.paused {
  color: var(--accent);
  font-weight: 500;
  font-size: 1.25rem;
}

.timer-message.finished {
  color: var(--destructive);
  font-weight: 500;
  font-size: 1.25rem;
}

.running-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.pulse-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse-glow 2s ease-in-out infinite;
}

.progress-bar-container {
  width: 8rem;
  height: 0.25rem;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
  margin: 0 auto;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.timer-instruction {
  margin-top: 1.5rem;
  color: var(--muted-foreground);
  font-size: 1.125rem;
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Control Buttons */
.control-buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.control-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.75rem;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.control-button:hover {
  transform: scale(1.05);
}

.control-button:active {
  transform: scale(0.95);
}

.control-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-button:disabled:hover {
  transform: scale(1);
}

.control-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 10px 15px -3px hsla(185, 55%, 35%, 0.25);
}

.control-primary:hover {
  box-shadow: 0 20px 25px -5px hsla(185, 55%, 35%, 0.35);
}

.control-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.control-secondary:hover {
  background: hsl(40, 20%, 88%);
}

.control-accent {
  background: var(--accent);
  color: var(--accent-foreground);
  box-shadow: 0 10px 15px -3px hsla(25, 75%, 45%, 0.25);
}

.control-accent:hover {
  box-shadow: 0 20px 25px -5px hsla(25, 75%, 45%, 0.35);
}

/* Settings Panel */
.settings-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 2rem;
  box-shadow: 0 24px 40px -24px rgba(20, 30, 40, 0.25);
}

.settings-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 1.5rem;
}

.settings-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  grid-template-areas:
    "min"
    "max"
    "sound"
    "display";
}

@media (min-width: 768px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "min sound"
      "max display";
  }
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-min {
  grid-area: min;
}

.settings-max {
  grid-area: max;
}

.settings-sound {
  grid-area: sound;
}

.settings-display {
  grid-area: display;
}

.section-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.input-label {
  font-size: 0.875rem;
  color: var(--foreground);
  display: block;
  line-height: 1.2;
  min-height: 1.05rem;
}

.input-field {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.625rem 1rem;
  color: var(--foreground);
  font-size: 1rem;
  font-family: inherit;
  height: 2.75rem;
  line-height: 1.25rem;
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsla(185, 55%, 35%, 0.2);
}

.input-field.error {
  border-color: var(--destructive);
}

.input-field.error:focus {
  box-shadow: 0 0 0 3px hsla(0, 70%, 55%, 0.2);
}

.error-message {
  color: var(--destructive);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.sound-controls {
  display: flex;
  gap: 0.5rem;
}

.sound-select {
  flex: 1;
}

.test-sound-btn {
  padding: 0.625rem 1rem;
}

/* Display Options */
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}

.toggle-field-text {
  flex: 1;
  text-align: left;
  line-height: 1.25rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-flex;
  height: 1.5rem;
  width: 2.75rem;
  align-items: center;
  border-radius: 9999px;
  transition: background-color 0.3s ease;
  cursor: pointer;
  border: none;
  padding: 0;
}

.toggle-switch-on {
  background: var(--primary);
}

.toggle-switch-off {
  background: var(--muted);
}

.toggle-thumb {
  display: inline-block;
  height: 1rem;
  width: 1rem;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s ease;
}

.toggle-thumb-on {
  transform: translateX(1.5rem);
}

.toggle-thumb-off {
  transform: translateX(0.25rem);
}

/* Footer */
.footer {
  padding: 1rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fade-in-up 0.5s ease-out;
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scale-in 0.3s ease-out;
}
