/* exercises/css/modal.css */
:root {
    /* Радиусы скругления */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Тени */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Базовые стили */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    line-height: 1.5;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-wrapper {
    background: var(--tg-theme-bg-color);
    border-radius: 0;
    padding: 20px;
    width: 100%;
    height: 100%;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* Заменяем overflow: hidden на overflow-y: auto */
}
.modal-content {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow-y: auto; /* Добавляем прокрутку для контента */
    max-height: calc(100vh - 150px); /* Устанавливаем максимальную высоту */
}
/* Заголовок модального окна */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
    flex-shrink: 0; /* Не сжимается */
}

/* Описание упражнения */
.exercise-description {
    background: var(--tg-theme-secondary-bg-color);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    line-height: 1.6;
    white-space: pre-line;
    max-height: 200px; /* Фиксированная высота описания */
    overflow-y: auto; /* Прокрутка только для описания */
    flex-grow: 1; /* Занимает доступное пространство */
}

/* Контент модального окна */
.modal-content {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Растягивается, но ограничено описанием */
}

/* Контролы упражнения */
.exercise-controls {
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Не сжимается */
}

/* Контроль повторений */
.reps-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    flex-shrink: 0; /* Не сжимается */
}

.reps-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Кнопки +/- */
.reps-button {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.reps-button:hover {
    opacity: 0.9;
}

.reps-button:active {
    transform: scale(0.95);
}

/* Поле ввода количества повторений */
#modalRepsCount {
    width: 60px;
    text-align: center;
    padding: 8px;
    border: 1px solid var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-sm);
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    font-size: 16px;
}

/* Награды */
.exercise-rewards {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 10px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-md);
    flex-shrink: 0; /* Не сжимается */
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: var(--tg-theme-text-color);
}

.reward-icon {
    font-size: 20px;
}
/* Прогресс упражнения */
.exercise-progress-container {
    margin-bottom: 15px;
    flex-shrink: 0; /* Не сжимается */
}

.progress-info {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
    margin-bottom: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #34C759; /* Зелёный цвет, как у кнопки "Начать выполнение" */
    width: 0%; /* Начальная ширина будет установлена через JS */
    transition: width 0.3s ease-in-out;
}

/* Адаптивность для прогресса */
@media (max-width: 480px) {
    .progress-info {
        font-size: 12px;
    }
    .progress-bar-container {
        height: 8px;
    }
}
/* Таймер */
.timer-container {
    text-align: center;
    margin: 20px 0;
    flex-shrink: 0; /* Не сжимается */
}

#timerDisplay {
    font-size: 2em;
    font-weight: bold;
    color: var(--text-primary);;
}

.timer-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
}

.timer-controls button {
    flex: 1;
    margin: 0 5px;
}

/* Футер модального окна */
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 0; /* Не сжимается */
    padding-top: 10px;
    border-top: 1px solid var(--tg-theme-secondary-bg-color);
}

/* Кнопки */
.primary-button,
.secondary-button {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-button {
    background: #34C759;
    color: white;
}

.secondary-button {
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
}

.primary-button:hover,
.secondary-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(0);
}

#modalCompleteButton {
    background: #007AFF;
}

/* Адаптивность */
@media (max-width: 980px) {
    body {
        padding: 12px;
    }

    .modal-wrapper {
        padding: 16px;
    }

    .modal-title {
        font-size: 20px;
    }

    .reps-control {
        flex-direction: column;
        align-items: flex-start;
    }

    .exercise-rewards {
        flex-direction: column;
        align-items: center;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 40px;
    }

    .primary-button,
    .secondary-button {
        padding: 12px 16px;
        font-size: 16px;
    }

    .exercise-description {
        max-height: 200px; /* Уменьшаем высоту описания на маленьких экранах */
    }
}
/* Добавляем стили для видео в exercises/css/modal.css */

/* Контейнер для видео */
.exercise-video-container {
    position: relative;
    border-radius: var(--radius-md);
    margin-bottom: 15px;
    overflow: hidden;
    background: var(--tg-theme-secondary-bg-color);
    display: none; /* Скрыто по умолчанию */
}

.exercise-video {
    width: 100%;
    position: absolute;
    top: 50%; /* Центрируем относительно вертикали */
    left: 0;
    transform: translateY(-50%); /* Сдвигаем вверх на половину высоты для идеального центрирования */
    display: block;
    object-fit: cover; /* Обеспечивает заполнение контейнера */
}

/* Кнопки переключения между видео и описанием */
.content-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.toggle-button {
    padding: 6px 12px;
    background: var(--tg-theme-secondary-bg-color);
    border: none;
    border-radius: var(--radius-sm);
    margin: 0 5px;
    font-size: 14px;
    color: var(--tg-theme-text-color);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.toggle-button.active {
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
}

.toggle-button:hover {
    opacity: 0.9;
}

.toggle-button:active {
    transform: scale(0.95);
}

.exercise-video-container {
    position: relative;
    width: 400px;
    height: 200px; 
	margin:0 auto;
	
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    overflow: hidden;
    background: var(--tg-theme-secondary-bg-color);
}
@media (max-width: 980px) {
    .modal-footer {
        position: sticky;
        bottom: 0;
        background: var(--tg-theme-bg-color);
        padding-top: 10px;
        z-index: 10;
    }
}
@media (max-width: 480px) {
	.exercise-video-container {
		width: 100%;
	}
}
/* Стили для модального окна с результатами */
.results-modal {
    max-width: 400px;
    margin: auto;
    border-radius: var(--radius-md);
}

.result-motivation {
    background: var(--tg-theme-secondary-bg-color);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 18px;
    text-align: center;
    color: var(--tg-theme-text-color);
}

.result-exercise-info {
    margin-bottom: 15px;
}

.result-exercise-name {
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: var(--tg-theme-hint-color);
}

.result-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.result-stat-item {
    display: flex;
    align-items: center;
    background: var(--tg-theme-secondary-bg-color);
    padding: 12px;
    border-radius: var(--radius-md);
}

.stat-icon {
    font-size: 24px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-info {
    flex-grow: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
}

.stat-value {
    font-size: 18px;
    font-weight: 500;
}

.result-progress-container {
    margin-bottom: 15px;
}

/* Стили для уведомления о повышении уровня */
.level-up-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    padding: 15px 20px;
    background: rgba(0, 123, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeInDown 0.3s ease-out;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.notification-icon {
    font-size: 28px;
    color: white;
}

.notification-text {
    color: white;
    font-weight: 500;
}

#levelUpValue {
    font-weight: 700;
    font-size: 18px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
    .results-modal {
        max-width: 100%;
        height: auto;
    }
    
    .result-motivation {
        font-size: 16px;
    }
    
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .stat-value {
        font-size: 16px;
    }
}
/* Стиль для блока мотивации, когда он используется для предупреждения */
.result-motivation.result-warning {
    background: #ffe6e6;
    color: #cc0000;
    border-left: 4px solid #ff0000;
}

@media (prefers-color-scheme: dark) {
    .result-motivation.result-warning {
        background: rgba(255, 0, 0, 0.15);
        color: #ff6666;
    }
}
/* Компактные стили для статистики результатов */
.result-stats-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.result-stats-row {
    display: flex;
    justify-content: space-between;
}

.result-stat-compact {
    display: flex;
    align-items: center;
    background: var(--tg-theme-secondary-bg-color);
    padding: 12px 15px;
    border-radius: var(--radius-md);
    width: 48%;
    gap: 8px;
}

.result-stat-compact .stat-icon {
    font-size: 20px;
}

.result-stat-compact .stat-value {
    font-size: 18px;
    font-weight: 600;
}

/* Адаптивность */
@media (max-width: 340px) {
    .result-stat-compact {
        padding: 10px;
    }
    
    .result-stat-compact .stat-icon {
        font-size: 18px;
    }
    
    .result-stat-compact .stat-value {
        font-size: 16px;
    }
}
/* Стили для контейнера видео разминки с тренером */
.exercise-video-container.trainer-warmup {
    height: 490px; /* Увеличенная высота для разминки с тренером */
}

@media (max-width: 480px) {
    .exercise-video-container.trainer-warmup {
        height: 360px; /* Немного уменьшаем на маленьких экранах, но всё равно больше стандартного */
    }
}
/* Добавьте в конец файла modal.css */
.video-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    z-index: 10;
    transition: opacity 0.3s;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin: 15px 0;
    font-size: 16px;
}

.loader-progress {
    width: 80%;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.loader-progress-bar {
    width: 0%;
    height: 100%;
    background-color: white;
    transition: width 0.3s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* Стили для отображения обратного отсчета */
.countdown-display {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}
/* Стили для отображения обратного отсчета */
@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.overlay-button.countdown-btn {
    animation: button-pulse 1.5s infinite;
}

@keyframes button-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
/* В файле modal.css добавьте следующие стили */
.startup-progress {
    animation: pulse-gold 1s infinite;
}

@keyframes pulse-gold {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
/* Новые стили для заголовка и уровня упражнения */
.title-container {
    display: flex;
    flex-direction: column;
    margin-right: 10px;
}

.exercise-level-subtitle {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    margin-top: -5px;
    margin-bottom: 5px;
}

/* Новые стили для переключателей и наград */
.content-toggle-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-shrink: 0;
    background-color: var(--tg-theme-secondary-bg-color);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
}

.content-toggle {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0;
}

.compact-rewards {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--tg-theme-text-color);
}

.reward-icon-small {
    font-size: 13px;
    margin: 0 2px 0 6px;
}

.reward-text-small {
    font-size: 13px;
    font-weight: 500;
}

/* Корректировка стилей существующих кнопок */
.toggle-button {
    margin: 0 3px;
    padding: 4px 10px;
    font-size: 13px;
}
/* Добавьте этот код в конец файла modal.css */

/* Стили для плавающего таймера */
.timer-container {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    z-index: 20;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

#timerDisplay {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    margin: 0;
}

/* Стили для плавающих кнопок управления */
.timer-controls {
    position: fixed;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 10px;
    margin: 0 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.timer-controls button {
    flex: 1;
    max-width: 180px;
    font-weight: bold;
    padding: 12px 10px;
}

/* Обеспечиваем хорошую видимость кнопок на любом фоне */
.timer-controls .primary-button {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.timer-controls .secondary-button {
    background-color: rgba(150, 150, 150, 0.8);
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Адаптивность для маленьких экранов */
@media (max-width: 480px) {
    .timer-container {
        font-size: 16px;
        padding: 8px 12px;
    }
    
    #timerDisplay {
        font-size: 20px;
    }
    
    .timer-controls {
        flex-direction: column;
    }
    
    .timer-controls button {
        max-width: none;
    }
}
/* Стили для упражнения "Ежедневные шаги" */
.steps-interface {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin: 15px 0;
}

.steps-input-group {
    margin-bottom: 20px;
}

.steps-input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #fff;
}

.steps-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.steps-select:focus {
    outline: none;
    border-color: #4CAF50;
}

.screenshot-upload-group {
    margin-bottom: 20px;
}

.screenshot-upload-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #fff;
}

.screenshot-input {
    width: 100%;
    padding: 10px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.screenshot-input:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.3);
}

.screenshot-preview {
    margin-top: 15px;
    text-align: center;
}

.preview-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.screenshot-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.remove-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.remove-preview:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.1);
}

.steps-rewards-info {
    background: rgba(255, 215, 0, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.steps-rewards-info h4 {
    margin: 0 0 12px 0;
    color: #FFD700;
    font-size: 18px;
}

.steps-rewards-info ul {
    margin: 0;
    padding-left: 25px;
    list-style-type: none;
}

.steps-rewards-info li {
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.steps-rewards-info li:before {
    content: "👟";
    position: absolute;
    left: 0;
}

.steps-rewards-info strong {
    color: #FFD700;
}

.steps-note {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 165, 0, 0.1);
    border-radius: 6px;
    font-size: 14px;
    color: #FFA500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

/* Стили для модального окна подтверждения отмены упражнения */
.cancel-confirmation-modal {
    max-width: 400px;
    margin: auto;
    background: var(--tg-theme-bg-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    height: auto;
    max-height: 70vh;
    overflow: visible;
}

.cancel-warning-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px 0;
}

.warning-icon {
    font-size: 32px;
    flex-shrink: 0;
    margin-top: 5px;
}

.warning-text {
    flex: 1;
}

.warning-text p {
    margin: 0 0 10px 0;
    color: var(--tg-theme-text-color);
    line-height: 1.4;
}

.warning-text .warning-details {
    font-size: 14px;
    color: var(--tg-theme-hint-color);
    margin: 10px 0 0 0;
}

/* Кнопка danger (для отмены) */
.danger-button {
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #ff3b30;
    color: white;
}

.danger-button:hover {
    background: #e8352c;
    transform: translateY(-1px);
}

.danger-button:active {
    transform: translateY(0);
    background: #d1312a;
}

/* Адаптивность для модального окна подтверждения */
@media (max-width: 480px) {
    .cancel-confirmation-modal {
        max-width: 90%;
        margin: 20px auto;
    }

    .cancel-warning-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
        padding: 15px 0;
    }

    .warning-icon {
        font-size: 28px;
        margin-top: 0;
    }
}