/* workouts.css */
.calendar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}
.calendar-btn:hover {
    background: var(--primary);
    color: #fff;
}
.calendar-btn:active {
    transform: scale(0.96);
}
#active-workout .main-content {
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
    padding-bottom: 100px;
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 140px);
}

/* Компактное отображение повторений в одну строку */
.exercise-reps-inline {
    margin-bottom: 8px;
}

.reps-value {
    color: var(--dark);
    font-weight: 500;
    font-size: 14px;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Week Tabs (Windows folder style) ---- */
.week-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    margin-bottom: 0;
    position: relative;
    border-bottom: 1px solid var(--gray-light, #e8e0d8);
}

.week-tab {
    flex: 1;
    padding: 9px 0 8px;
    background: transparent;
    color: var(--gray, #8c8279);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
    border-bottom: none;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
    border-radius: 10px 10px 0 0;
    margin: 0 -0.5px;
    z-index: 0;
}

.week-tab:active {
    background: rgba(0,0,0,0.03);
}

.week-tab.active {
    background: var(--white, #fff);
    color: var(--dark, #2c2520);
    font-weight: 700;
    border-color: var(--gray-light, #e8e0d8);
    z-index: 2;
    margin-bottom: -1px;
    padding-bottom: 9px;
}

.week-tab.current::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--primary, #C06A3E);
}

/* ---- Top bar: start button / rest / done ---- */
#workoutTopBar {
    padding: 12px 0 8px;
    animation: dashSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.workout-start-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--border-radius-small, 12px);
    background: var(--gradient-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.workout-start-btn:active {
    transform: scale(0.97);
}

.workout-rest-badge,
.workout-done-badge {
    text-align: center;
    padding: 12px;
    border-radius: var(--border-radius-small, 12px);
    font-size: 14px;
    font-weight: 600;
}

.workout-rest-badge {
    background: var(--gray-light, #f5f0eb);
    color: var(--gray, #8c8279);
}

.workout-done-badge {
    background: rgba(123, 143, 107, 0.12);
    color: var(--success, #7B8F6B);
}

/* Weekly plan container */
.weekly-plan {
    padding: 12px 0 4px;
    will-change: transform, opacity;
    overflow: hidden;
}

/* Выравнивание карусели и заголовков в плане тренировок */
.weekly-plan .library-section-header {
    padding: 0 4px;
}
.weekly-plan .library-carousel-card:first-child {
    margin-left: 0;
}
.weekly-plan .library-carousel-card:last-child {
    margin-right: 0;
}

/* ---- Week hint card ---- */
.workout-week-hint {
    margin-bottom: 6px;
}

.workout-week-hint-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--dark, #2c2520);
    margin-bottom: 2px;
}

.workout-week-hint-sub {
    font-size: 13px;
    color: var(--gray, #8c8279);
    margin-bottom: 8px;
}

.workout-week-progress {
    height: 4px;
    background: var(--gray-light, #f5f0eb);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.workout-week-progress-bar {
    height: 100%;
    background: var(--primary, #C06A3E);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.workout-week-progress-label {
    font-size: 11px;
    color: var(--gray, #8c8279);
    margin-bottom: 10px;
}

/* ---- Empty week card ---- */
.workout-empty-week-card {
    text-align: center;
    padding: 32px 20px;
    background: linear-gradient(135deg, var(--primary-very-light) 0%, rgba(var(--primary-rgb), 0.08) 100%);
    border-radius: var(--border-radius, 16px);
    border: 1px dashed rgba(var(--primary-rgb), 0.25);
    margin-top: 12px;
}

.workout-empty-week-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.workout-empty-week-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #3d3530);
    line-height: 1.4;
    margin-bottom: 16px;
}

.workout-empty-week-card .workout-start-btn {
    margin-top: 0;
}

.btn-workout-completed {
    background: var(--success);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    line-height: 1.3;
}

.btn-workout-completed:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(123, 143, 107, 0.3);
}

.btn-continue-workout {
    background: linear-gradient(135deg, rgba(251, 146, 60, 0.9) 0%, rgba(245, 158, 11, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    line-height: 1.3;
}

.btn-continue-workout:hover {
    background: linear-gradient(135deg, rgba(251, 146, 60, 1) 0%, rgba(245, 158, 11, 1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.workout-stats {
    font-size: 11px;
    opacity: 0.9;
    margin-top: 4px;
    font-weight: 500;
}

.workout-day-card {
    background: var(--white);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    border: 1px solid var(--gray-light);
    overflow: hidden;
}

.workout-day-header {
    padding: 12px 16px;
    background: var(--gray-light);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
}

.workout-day-header:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

.workout-day-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--dark);
    font-weight: 600;
}

.workout-day-content {
    display: none;
    padding: 8px;
}

.workout-day-card.expanded .workout-day-content {
    display: block;
}

.workout-duration {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-dark);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.workout-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

.workout-info-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}

.workout-duration, .workout-exercises {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.workout-duration {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-dark);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.workout-exercises {
    background: rgba(123, 143, 107, 0.1);
    color: var(--success);
    border: 1px solid rgba(123, 143, 107, 0.2);
}

.workout-exercises svg {
    color: inherit;
}

/* Workout exercises accordion */
.workout-exercises-content {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-light);
}

.workout-exercise-item {
    background: var(--surface-secondary);
    border-radius: 6px;
    margin-bottom: 1px;
    overflow: hidden;
}

.workout-exercise-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.workout-exercise-header:hover {
    background: rgba(var(--primary-rgb), 0.08);
}


.workout-exercise-header .exercise-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 15px;
    line-height: 1;
    margin: 0;
    padding: 0;
}


.workout-exercise-details {
    display: none;
    padding: 0;
    font-size: 13px;
    color: var(--gray);
}

.workout-exercise-item.expanded .workout-exercise-details {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    min-height: 50px !important;
    gap: 4px !important;
    padding: 8px 12px !important;
}

.workout-exercise-item.expanded .exercise-sets-reps,
.workout-exercise-item.expanded .exercise-description {
    margin: 0 !important;
    padding: 0 !important;
}

.exercise-sets-reps {
    font-weight: 600;
    color: var(--primary);
    font-size: 13px;
    line-height: 1;
    margin: 0;
    padding: 0;
}

.exercise-description {
    line-height: 1.3;
    font-size: 12px;
    color: var(--gray);
    margin: 0;
    padding: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.workout-day-card .workout-day-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.weekly-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.day-workout-card {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 16px;
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.day-workout-card:hover {
    border-color: var(--primary);
    transform: translateX(2px);
    box-shadow: var(--shadow-lg);
}

.day-workout-card.today {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(123, 143, 107, 0.05) 0%, rgba(123, 143, 107, 0.1) 100%);
}

.day-workout-card.completed {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(123, 143, 107, 0.08) 0%, rgba(123, 143, 107, 0.12) 100%);
}

.day-workout-card.rest-day {
    opacity: 0.6;
    cursor: default;
    background: var(--light);
}

.day-workout-card.rest-day:hover {
    transform: none;
    border-color: var(--gray-light);
    box-shadow: none;
}

.day-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.day-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
}

.today-badge {
    background: var(--success);
    color: white;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.completed-badge {
    background: var(--success);
    color: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-card-content {
    flex: 1;
}

.workout-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 2px;
}

.workout-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--gray);
}

.completion-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
}

.card-arrow {
    color: var(--gray);
    font-size: 16px;
    font-weight: 600;
}

.btn-toggle-details {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

/* =============== АКТИВНАЯ ТРЕНИРОВКА =============== */

.workout-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
}

.workout-progress-bar .progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    width: 0%;
    position: relative;
}

.workout-progress-bar .progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 100%);
    animation: shimmer 2s infinite;
}

.exercise-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-light);
    margin-bottom: 16px;
}

.exercise-number {
    font-size: 12px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exercise-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 12px;
    line-height: 1.2;
}

.exercise-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--light);
    border-radius: 12px;
}

.exercise-param {
    text-align: center;
}

.param-label {
    display: block;
    font-size: 11px;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.param-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.exercise-description {
    margin-bottom: 16px;
}

.exercise-description h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exercise-description p {
    font-size: 13px;
    color: var(--dark-light);
    line-height: 1.4;
    background: rgba(var(--primary-rgb), 0.05);
    padding: 12px;
    border-radius: 8px;
    border-left: 2px solid var(--primary);
}

.sets-tracker h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
}

.sets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.set-btn {
    background: var(--white);
    border: 1.5px solid var(--gray-light);
    border-radius: 12px;
    padding: 12px 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 60px;
    position: relative;
}

.set-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.set-btn.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
    transform: scale(1.03);
    animation: setCompleted 0.4s ease-out;
}

.set-btn.completed:hover {
    transform: scale(1.05) translateY(-2px);
}

.set-number {
    font-size: 12px;
    font-weight: 600;
}

.set-status {
    font-size: 16px;
    font-weight: 700;
}

.exercise-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-light);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    max-width: 430px;
    margin: 0 auto;
    padding: 16px 20px;
}

.exercise-navigation #nextExerciseBtn,
.exercise-navigation #finishWorkoutBtn {
    margin-left: auto;
}

/* Стили для кнопок навигации без текста */
.exercise-navigation .nav-btn-compact {
    padding: 10px 16px;
    border-radius: 10px;
    min-width: 50px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Правило для активной тренировки перенесено выше к общим правилам прокрутки */

/* Анимация для смены упражнений */
.exercise-card {
    animation: exerciseSlideIn 0.3s ease-out;
}


/* =============== ПЛАН ТРЕНИРОВОК =============== */

#planContent, #workoutPlanContent {
    padding: 0;
    line-height: 1.3;
    font-size: 12px;
}

#planContent h1, #workoutPlanContent h1 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--primary);
}

#planContent h2, #workoutPlanContent h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin: 8px 0 6px 0;
    padding: 4px 8px;
    background: var(--light);
    border-radius: 4px;
    border-left: 2px solid var(--success);
}

#planContent h3, #workoutPlanContent h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--dark-light);
    margin: 6px 0 4px 0;
}

#planContent strong, #workoutPlanContent strong {
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
}

#planContent ul, #workoutPlanContent ul {
    margin: 2px 0 6px 0;
    padding-left: 0;
    list-style: none;
}

#planContent li, #workoutPlanContent li {
    margin-bottom: 1px;
    padding: 1px 0 1px 12px;
    position: relative;
    font-size: 11px;
    color: var(--dark-light);
}

#planContent li::before, #workoutPlanContent li::before {
    content: '•';
    color: var(--success);
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 12px;
}

#planContent hr, #workoutPlanContent hr {
    border: none;
    height: 1px;
    background: var(--gray-light);
    margin: 8px 0;
}

#planContent p, #workoutPlanContent p {
    margin-bottom: 6px;
    color: var(--dark);
    font-size: 12px;
}

#workouts {
    background: var(--bg-dashboard) !important;
}

#workouts .main-content {
    padding: 12px 20px 100px;
}

#active-workout {
    background: var(--bg-dashboard) !important;
}

/* =============== СТАТУСЫ ВЫПОЛНЕНИЯ ТРЕНИРОВОК =============== */

.workout-day-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.workout-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.workout-status.completed {
    background: rgba(123, 143, 107, 0.1);
    color: var(--success);
    border: 1px solid rgba(123, 143, 107, 0.2);
}

.workout-status.partial {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.workout-day-card.completed {
    border-color: rgba(123, 143, 107, 0.2);
    background: rgba(123, 143, 107, 0.02);
}

.workout-day-card.completed .workout-day-header {
    background: rgba(123, 143, 107, 0.05);
}

.workout-day-card.expanded > .workout-day-header > .expand-icon {
    transform: rotate(90deg) !important;
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* =============== DARK THEME OVERRIDES =============== */
[data-theme="dark"] .workout-day-card {
    border-color: var(--border);
}
[data-theme="dark"] .workout-day-header {
    background: rgba(var(--primary-rgb), 0.08);
}
[data-theme="dark"] .day-workout-card {
    border-color: var(--border);
}
[data-theme="dark"] .exercise-card {
    border-color: var(--border);
}
[data-theme="dark"] .set-btn {
    border-color: var(--border);
}
[data-theme="dark"] .week-tabs {
    border-color: var(--border);
}

