/* ============================================================
   WP WORKOUT PLUGIN - STYLE v7.9.1
   Salvataggio progressi user-specific per utente loggato
   ============================================================ */

.workout-container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---- CARD ESERCIZIO ---- */
.exercise-card {
    border: 1px solid #ddd;
    padding: 25px;
    margin-bottom: 30px;
    margin-left: 0;
    margin-right: 0;
    border-radius: 12px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    width: 100%;
    box-sizing: border-box;
}

.exercise-card h3 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
    padding-bottom: 12px;
    color: #333;
    font-size: var(--workout-exercise-title-size, 18px);
    line-height: 1.4;
}

.exercise-photo {
    max-width: var(--workout-exercise-photo-width, 50%);
    height: auto;
    display: block;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ============================================================
   TABELLA SERIE / RIPETIZIONI / CARICO
   ============================================================ */
.exercise-sets-container {
    margin-top: 15px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
}

.sets-table-frontend {
    width: 100%;
    border-collapse: collapse;
}

.sets-table-frontend thead th {
    text-align: center;
    padding: 10px 6px;
    font-size: 11px;
    text-transform: uppercase;
    color: #555;
    letter-spacing: 1px;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 700;
}

/* Colonna FATTO (flag verde) */
.sets-table-frontend thead th.th-done {
    width: 48px;
    min-width: 48px;
}

.set-label {
    display: none;
}

.set-row {
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
    transition: background 0.15s;
}

.set-row:nth-child(even) {
    background-color: #f2f8ff;
}

.set-row:last-child {
    border-bottom: none;
}

.set-row td {
    padding: 14px 8px;
    text-align: center;
    vertical-align: middle;
}

.big-font {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    display: inline-block;
    line-height: 1.2;
}

/* Input carico con unità Kg integrata */
.load-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 2px solid #0073aa;
    border-radius: 8px;
    padding: 3px 8px 3px 5px;
    box-shadow: 0 1px 4px rgba(0,115,170,0.1);
}

.user-load.big-font {
    width: 58px;
    padding: 3px 4px;
    border: none;
    border-radius: 0;
    text-align: center;
    background: transparent;
    color: #0073aa;
    font-size: 20px;
    font-weight: 700;
    outline: none;
    -moz-appearance: textfield;
}

.user-load.big-font::-webkit-outer-spin-button,
.user-load.big-font::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.load-unit {
    display: none;
}

/* Checkbox "Fatto" - flag verde */
.set-done-cell {
    width: 48px;
    min-width: 48px;
    text-align: center;
}

.set-done-checkbox {
    display: none;
}

.set-done-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    color: transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.set-done-label::after {
    content: '✓';
    font-size: 16px;
    font-weight: 900;
    color: transparent;
    transition: color 0.2s ease;
}

.set-done-checkbox:checked + .set-done-label {
    background: #38a169;
    border-color: #38a169;
    box-shadow: 0 2px 6px rgba(56,161,105,0.35);
}

.set-done-checkbox:checked + .set-done-label::after {
    color: #fff;
}

/* Riga completata: leggero sfondo verde */
.set-row.set-completed {
    background-color: #f0fff4 !important;
}

/* ============================================================
   AREA NOTE + SALVA PROGRESSI
   ============================================================ */
.exercise-notes {
    margin-top: 20px;
    padding: 16px 18px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #e8e8e8;
    width: 100%;
    box-sizing: border-box;
}

.exercise-notes label {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    display: block;
    margin-bottom: 8px;
}

.user-notes {
    width: 100% !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    padding: 8px 12px !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    resize: none !important;
    box-sizing: border-box !important;
    background: #fff !important;
    line-height: 1.2 !important;
    transition: border-color 0.2s !important;
    overflow-y: auto !important;
    display: block !important;
}

.user-notes:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

/* Riga note-footer: salva a destra */
.notes-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
}

.save-exercise-data {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background-color: #38a169;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.3px;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(56,161,105,0.25);
}

.save-exercise-data::before {
    content: '💾';
    font-size: 14px;
}

.save-exercise-data:hover {
    background-color: #2f855a;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(56,161,105,0.3);
}

.save-exercise-data:active {
    transform: translateY(0);
}

/* ============================================================
   TIMER CIRCOLARE — layout v6.0 ma più grande
   ============================================================ */
.circle-timer-container {
    margin: 20px 0;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;   /* cerchio a sinistra */
    gap: 25px !important;
    width: 100%;
    max-width: 100%;
    padding: 14px 16px;
    background: #fcfcfc;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Cerchio SVG del timer — INGRANDITO */
.circle-timer {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(255,152,0,0.15));
}

.circle-timer svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    cursor: pointer;
    overflow: visible;
}

.circle-timer .bg {
    fill: none;
    stroke: #ffe0b2;
    stroke-width: 10;
}

.circle-timer .progress {
    fill: none;
    stroke: #ff9800;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.circle-timer .time-display {
    font-size: 26px;
    font-weight: 800;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
    pointer-events: none;
    z-index: 2;
    letter-spacing: -0.5px;
}

/* Label pausa */
.pause-mode-label-side {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    color: #ff9800;
    letter-spacing: 0.5px;
    background: #fff;
    padding: 2px 6px;
    border: 1px solid #ff9800;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Colonna controlli destra del timer */
.timer-controls-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
}

/* Riga bottoni +/- e label pausa */
.timer-controls-right .controls {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

/* Bottoni + e - */
.timer-controls-right .controls button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #ff9800;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.timer-controls-right .controls button:hover {
    background: #f57c00;
    transform: scale(1.05);
}

/* Preset tempi */
.timer-controls-right .presets {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.timer-controls-right .presets button {
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.timer-controls-right .presets button:hover {
    background: #f8f9fa;
    border-color: #ddd;
    color: #333;
}

/* Timer in esecuzione */
.circle-timer-container.running .progress {
    stroke: #e53e3e;
}

.circle-timer-container.running .time-display {
    color: #e53e3e;
}

.circle-timer-container.running .controls button,
.circle-timer-container.running .presets button {
    opacity: 0.4;
    pointer-events: none;
}

/* Hint "clicca per avviare" */
.timer-hint {
    display: none;
}

/* ============================================================
   TIMER TABATA - Layout simile al timer pausa
   ============================================================ */
.tabata-timer-container {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    padding: 16px 18px;
    background: #fcfcfc;
    border: 2px solid #e53e3e;
    border-radius: 12px;
    box-sizing: border-box;
    box-shadow: 0 3px 10px rgba(229, 62, 62, 0.15);
}

.tabata-timer-header {
    width: 100%;
    text-align: center;
}

.tabata-timer-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #e53e3e, #c53030);
    padding: 6px 20px;
    border-radius: 20px;
    letter-spacing: 1px;
    box-shadow: 0 2px 6px rgba(229, 62, 62, 0.3);
}

.tabata-timer-display {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.tabata-circle-timer {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(229, 62, 62, 0.2));
}

.tabata-circle-timer svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    cursor: pointer;
    overflow: visible;
}

.tabata-circle-timer .tabata-bg {
    fill: none;
    stroke: #fed7d7;
    stroke-width: 10;
}

.tabata-circle-timer .tabata-progress {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.tabata-time-display {
    font-size: 28px;
    font-weight: 800;
    color: #333;
    font-family: 'Courier New', Courier, monospace;
    pointer-events: none;
    z-index: 2;
    letter-spacing: -0.5px;
}

.tabata-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.tabata-phase-name {
    font-size: 22px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tabata-cycle-info {
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.tabata-series-info {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    margin-top: 4px;
}

.tabata-phase-indicators {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.tabata-phase-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tabata-phase-dot.active {
    transform: scale(1.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.tabata-timer-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    width: 100%;
}

.tabata-start-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #38a169, #2f855a);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(56, 161, 105, 0.3);
    transition: all 0.2s ease;
}

.tabata-start-btn:hover {
    background: linear-gradient(135deg, #2f855a, #276749);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(56, 161, 105, 0.4);
}

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

.tabata-start-btn.running {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    box-shadow: 0 3px 8px rgba(229, 62, 62, 0.3);
}

.tabata-start-btn.running:hover {
    background: linear-gradient(135deg, #c53030, #9b2c2c);
    box-shadow: 0 5px 15px rgba(229, 62, 62, 0.4);
}

.tabata-reset-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #718096;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(113, 128, 150, 0.3);
    transition: all 0.2s ease;
}

.tabata-reset-btn:hover {
    background: #4a5568;
    transform: translateY(-2px);
}

/* TABATA Timer in esecuzione */
.tabata-timer-container.running .tabata-progress {
    stroke: #e53e3e;
}

.tabata-timer-container.running .tabata-time-display {
    color: #e53e3e;
}

.tabata-timer-container.running .tabata-start-btn {
    opacity: 0.7;
    pointer-events: none;
}

/* ============================================================
   CARD SOLO COMMENTO
   ============================================================ */
.comment-only-card {
    border-left: 5px solid #0073aa;
    background-color: #f0f8ff;
}

.comment-only-card h3 {
    border-bottom-color: #0073aa;
    color: #0073aa;
}

/* ============================================================
   TOGGLE FOTO / DESCRIZIONE
   ============================================================ */
.workout-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 8px;
    margin: 15px 0 5px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.workout-toggle-header:hover {
    background: #f0f0f0;
}

.workout-toggle-header.active {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}

.toggle-title {
    font-size: 13px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workout-toggle-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--workout-primary, #0073aa);
    background: transparent;
    color: var(--workout-primary, #0073aa);
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    min-width: 28px;
}

.workout-toggle-btn:hover {
    transform: scale(1.1);
}

.workout-toggle-btn.active {
    background: var(--workout-primary, #0073aa);
    color: #fff;
}

.workout-toggle-content {
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 8px 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* ============================================================
   AREA PRIVATA WORKOUT
   ============================================================ */
.private-workout-area {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.private-area-title {
    text-align: center;
    color: #0073aa;
    margin-bottom: 40px;
    font-size: 28px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.workout-notice {
    background: #fff9e6;
    border-left: 4px solid #ffcc00;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    color: #856404;
}

.assigned-workout-block {
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.workout-title-header {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    border-bottom: 3px solid var(--workout-primary, #0073aa);
    padding-bottom: 8px;
    margin-bottom: 15px;
}

/* ============================================================
   RESPONSIVE — tablet (481px - 768px)
   ============================================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .workout-container {
        padding: 0 12px !important;
    }

    .exercise-card {
        padding: 18px !important;
    }

    .circle-timer-container {
        padding: 12px 12px !important;
    }
}

/* ============================================================
   RESPONSIVE — max 480px (mobile)
   ============================================================ */
@media (max-width: 480px) {
    /* Container a larghezza piena su mobile */
    .workout-container {
        padding: 0 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    .exercise-card {
        padding: 15px !important;
        margin-left: -8px !important;
        margin-right: -8px !important;
        border-radius: 0 !important;
    }

    .sets-table-frontend thead {
        display: none;
    }

    .set-label {
        display: block;
        font-size: 9px;
        color: #888;
        margin-bottom: 2px;
    }

    .big-font {
        font-size: 18px;
    }

    .user-load.big-font {
        width: 50px;
        font-size: 16px;
    }

    .set-row td {
        padding: 10px 3px;
    }

    .circle-timer-container {
        gap: 12px !important;
        padding: 12px 8px !important;
        justify-content: flex-start !important;
    }

    .circle-timer {
        width: 110px;
        height: 110px;
    }

    .circle-timer .time-display {
        font-size: 20px;
    }

    .timer-controls-right .controls button {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }

    .timer-controls-right .presets button {
        padding: 3px 6px;
        font-size: 9px;
    }

    .notes-footer {
        justify-content: flex-end;
    }

    /* TABATA Timer Responsive */
    .tabata-timer-container {
        padding: 12px 8px !important;
    }

    .tabata-circle-timer {
        width: 100px;
        height: 100px;
    }

    .tabata-time-display {
        font-size: 22px;
    }

    .tabata-phase-name {
        font-size: 18px;
    }

    .tabata-start-btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .exercise-notes {
        padding: 12px 10px !important;
    }

    .exercise-custom-fields {
        padding: 12px 10px !important;
    }

    .progress-history-container {
        padding: 10px !important;
    }
}
