/* --- TRAINER VIEW STYLES --- */
#trainer-page {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.trainer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--card-color);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 1rem;
}

.trainer-header h2 {
    font-size: 1.25rem;
    color: var(--primary-color);
    flex-grow: 1;
    min-width: 0;
    text-align: center;
}

.trainer-header-controls, .trainer-header-placeholder {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-basis: 80px; /* Give side elements a basis to help centering */
}
.trainer-header-controls { justify-content: flex-end; }
.trainer-header-placeholder { justify-content: flex-start; }


.btn-icon {
  background: none;
  border: none;
  color: var(--text-color-muted);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}
.btn-icon:hover {
  background-color: rgba(255,255,255,0.1);
  color: var(--text-color);
}
#trainer-end-btn {
  color: var(--danger-color);
}
 #trainer-end-btn:hover {
  background-color: rgba(239, 83, 80, 0.1);
}

#audio-toggle-btn {
    background: none;
    border: none;
    color: var(--text-color-muted);
    cursor: pointer;
    padding: 0.5rem;
}

#audio-toggle-btn.active {
    color: var(--primary-color);
}

.trainer-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    text-align: center;
    position: relative;
    overflow-y: auto;
}

.exercise-info-container {
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#current-exercise-name {
    font-size: 2rem;
    font-weight: bold;
    min-height: 1.2em;
}

#current-exercise-details {
    font-size: 1.25rem;
    color: var(--text-color-muted);
    margin-bottom: 0.5rem;
    min-height: 1.2em;
}

#current-rep-display {
  font-size: 1rem;
  color: var(--secondary-color);
  font-weight: bold;
  min-height: 1.2em;
}

#current-rep-display.hidden-rep {
  visibility: hidden;
}

#upcoming-exercise-display {
  font-size: 0.9rem;
  color: var(--text-color-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

#upcoming-exercise-display strong {
  color: var(--text-color);
  font-style: normal;
}

#trainer-display-modes {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 280px;
    width: 100%;
}

.timer-ring-container {
    width: 280px;
    height: 280px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
}

.timer-ring-container svg.hidden {
  display: none;
}

.timer-ring-display {
    font-size: 3rem;
    font-weight: bold;
    fill: var(--text-color);
    text-anchor: middle;
}
.timer-ring-display.hidden { display: none; }

.timer-ring-display.is-timer,
.timer-ring-display.is-rep-count {
    font-family: 'Courier New', Courier, monospace;
}

.timer-ring-display.is-phase {
    font-size: 2.5rem;
    text-transform: uppercase;
}


.timer-ring-bg {
    fill: none;
    stroke: var(--card-color);
    stroke-width: 12;
}

.timer-ring-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 12;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}
.timer-ring-progress.hidden { display: none; }

.timer-ring-progress.is-rest {
    stroke: var(--secondary-color);
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.flashing {
  animation: flash 1.4s infinite;
  fill: var(--primary-color);
}

.trainer-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    height: 80px;
    width: 100%;
    padding-bottom: 1rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.25rem;
}

/* --- Stili per Logging Manuale --- */
#trainer-logging-controls {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 240px; /* Ridotto per stare dentro l'anello */
  padding: 0 1.5rem;
}

#trainer-logging-controls.hidden {
  display: none;
}

.logging-inputs-grid {
  display: flex; /* Cambiato da grid a flex */
  justify-content: center;
  gap: 1rem;
}

#trainer-logging-controls .form-group {
  display: flex;
  flex-direction: column;
  max-width: 100px; /* Rimpicciolisce i box */
  flex-grow: 1;
}

#trainer-logging-controls .form-group label {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-color-muted);
}

#trainer-logging-controls .form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1.25rem;
  background-color: var(--card-color);
  color: var(--text-color);
  text-align: center;
  font-family: 'Courier New', Courier, monospace;
  font-weight: bold;
}

/* Stile per rimuovere le frecce dagli input numerici */
#trainer-logging-controls input[type=number] {
  -moz-appearance: textfield;
}
#trainer-logging-controls input[type=number]::-webkit-outer-spin-button,
#trainer-logging-controls input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Stili Checkbox Personalizzato */
.form-group-checkbox.custom-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
}
.custom-checkbox label {
  font-size: 1rem;
  color: var(--text-color);
  position: relative;
  padding-left: 32px; /* Spazio per il box finto */
  line-height: 24px;
  user-select: none;
}
.custom-checkbox input[type="checkbox"] {
  display: none; /* Nasconde la checkbox reale */
}
.custom-checkbox label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  background: var(--card-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}
.custom-checkbox label::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  width: 6px;
  height: 12px;
  border: solid var(--bg-color);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.custom-checkbox input[type="checkbox"]:checked + label::before {
  background: var(--primary-color);
  border-color: var(--primary-color);
}
.custom-checkbox input[type="checkbox"]:checked + label::after {
  opacity: 1;
}