/* Стили для установленного приложения */

.installed-app {
    background: #fafafa;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    color: #333 !important; /* Переопределяем белый цвет из body */
}

/* Заголовок */
.installed-header {
    background: #fafafa;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.installed-header h1 {
    font-family: 'Furore', sans-serif;
    font-size: clamp(1.5rem, 6vw, 2rem);
    margin: 0;
    padding: 0 1rem;
    color: #000;
    font-weight: normal;
    line-height: 1.2;
    text-align: center;
    text-shadow: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Основной контент */
.installed-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    /* Предотвращение pull-to-refresh на Android */
    overscroll-behavior-y: contain;
    overscroll-behavior: contain;
}

/* Контент вкладок */
.tab-content {
    padding: 0;
    margin: 0;
    width: 100%;
    background: #fafafa;
    color: #333 !important;
}

.tab-content * {
    color: inherit;
}

.tab-content p {
    color: #666 !important;
}

.tab-content.hidden {
    display: none;
}

/* Вкладки навигации */
.installed-tabs {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    /* Убираем gap между кнопками */
    gap: 0;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    min-height: 60px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    background: transparent;
    color: #999;
    /* Увеличиваем область нажатия */
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    /* Убираем стандартные стили кнопки */
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
}

.tab-item.active {
    color: #bd8d45;
}

.tab-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 0.25rem;
    fill: currentColor;
}

.tab-item span {
    font-family: 'Fontimer', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
}

/* SVG иконки */
.tab-icon {
    width: 24px;
    height: 24px;
}

/* Заглушки для других вкладок */
.tab-content-placeholder {
    text-align: center;
    padding: 2rem 1rem;
    color: #333 !important;
    font-family: 'Fontimer', sans-serif;
    margin: 0;
    background: #fafafa;
}

.tab-content-placeholder h2 {
    font-family: 'Furore', sans-serif;
    color: #bd8d45 !important;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.tab-content-placeholder p {
    color: #666 !important;
    margin: 0;
}

/* Карусель фотографий */
.photo-carousel {
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #fafafa;
}

.carousel-wrapper {
    width: 100%;
    position: relative;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    width: 100%;
    will-change: transform;
    touch-action: pan-y pinch-zoom;
    transition: transform 0.3s ease-out;
}

.carousel-slide {
    flex: 0 0 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
    /* Пропорции 16:9 - высота рассчитывается от ширины */
    aspect-ratio: 16 / 9;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Fallback для браузеров без поддержки aspect-ratio */
@supports not (aspect-ratio: 16 / 9) {
    .carousel-slide {
        padding-bottom: 56.25%; /* 16:9 = 56.25% */
        height: 0;
    }
    
    .carousel-slide img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}

/* Состояния загрузки и ошибки */
.carousel-loading,
.carousel-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 300px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
}

/* CSS Прелоадер */
.css-loader {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #bd8d45;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.carousel-error {
    color: #d32f2f;
    font-family: 'Fontimer', sans-serif;
}

.carousel-error p {
    margin: 0;
    font-size: 1rem;
    color: #d32f2f;
}

/* Карусель тренеров */
.trainers-container {
    width: 100%;
    margin-top: 2rem;
    padding: 0 1rem;
    box-sizing: border-box;
}

.trainers-section {
    width: 100%;
}

.trainers-title {
    font-family: 'Furore', sans-serif;
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    color: #333;
    margin: 0 0 1rem 0;
    padding: 0;
}

.trainers-carousel-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    /* Разрешаем горизонтальную прокрутку на iOS */
    -webkit-overflow-scrolling: touch;
}

.trainers-track {
    display: flex;
    gap: 0.75rem;
    will-change: transform;
    /* Разрешаем только горизонтальную прокрутку */
    touch-action: pan-x;
    -webkit-touch-callout: none;
    transition: transform 0.3s ease-out;
}

.trainer-item {
    /* 3 полных карточки + краешек 4-й: 
       3.3 карточки + 2 gap между ними (между 1-2 и 2-3) + часть gap и части 4-й карточки
       Формула: (100% - (2 * gap)) / 3.3 */
    flex: 0 0 calc((100% - 1.5rem) / 3.3);
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    cursor: pointer;
    background: #e0e0e0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-width: 0; /* Позволяет flex-элементам сжиматься */
    /* Включаем hardware acceleration для лучшей производительности */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    /* Убираем артефакты на Android */
    isolation: isolate;
}

.trainer-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    /* Убираем border-radius с изображения, скругление применяется контейнером */
    border-radius: 0;
    transition: transform 0.2s ease;
    /* Исправляем артефакты скругления на Android */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.trainer-item:active img {
    transform: scale(0.95);
}

/* Состояния загрузки и ошибки для тренеров */
.trainers-loading,
.trainers-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
}

.trainers-error {
    color: #d32f2f;
    font-family: 'Fontimer', sans-serif;
}

.trainers-error p {
    margin: 0;
    font-size: 1rem;
    color: #d32f2f;
}

/* Модальное окно тренера */
.trainer-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    /* Предотвращаем pull-to-refresh на Android когда открыто модальное окно */
    overscroll-behavior: none;
    touch-action: none;
    -webkit-overflow-scrolling: auto;
}

.trainer-modal.hidden {
    display: none;
}

.trainer-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.trainer-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.trainer-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.trainer-modal-close:active {
    background: rgba(255, 255, 255, 1);
}

.trainer-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.trainer-modal-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.trainer-modal-name {
    font-family: 'Furore', sans-serif;
    font-size: clamp(1.5rem, 6vw, 2rem);
    color: #333;
    margin: 0 0 1rem 0;
    padding: 0;
}

.trainer-modal-description {
    font-family: 'Fontimer', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
}

.trainer-modal-description p {
    margin: 0 0 1rem 0;
    color: #666;
}

.trainer-modal-description p:last-child {
    margin-bottom: 0;
}

/* Список новостей */
.news-container {
    width: 100%;
    margin-top: 2rem;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

.news-section {
    width: 100%;
}

.news-title {
    font-family: 'Furore', sans-serif;
    font-size: clamp(1.1rem, 4.5vw, 1.5rem);
    color: #333;
    margin: 0 0 1rem 0;
    padding: 0;
}

.news-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.news-item {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.news-item-image {
    width: calc(100% - 20px);
    margin: 0 10px;
    border-radius: 10px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    object-position: center;
    display: block;
}

.news-item-content {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.news-item-title {
    font-family: 'Furore', sans-serif;
    font-size: clamp(1.1rem, 4.5vw, 1.4rem);
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.3;
    text-align: left;
}

.news-item-text {
    font-family: 'Fontimer', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #666;
    margin: 0;
    padding: 0;
    text-align: left;
}

.news-item-text p {
    margin: 0 0 0.75rem 0;
    color: #666;
}

.news-item-text p:last-child {
    margin-bottom: 0;
}

/* Состояния загрузки и ошибки для новостей */
.news-loading,
.news-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
}

.news-error {
    color: #d32f2f;
    font-family: 'Fontimer', sans-serif;
}

.news-error p {
    margin: 0;
    font-size: 1rem;
    color: #d32f2f;
}

/* Расписание */
.schedule-container {
    width: 100%;
    padding: 1rem;
    box-sizing: border-box;
    background: #fafafa;
    min-height: 100%;
}

.schedule-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.schedule-day {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.schedule-day-header {
    width: 100%;
    padding: 1rem 1.25rem;
    background: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-family: 'Furore', sans-serif;
    font-size: 1.1rem;
    color: #333;
    text-align: left;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.schedule-day-header:active {
    background-color: #f5f5f5;
}

.schedule-day-header.expanded {
    background-color: #fafafa;
    border-bottom: 1px solid #e0e0e0;
}

.schedule-day-name {
    flex: 1;
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-day-today-badge {
    font-size: 0.75rem;
    color: #bd8d45;
    background: rgba(189, 141, 69, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: normal;
    font-family: 'Fontimer', sans-serif;
}

.schedule-day-today .schedule-day-header {
    border-left: 3px solid #bd8d45;
}

.schedule-day-arrow {
    width: 20px;
    height: 20px;
    color: #bd8d45;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.schedule-day-header.expanded .schedule-day-arrow {
    transform: rotate(180deg);
}

.schedule-day-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.schedule-day-content:not(.hidden) {
    max-height: 5000px;
    padding: 1rem 1.25rem;
}

.schedule-floor {
    margin-bottom: 1.5rem;
}

.schedule-floor:last-child {
    margin-bottom: 0;
}

.schedule-floor-header {
    margin-bottom: 0.75rem;
}

.schedule-floor-name {
    font-family: 'Furore', sans-serif;
    font-size: 1rem;
    color: #bd8d45;
    margin: 0;
    padding: 0;
    font-weight: normal;
}

.schedule-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.schedule-item {
    display: flex;
    gap: 1rem;
    padding: 0.875rem;
    background: #fafafa;
    border-radius: 6px;
    border-left: 3px solid #bd8d45;
}

.schedule-item-time {
    flex-shrink: 0;
    min-width: 90px;
}

.schedule-time {
    font-family: 'Fontimer', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.schedule-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.schedule-activity-name {
    font-family: 'Fontimer', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.schedule-age-group {
    font-family: 'Fontimer', sans-serif;
    font-size: 0.85rem;
    color: #666;
}

.schedule-description {
    font-family: 'Fontimer', sans-serif;
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-top: 0.25rem;
}

/* Состояния загрузки и ошибки для расписания */
.schedule-loading,
.schedule-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
}

.schedule-error {
    color: #d32f2f;
    font-family: 'Fontimer', sans-serif;
}

.schedule-error p {
    margin: 0;
    font-size: 1rem;
    color: #d32f2f;
}

/* Адаптивность */
@media (max-width: 480px) {
    .installed-header {
        padding: 0.875rem 1rem;
    }
    
    .tab-item {
        min-height: 56px;
        padding: 0.625rem 0.25rem;
    }
    
    .tab-item svg {
        width: 22px;
        height: 22px;
    }
    
    .tab-item span {
        font-size: 0.7rem;
    }

    .trainers-container {
        padding: 0 0.75rem;
        margin-top: 1.5rem;
    }

    .trainer-item {
        flex: 0 0 calc((100% - 1rem) / 3.3);
        border-radius: 6px;
    }

    .trainer-modal-content {
        border-radius: 0;
    }

    .trainer-modal-close {
        top: 0.75rem;
        right: 0.75rem;
        width: 36px;
        height: 36px;
        font-size: 20px;
    }

    .trainer-modal-info {
        padding: 1.25rem;
    }

    .news-container {
        padding: 0 0.25rem;
        margin-top: 1.5rem;
    }

    .news-item-image {
        width: calc(100% - 20px);
        border-radius: 6px;
    }

    .news-item-content {
        padding: 0.875rem 1rem 1rem;
        gap: 0.625rem;
    }

    .schedule-container {
        padding: 0.75rem;
    }

    .schedule-day-header {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .schedule-day-content:not(.hidden) {
        padding: 0.875rem 1rem;
    }

    .schedule-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .schedule-item-time {
        min-width: 75px;
    }

    .schedule-time {
        font-size: 0.85rem;
    }

    .schedule-activity-name {
        font-size: 0.95rem;
    }

    .schedule-age-group,
    .schedule-description {
        font-size: 0.8rem;
    }
}

