/* --- timer.css --- */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600;800&family=Lora:ital,wght@0,400;0,700;1,400&family=JetBrains+Mono:wght@400;700;800&family=Orbitron:wght@500;700;900&display=swap');

:root {
  --color-bg: #0b0f19;
  --color-surface: rgba(255, 255, 255, 0.05);
  --color-surface-hover: rgba(255, 255, 255, 0.1);
  --color-border: rgba(255, 255, 255, 0.1);
  --color-text: #f5f0eb;
  --color-text-muted: #8e9aa8;
  
  /* Brand colors */
  --color-primary: #bb051f; /* Crimson */
  --color-primary-glow: rgba(187, 5, 31, 0.4);
  --color-gold: #c9a84c; /* Gold */
  --color-gold-glow: rgba(201, 168, 76, 0.4);
  
  /* States */
  --color-prepare: #ffb300;
  --color-prepare-glow: rgba(255, 179, 0, 0.3);
  --color-work: #e53935;
  --color-work-glow: rgba(229, 57, 53, 0.3);
  --color-rest: #00b0ff;
  --color-rest-glow: rgba(0, 176, 255, 0.3);
  --color-finished: #00e676;
  --color-finished-glow: rgba(0, 230, 118, 0.3);

  --font-display: "Montserrat", sans-serif;
  --font-body: "Lora", serif;
  --font-timer: "JetBrains Mono", monospace;
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.8s var(--ease-premium);
}

/* Header & Navigation */
header.navbar-timer {
  background-color: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: opacity 0.5s var(--ease-premium);
}

.logo-link {
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
}

.logo-highlight {
  color: var(--color-primary);
}

.back-to-home {
  font-family: var(--font-display);
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s;
}

.back-to-home:hover {
  color: var(--color-text);
}

/* Wrapper / Layout */
main.timer-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* Configuration Screen */
.config-screen {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 25px;
  animation: fadeIn 0.5s var(--ease-premium) forwards;
}

.config-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.8rem;
  text-align: center;
  color: var(--color-text);
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.config-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.95rem;
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 15px;
}

.config-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 20px;
  backdrop-filter: blur(10px);
}

/* Pickers Grid */
.picker-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 480px) {
  .picker-row {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

.picker-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 12px 10px;
  position: relative;
}

.picker-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.segmented-option input:checked + .segmented-btn {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(187, 5, 31, 0.3);
}

/* Instant updates without transition during active scrolling */
.wheel-picker.scrolling .wheel-item {
  transition: none !important;
}

/* Profiles Container Styles */
.profiles-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 5px;
  margin-top: 5px;
}

.profiles-container::-webkit-scrollbar {
  width: 5px;
}

.profiles-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
}

.profiles-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
}

.profile-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.profile-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-text);
}

.profile-details {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  font-family: var(--font-display);
}

.btn-delete-profile {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-delete-profile:hover {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

.btn-delete-profile svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.profile-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.profile-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Pulsing GO style */
@keyframes pulse-scale {
  0% { transform: scale(1.0); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 15px var(--color-finished-glow)); }
  100% { transform: scale(1.0); }
}

.pulse-go {
  animation: pulse-scale 1.5s infinite ease-in-out;
  cursor: pointer;
  color: var(--color-finished) !important;
}

.picker-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  height: auto;
  padding: 5px 0;
  width: 100%;
}

.picker-separator {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-text-muted);
  padding-bottom: 5px;
}

/* Scroll Wheel UI */
.wheel-picker {
  position: relative;
  width: 60px;
  height: 150px; /* Fixed height so parent column height resolves correctly */
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.wheel-picker:active {
  cursor: grabbing;
}

.wheel-gradient-top,
.wheel-gradient-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 35%;
  z-index: 2;
  pointer-events: none;
}

.wheel-gradient-top {
  top: 0;
  background: linear-gradient(to bottom, var(--color-bg) 0%, rgba(11, 15, 25, 0) 100%);
}

.wheel-gradient-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--color-bg) 0%, rgba(11, 15, 25, 0) 100%);
}

/* Background overlay inside config card to match parent */
.config-card .wheel-gradient-top {
  background: linear-gradient(to bottom, #131722 0%, rgba(19, 23, 34, 0) 100%);
}
.config-card .wheel-gradient-bottom {
  background: linear-gradient(to top, #131722 0%, rgba(19, 23, 34, 0) 100%);
}

.wheel-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: block;
  transform: translateY(0px);
  will-change: transform;
}

.wheel-item {
  height: 30px;
  line-height: 30px;
  width: 100%;
  text-align: center;
  font-size: 1.05rem;
  color: var(--color-text-muted);
  opacity: 0;
  transform: scale(0.5);
  transition: transform 0.2s, opacity 0.2s, color 0.2s;
  font-family: var(--font-timer);
  font-weight: 500;
}

.wheel-item.active {
  font-size: 1.6rem;
  color: var(--color-text);
  opacity: 1;
  font-weight: 700;
  transform: scale(1.3);
}

.wheel-item.prev-1,
.wheel-item.next-1 {
  opacity: 0.6;
  transform: scale(0.95);
}

.wheel-item.prev-2,
.wheel-item.next-2 {
  opacity: 0.25;
  transform: scale(0.8);
}

.wheel-highlight-line {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 32px;
  top: calc(50% - 16px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 1;
}

/* Sound Switch Styling */
.sound-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  margin-top: 5px;
}

.sound-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .4s var(--ease-premium);
  border-radius: 34px;
  border: 1px solid var(--color-border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--color-text);
  transition: .4s var(--ease-premium);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Start Button */
.btn-start-workout {
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 16px;
  padding: 18px 30px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
  width: 100%;
  box-shadow: 0 8px 24px var(--color-primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-start-workout:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px var(--color-primary-glow);
  background-color: #d10725;
}

.btn-start-workout:active {
  transform: translateY(0);
}

/* Active Timer Screen */
.timer-screen {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: calc(100vh - 120px);
  padding: 20px 0;
  animation: fadeIn 0.5s var(--ease-premium) forwards;
}

.timer-header {
  text-align: center;
  margin-bottom: 20px;
}

.timer-phase-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.2rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.timer-round-info {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--color-text-muted);
}

/* SVG Circular Countdown */
.timer-visual {
  position: relative;
  width: 340px;
  height: 340px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto 0;
  transition: transform 0.6s var(--ease-premium);
}

@media (max-width: 375px) {
  .timer-visual {
    width: 300px;
    height: 300px;
  }
}

.timer-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 10;
}

.circle-progress {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 1005.3; /* 2 * PI * r = 2 * 3.14159 * 160 = 1005.31 */
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.1s linear, stroke 0.8s var(--ease-premium);
  will-change: stroke-dashoffset;
}

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

.timer-time-left {
  font-family: var(--font-timer);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
}

.timer-next-phase {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 10px;
  letter-spacing: 0.5px;
}

/* Action Controls */
.timer-controls {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
}

.btn-icon {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 50%;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-icon:hover {
  background: var(--color-surface-hover);
  transform: scale(1.05);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.btn-main-control {
  background-color: var(--color-text);
  color: var(--color-bg);
  border: none;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-premium);
  box-shadow: 0 8px 24px rgba(255,255,255,0.15);
}

.btn-main-control:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(255,255,255,0.25);
}

.btn-main-control svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dynamic State Colors for running Timer */
body.state-ready {
  background-color: var(--color-bg);
}
body.state-ready .circle-progress {
  stroke: var(--color-primary);
}
body.state-ready .timer-phase-title {
  color: var(--color-text);
}
body.state-ready .timer-visual {
  cursor: pointer;
}

body.state-prepare {
  background-color: #1a1505;
}
body.state-prepare .circle-progress {
  stroke: var(--color-prepare);
}
body.state-prepare .timer-phase-title {
  color: var(--color-prepare);
}

body.state-work {
  background-color: #1a0507;
}
body.state-work .circle-progress {
  stroke: var(--color-work);
}
body.state-work .timer-phase-title {
  color: var(--color-work);
}

body.state-rest {
  background-color: #05141c;
}
body.state-rest .circle-progress {
  stroke: var(--color-rest);
}
body.state-rest .timer-phase-title {
  color: var(--color-rest);
}

body.state-finished {
  background-color: #051c0f;
}
body.state-finished .circle-progress {
  stroke: var(--color-finished);
}
body.state-finished .timer-phase-title {
  color: var(--color-finished);
}

/* Utility to hide elements */
.hidden {
  display: none !important;
}

/* Enlarge circular countdown when running */
body.state-running-active .timer-visual {
  transform: scale(1.12);
}

/* Picker Column Labels */
.wheel-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.column-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

/* Sound Settings Group */
.sound-settings-group {
  display: flex;
  flex-direction: column;
}

.sound-type-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
}

.sound-segmented-control {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 2px;
  overflow: hidden;
}

.segmented-option {
  position: relative;
  cursor: pointer;
  margin: 0;
}

.segmented-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.segmented-btn {
  display: inline-block;
  padding: 6px 16px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  border-radius: 8px;
  transition: all 0.3s var(--ease-premium);
  text-align: center;
}

.segmented-option input:checked + .segmented-btn {
  background-color: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(187, 5, 31, 0.3);
}

/* Instant updates without transition during active scrolling */
.wheel-picker.scrolling .wheel-item {
  transition: none !important;
}

/* Custom Editable Phase Names */
.phase-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: inherit;
  padding: 2px 4px;
  cursor: text;
  transition: border-bottom-color 0.2s, background-color 0.2s;
  border-radius: 4px;
  width: 130px; /* Largeur augmentée pour afficher de plus longs noms */
  text-align: center;
}

.phase-name-input:hover {
  border-bottom-color: rgba(255, 255, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.03);
}

.phase-name-input:focus {
  outline: none;
  border-bottom: 1px solid currentColor;
  background-color: rgba(255, 255, 255, 0.06);
}

/* Phase Toggle Disabled State */
.picker-group.disabled-picker .picker-container,
.picker-group.disabled-picker .wheel-picker {
  opacity: 0.25;
  pointer-events: none;
  filter: grayscale(100%);
  transition: all 0.4s var(--ease-premium);
}

