/* ============================================================ */
/* НАЧАЛО: Стили конструктора программ */
/* ============================================================ */

/* Кнопка конструктора на главной странице */
.card-purple {
    background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
}

.card-purple:active {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Основной контейнер конструктора */
#constructor-editor {
    min-height: 100vh;
    transform: none !important;
    position: relative;
    z-index: 10;
}

/* Header библиотеки программ */
.constructor-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    background: #191a1f;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Вкладки навигации - удалены, оставлен код для совместимости */
.constructor-tabs {
    display: none;
}

/* Кнопка Назад в библиотеке */
.constructor-back-btn {
    width: auto;
    min-width: 80px;
    padding: 0 12px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.constructor-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.constructor-back-btn:active {
    transform: scale(0.95);
}

/* Заголовок библиотеки */
.constructor-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    flex: 1;
    text-align: center;
}

.constructor-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #babfc7;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.constructor-tab.active {
    background: #36a3d1;
    color: #fff;
}

.constructor-tab:active {
    transform: scale(0.97);
}

/* Контент библиотеки и программы */
.constructor-library-content,
.constructor-program-content {
    padding: 24px 20px 40px 20px;
}

/* Кнопка добавления программы */
.add-program-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #36a3d1 0%, #1e87b2 100%);
    border: none;
    border-radius: 18px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(54, 163, 209, 0.25);
}

.add-program-btn svg {
    width: 24px;
    height: 24px;
}

.add-program-btn:hover {
    transform: translateY(-3px);
}

.add-program-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(54, 163, 209, 0.2);
}

/* Список пользовательских программ */
.custom-programs-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── «Новое» badge ── */
.new-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, #34aadd 0%, #38ef7d 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    animation: newBadgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 12px rgba(52, 170, 221, 0.4);
}

@keyframes newBadgePulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 2px 12px rgba(52, 170, 221, 0.4);
    }

    50% {
        opacity: 0.85;
        box-shadow: 0 2px 18px rgba(56, 239, 125, 0.5);
    }
}

.custom-program-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: rgba(25, 26, 31, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
    position: relative;
}

.custom-program-card.has-new {
    border-color: rgba(52, 170, 221, 0.25);
    box-shadow: 0 0 20px rgba(52, 170, 221, 0.08);
}

.custom-program-card:hover {
    background: rgba(40, 42, 50, 0.8);
    transform: translateY(-2px);
}

.custom-program-card:active {
    transform: scale(0.98);
}

.custom-program-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.custom-program-icon svg {
    width: 18px !important;
    height: 18px !important;
}

.custom-program-info {
    flex: 1;
    min-width: 0;
}

.custom-program-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.custom-program-name .name-text {
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-program-workouts {
    font-size: 0.9rem;
    color: #8e94a0;
    font-weight: 500;
}

/* Badges row below name/workouts count */
.routine-badges-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* Draft badge */
.draft-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    background: #8e8e93;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Actions container on the right side of the card */
.routine-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Assign button */
.assign-routine-btn {
    background: #34aadd;
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    cursor: pointer;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
}

.assign-routine-btn:active {
    transform: scale(0.95);
    background: #2b93c2;
}

.constructor-view {
    display: none;
    opacity: 0;
}

.constructor-view.active {
    display: block;
    animation: constructorFadeIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes constructorFadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* Редактор программы */
/* Унифицированный премиальный хедер для конструктора */
.constructor-header-unified {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 16px;
    background: rgba(10, 11, 14, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-sizing: border-box;
}

.constructor-header-unified .constructor-title {
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.constructor-header-unified .constructor-title.align-left {
    text-align: left;
}

.constructor-header-unified .header-btn-wrap {
    width: auto;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.constructor-header-unified .constructor-back-btn {
    margin-left: 8px;
}

.constructor-header-unified .constructor-back-btn,
.constructor-header-unified .exercises-close-btn,
.constructor-header-unified .exercises-search-btn,
.constructor-header-unified .exercises-filter-btn {
    width: auto;
    min-width: 70px;
    padding: 0 12px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: 700;
    font-size: 14px;
}

.constructor-header-unified button:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.95);
}

.constructor-header-unified .constructor-save-btn {
    background: #34aadd;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.constructor-header-unified .constructor-save-btn:active {
    transform: scale(0.96);
    background: #2b93c2;
}

/* Старые стили для совместимости или замены */
.constructor-library-header {
    display: none;
    /* Заменяем на унифицированный */
}

.constructor-header {
    display: none;
    /* Заменяем на унифицированный */
}

.exercises-header {
    display: none;
    /* Заменяем на унифицированный */
}

.constructor-back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.constructor-back-btn:active {
    transform: scale(0.95);
}

.constructor-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    flex: 1;
    text-align: center;
    letter-spacing: 0.3px;
    margin: 0;
}

.constructor-save-btn {
    background: #36a3d1;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.constructor-save-btn:hover {
    background: rgba(54, 163, 209, 0.25);
}

.constructor-save-btn:active {
    transform: scale(0.95);
}

.constructor-editor-content {
    padding: 16px 8px 40px 8px;
}

.constructor-input,
.constructor-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-family: inherit;
    box-sizing: border-box;
}

.constructor-input {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    padding: 0;
}

.constructor-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.constructor-input:focus {
    outline: none;
}

.constructor-textarea {
    font-size: 1.05rem;
    color: #babfc7;
    resize: none;
    min-height: 48px;
    line-height: 1.5;
    margin-bottom: 32px;
    padding: 0;
}

.constructor-textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.constructor-textarea:focus {
    outline: none;
}

/* Списки упражнений - отступ для двойного fixed header */
.exercises-lists-container {
    padding-top: 10px;
}

/* Список упражнений в программе */
.program-exercises-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 40px;
    padding: 0 0 0 0;
}

.program-exercise-card {
    background: transparent;
    border: none;
    padding: 0;
    display: block;
    margin-bottom: 0;
}

.program-exercise-top {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 8px;
}

.program-exercise-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.program-exercise-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    flex-shrink: 0;
}

.program-exercise-info {
    flex: 1;
}

.program-exercise-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
}

.program-exercise-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.3;
    flex: 1;
    padding-right: 12px;
}

.program-exercise-short-sets {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease;
}

.program-exercise-card.expanded .program-exercise-short-sets {
    max-height: 0;
    opacity: 0;
    margin-top: -8px;
    pointer-events: none;
}

.short-set-item {
    font-size: 0.95rem;
    color: #8e94a0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.short-set-num {
    color: #36a3d1;
    font-weight: 600;
    min-width: 14px;
    text-align: right;
}

.program-exercise-expanded-content {
    width: 100%;
    margin-top: 0;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-top 0.3s ease, visibility 0.35s;
    will-change: max-height, opacity;
}

.program-exercise-card.expanded .program-exercise-expanded-content {
    max-height: 2000px;
    opacity: 1;
    visibility: visible;
    margin-top: 10px;
}

.program-exercise-notes {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #babfc7;
    font-size: 0.95rem;
    padding: 8px 0;
    margin-bottom: 20px;
    font-family: inherit;
    transition: 0.2s;
}

.program-exercise-notes:focus {
    outline: none;
    border-color: rgba(54, 163, 209, 0.5);
    color: #fff;
}

.program-exercise-notes::placeholder {
    color: #5d636e;
}

.program-exercise-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #36a3d1;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 20px;
    cursor: pointer;
}

.program-exercise-timer svg {
    width: 18px;
    height: 18px;
}

.program-exercise-sets-container {
    width: 100%;
}

.program-exercise-sets-header {
    display: flex;
    align-items: center;
    padding: 0 16px;
    margin-bottom: 8px;
    color: #8e94a0;
    font-size: 0.85rem;
    font-weight: 500;
    box-sizing: border-box;
}

.program-exercise-sets {
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.program-exercise-set-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: 2px;
}

.set-delete-action {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: #ff3b30;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
    color: #fff;
    z-index: 1;
    border-radius: 4px;
    box-sizing: border-box;
}

.set-delete-action svg {
    width: 24px;
    height: 24px;
}

.program-exercise-set {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #1e1f29;
    transition: transform 0.2s ease-out;
    cursor: default;
    touch-action: pan-y;
    box-sizing: border-box;
}

.program-exercise-set.even {
    background: #191a1f;
}

.col-num {
    width: 15%;
    min-width: 45px;
}

.col-prev {
    flex: 1;
    text-align: center;
    color: #8e94a0;
    font-size: 0.9rem;
}

.col-kg {
    width: 20%;
    text-align: center;
}

.col-reps {
    width: 25%;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.col-reps svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    opacity: 0.7;
}

.program-exercise-set .col-num.val {
    color: #36a3d1;
    font-weight: 600;
}

.program-exercise-set .col-kg.val,
.program-exercise-set .col-reps.val {
    font-weight: 600;
}

.add-set-btn {
    width: 100%;
    background: #191a1f;
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 20px;
    cursor: pointer;
    transition: background 0.2s;
    box-sizing: border-box;
}

.add-set-btn:hover {
    background: #202128;
}

.add-set-btn:active {
    transform: scale(0.98);
}

.set-input {
    background: transparent;
    border: 1px solid transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    width: 40px;
    text-align: center;
    padding: 4px 0;
    font-family: inherit;
    border-radius: 6px;
    transition: border-color 0.2s, background 0.2s;
    appearance: textfield;
    -moz-appearance: textfield;
}

.set-input::-webkit-outer-spin-button,
.set-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.set-input:focus {
    outline: none;
    border-color: #36a3d1;
    background: rgba(255, 255, 255, 0.05);
}

.col-reps .set-input {
    width: 36px;
    margin-right: 4px;
}

.program-exercise-menu {
    background: transparent;
    border: none;
    color: #36a3d1;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
    margin-left: auto;
}

.program-exercise-menu:hover {
    background: rgba(54, 163, 209, 0.1);
}

.program-exercise-menu svg {
    width: 20px;
    height: 20px;
}

/* Кнопка добавления упражнений */
.add-exercises-btn {
    width: 100%;
    background: #fff;
    color: #000;
    border: none;
    padding: 18px;
    border-radius: 28px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 40px;
}

.add-exercises-btn:hover {
    background: #f2f3f5;
}

.add-exercises-btn:active {
    transform: scale(0.98);
}

/* Экран добавления упражнений */
.exercises-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px;
    background: #191a1f;
    position: sticky;
    top: 0;
    z-index: 99;
}

.exercises-header h2 {
    flex: 1;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 12px;
}

.exercises-close-btn,
.exercises-search-btn,
.exercises-filter-btn,
.exercises-add-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercises-close-btn svg,
.exercises-search-btn svg,
.exercises-filter-btn svg,
.exercises-add-btn svg {
    width: 24px;
    height: 24px;
}

.exercises-actions {
    display: flex;
    gap: 4px;
}

/* Быстрый выбор мышц (Quick Muscle Filter) */
.quick-muscle-filters {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px 16px;
    margin-bottom: 8px;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    -webkit-overflow-scrolling: touch;
}

.quick-muscle-filters::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.quick-muscle-item {
    flex: 0 0 auto;
    width: 68px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.quick-muscle-icon-wrap {
    width: 56px;
    height: 56px;
    background: #191a1f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.quick-muscle-icon-wrap svg {
    width: 130%;
    height: 130%;
    transition: all 0.3s ease;
    object-fit: contain;
}

.quick-muscle-icon-wrap svg image {
    opacity: 1;
}

.quick-muscle-icon-wrap svg polygon {
    fill: #ffffff;
    opacity: 0.9;
}

.quick-muscle-item.active .quick-muscle-icon-wrap svg image {
    opacity: 1;
}

.quick-muscle-item.active .quick-muscle-icon-wrap svg polygon {
    fill: #34aadd;
    opacity: 1;
}

.quick-muscle-label {
    font-size: 11px;
    color: #8e94a0;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.quick-muscle-item.active .quick-muscle-icon-wrap {
    background: rgba(54, 163, 209, 0.15);
    border-color: #36a3d1;
    box-shadow: 0 0 15px rgba(54, 163, 209, 0.25);
}

.quick-muscle-item.active .quick-muscle-icon-wrap svg {
    color: #36a3d1;
}

.quick-muscle-item.active .quick-muscle-label {
    color: #36a3d1;
}

.more-filter-item .quick-muscle-icon-wrap svg {
    width: 24px;
    height: 24px;
    color: #babfc7;
}

.more-filter-item:active .quick-muscle-icon-wrap {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: scale(0.95);
}

/* Секции списков упражнений */
.exercises-list-section {
    margin: 0 0 20px 0;
    padding-bottom: 50px;
}

.exercises-list-section:last-child {
    padding-bottom: 200px;
}

.exercises-list-section h3 {
    margin-bottom: 28px;
}

/* Контент упражнений */
.exercises-content {
    padding: 0 20px 100px 20px;
}

.exercises-section {
    margin-bottom: 28px;
}

.exercises-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.exercises-section-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.exercises-view-toggle {
    background: transparent;
    border: none;
    color: #8e94a0;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: 0.2s;
}

.exercises-view-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.exercises-view-toggle svg {
    width: 20px;
    height: 20px;
}

/* Список упражнений */
.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.exercise-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: #15161a;
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.exercise-item:hover {
    background: #1b1d24;
}

.exercise-item.selected {
    background: rgba(54, 163, 209, 0.1);
    border-color: rgba(54, 163, 209, 0.3);
}

.exercise-preview {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    background: #1f2026;
    flex-shrink: 0;
}

.exercise-info {
    flex: 1;
}

.exercise-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.25;
}

.exercise-muscle {
    font-size: 0.9rem;
    color: #8e94a0;
    font-weight: 500;
}

/* Кастомный чекбокс */
.exercise-checkbox {
    width: 26px;
    height: 26px;
    border: 2px solid #5a5f6b;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.exercise-item.selected .exercise-checkbox {
    background: #36a3d1;
    border-color: #36a3d1;
    box-shadow: 0 2px 8px rgba(54, 163, 209, 0.4);
}

.exercise-checkbox svg {
    width: 16px;
    height: 16px;
    display: none;
}

.exercise-item.selected .exercise-checkbox svg {
    display: block;
}

/* Фиксированная кнопка подтверждения выбора упражнений */
.confirm-exercises-btn {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 20px;
    right: 20px;
    width: calc(100% - 40px);
    margin: 0 auto;
    padding: 18px 32px;
    border-radius: 20px;
    background: linear-gradient(135deg, #36a3d1 0%, #1e87b2 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 9990;
    /* Поверх всех экранов, но под модалкой (9999) */
    display: none;
    text-align: center;
}

.confirm-exercises-btn:active {
    transform: scale(0.96);
}

/* Модальное окно создания программы - Bottom Sheet */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active,
.modal[style*="display: flex"] {
    display: flex !important;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.create-program-modal {
    background: #191a1f;
    border-radius: 28px 28px 0 0;
    padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    position: relative;
    margin: 0;
}

/* Декоративная ручка сверху для bottom sheet */
.create-program-modal::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.create-program-modal h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin: 12px 0 28px 0;
    text-align: center;
    line-height: 1.3;
}

.modal-input {
    width: 100%;
    padding: 18px 20px;
    background: #101115;
    border: 2px solid transparent;
    border-radius: 16px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: 'SF Pro Display', system-ui, Arial, sans-serif;
    margin-bottom: 28px;
    box-sizing: border-box;
    transition: all 0.2s;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

.modal-input:focus {
    outline: none;
    border-color: #36a3d1;
    background: #13151a;
}

.modal-input::placeholder {
    color: #5d636e;
}

.modal-actions {
    display: flex;
    gap: 16px;
}

.modal-btn {
    flex: 1;
    padding: 18px;
    border: none;
    border-radius: 18px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: #23242a;
    color: #babfc7;
}

.modal-btn-cancel:active {
    background: #1a1b20;
    transform: scale(0.97);
}

.modal-btn-create {
    background: #36a3d1;
    color: #fff;
    box-shadow: 0 6px 20px rgba(54, 163, 209, 0.3);
}

.modal-btn-create:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(54, 163, 209, 0.2);
}

/* ============================================================ */
/* НАЧАЛО: Стили меню упражнения (Bottom Sheet) */
/* ============================================================ */
.exercise-menu-sheet {
    background: #191a1f;
    border-radius: 28px 28px 0 0;
    width: 100%;
    margin: 0 auto;
    padding: 12px 0 calc(20px + env(safe-area-inset-bottom, 0px));
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 16px auto;
}

.sheet-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 24px 0;
    padding: 0 20px;
}

.sheet-options-list {
    display: flex;
    flex-direction: column;
}

.sheet-option-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    background: transparent;
    border: none;
    padding: 16px 24px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.sheet-option-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sheet-option-btn svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.sheet-option-btn.sheet-delete-btn {
    color: #ff453a;
}

.sheet-option-btn.sheet-delete-btn svg {
    stroke: #ff453a;
}

/* ============================================================ */
/* КОНЕЦ: Стили меню упражнения (Bottom Sheet) */
/* ============================================================ */

/* ============================================================ */
/* КОНЕЦ: Стили конструктора программ */
/* ============================================================ */
/* ============================================================ */
/* FIXES FOR EXPANDED EXERCISE UI */
/* ============================================================ */
#constructor-editor .sets-head-row,
#constructor-editor .set-row {
    grid-template-columns: 45px minmax(70px, 1fr) 85px 85px !important;
}

#constructor-editor .sets-table-grid.is-compact .sets-head-row,
#constructor-editor .sets-table-grid.is-compact .set-row {
    grid-template-columns: 40px minmax(65px, 1fr) 75px 75px !important;
}

#constructor-editor .add-set-btn {
    width: 100% !important;
    margin: 12px 0 4px 0 !important;
    color: #fff !important;
}

#constructor-editor .exercise.program-exercise-card {
    display: flex;
    flex-direction: column;
}

#constructor-editor .exercise-top {
    width: 100%;
    align-items: stretch;
}

#constructor-editor .exercise-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#constructor-editor .exercise-title {
    width: 100%;
}

/* ============================================================ */
/* ЗРИТЕЛЬНАЯ СВЯЗЬ СУПЕРСЕТОВ */
/* ============================================================ */
/* Суперсет: цветная граница только на миниатюре упражнения */
.program-exercise-card[data-superset] .exercise-img {
    border-left: 4px solid var(--superset-color, #f5a623);
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    box-sizing: border-box;
}

/* Убираем класс has-superset с полной карточки конструктора */
#constructor-editor .exercise.has-superset {
    border-left: none !important;
}

/* Визуальный линк сверху вниз к предыдущему суперсету */
.program-exercise-card[data-superset-link="above"]::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 16px;
    width: 4px;
    height: 12px;
    background-color: var(--superset-color, #f5a623);
    z-index: 10;
}

/* ============================================================ */
/* КОНЕЦ: ЗРИТЕЛЬНАЯ СВЯЗЬ СУПЕРСЕТОВ */
/* ============================================================ */


.superset-candidates-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.superset-candidate-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.superset-candidate-btn:active {
    background: #2a2b30;
}

.superset-candidate-btn.selected {
    background: rgba(52, 170, 221, 0.1);
}

.superset-candidate-btn.selected .check-icon {
    display: block;
    color: #34aadd;
}

.superset-candidate-btn .check-icon {
    display: none;
    margin-left: auto;
}

.superset-candidate-btn img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #2a2b30;
}

/* ============================================================ */
/* КОНЕЦ: Модальное окно создания суперсета */
/* ============================================================ */

/* ============================================================ */
/* НАЧАЛО: Drag-and-drop для упражнений */
/* ============================================================ */

/* Ручка перетаскивания — правая вертикальная зона внутри exercise-top */
.exercise-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    flex-shrink: 0;
    align-self: stretch;
    color: rgba(186, 191, 199, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 0 12px 12px 0;
    transition: color 0.2s, background 0.2s;
    margin-left: 4px;
}

.exercise-drag-handle:hover,
.exercise-drag-handle:active {
    color: rgba(52, 170, 221, 0.65);
    background: rgba(52, 170, 221, 0.07);
    cursor: grabbing;
}

.exercise-drag-handle svg {
    pointer-events: none;
}

/* Карточка-источник во время перетаскивания — скрыта и не занимает место */
.program-exercise-card.is-dragging-source {
    opacity: 0;
    pointer-events: none;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* ============================================================ */
/* КОНЕЦ: Drag-and-drop для упражнений */
/* ============================================================ */