/**
 * Мобильный модуль V2 — каталог и страница кружка.
 * Подключается дополнительно к catalog-v2.css / course-v2.css.
 */

@media (max-width: 768px) {
    /* Плавность прокрутки: blur отключён, непрозрачные фоны */
    .v2-glass,
    .v2-glass-panel,
    .v2-glass-badge,
    .v2-glass-frost,
    .v2-card__direction,
    .v2-card__direction-mark,
    .v2-scroll-top,
    .v2-filters.v2-glass,
    .v2-mobile-toolbar,
    .v2-topbar,
    .v2-course-bar,
    .v2-btn-glass,
    .v2-course-bar__btn--outline,
    .course-modal,
    .course-modal-content,
    .v2-filters-backdrop,
    .v2-filters-sheet-header,
    .v2-filters-sticky .v2-filters {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .v2-glass,
    .v2-filters.v2-glass {
        background: #fff;
        box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
    }

    .v2-glass-badge,
    .v2-card__direction,
    .v2-card__direction-mark {
        background: rgba(255, 255, 255, 0.96);
    }

    .v2-topbar {
        background: #fafbfc;
        border-bottom: 1px solid var(--v2-border);
        box-shadow: none;
    }

    .v2-scroll-top {
        background: #fff;
    }

    .v2-course-bar {
        background: #fff;
    }

    .v2-btn-glass {
        background: linear-gradient(135deg, var(--v2-accent-from), var(--v2-accent-to));
    }

    .v2-course-bar__btn--outline {
        background: #fff;
    }

    .v2-course-bar__btn--outline:hover {
        background: var(--v2-purple-light);
    }

    .course-modal-content {
        background: #fff;
    }

    .v2-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 420px;
    }

    .v2-card__image {
        object-fit: cover;
    }

    /* ===== Общее ===== */
    .v2-body {
        -webkit-tap-highlight-color: transparent;
    }

    .v2-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 10px 14px;
    }

    .v2-topbar__info {
        flex-wrap: wrap;
        gap: 8px 12px;
        font-size: 12px;
    }

    .v2-topbar__actions {
        justify-content: flex-end;
    }

    .v2-page {
        padding: 12px 14px calc(24px + env(safe-area-inset-bottom));
    }

    .v2-hero {
        flex-direction: column;
        gap: 14px;
        margin-bottom: 12px;
    }

    .v2-hero__intro {
        flex: none;
    }

    .v2-hero__title {
        font-size: 22px;
        margin-bottom: 2px;
    }

    .v2-hero__subtitle {
        font-size: 13px;
        line-height: 1.45;
        max-width: none;
        margin-bottom: 0;
    }

    .v2-hero__stat {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .v2-category-chips {
        margin-bottom: 12px;
        gap: 0;
    }

    .v2-category-chips__nav {
        display: none;
    }

    .v2-category-chips__viewport::after {
        opacity: 1;
    }

    .v2-category-chips.is-at-end .v2-category-chips__viewport::after {
        opacity: 0;
    }

    .v2-category-chips__track {
        margin: 0 -2px;
        padding-bottom: 4px;
    }

    .v2-category-chip {
        padding: 9px 14px;
        font-size: 12px;
    }

    .v2-catalog-toolbar {
        margin-bottom: 12px;
    }

    .v2-catalog-toolbar__main {
        flex-direction: row;
        align-items: center;
    }

    .v2-catalog-toolbar--filtered .v2-catalog-toolbar__main {
        flex-direction: column;
        align-items: stretch;
    }

    .v2-catalog-toolbar__sort {
        min-width: 0;
        width: 100%;
    }

    .v2-active-filters {
        margin-top: 10px;
    }

    .v2-summer-banner {
        flex: none;
        max-width: none;
        width: 100%;
        padding: 16px;
        border-radius: 18px;
    }

    .v2-summer-banner__body {
        flex-direction: column;
        min-height: unset;
        gap: 12px;
    }

    .v2-summer-banner__main {
        padding-right: 24px;
    }

    .v2-summer-banner__photo {
        flex: none;
        width: 100%;
        height: 160px;
    }

    .v2-summer-banner__title {
        font-size: 18px;
    }

    .v2-summer-banner__desc {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .v2-summer-banner__btn {
        width: 100%;
    }

    /* ===== Мобильная панель поиска ===== */
    .v2-mobile-toolbar {
        display: flex;
        align-items: stretch;
        gap: 8px;
        position: sticky;
        top: 0;
        z-index: 90;
        margin: 0 -14px 12px;
        padding: 8px 14px;
        background: #f7f9fc;
        border-bottom: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: none;
    }

    .v2-mobile-toolbar__search {
        flex: 1;
        min-width: 0;
        display: flex;
        align-items: stretch;
    }

    .v2-mobile-toolbar__search .v2-field {
        width: 100%;
        margin: 0;
    }

    .v2-mobile-toolbar__search .v2-input {
        min-height: 44px;
        height: 44px;
        font-size: 16px;
    }

    .v2-mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 44px;
        height: 44px;
        padding: 0 14px;
        border-radius: 12px;
        border: 1px solid rgba(91, 91, 247, 0.35);
        background: var(--v2-purple-light);
        color: var(--v2-purple-dark);
        font-family: inherit;
        font-size: 14px;
        font-weight: 700;
        white-space: nowrap;
        cursor: pointer;
        flex-shrink: 0;
        touch-action: manipulation;
    }

    .v2-mobile-filter-btn svg {
        flex-shrink: 0;
    }

    .v2-mobile-filter-hint {
        display: block;
        margin: -6px 0 12px;
        font-size: 12px;
        color: var(--v2-text-muted);
        line-height: 1.35;
    }

    .v2-mobile-filter-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 999px;
        background: var(--v2-purple);
        color: #fff;
        font-size: 11px;
        font-weight: 800;
        line-height: 1;
    }

    .v2-mobile-filter-count[hidden] {
        display: none;
    }

    /* ===== Фильтры-шторка ===== */
    .v2-filters-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 180;
        background: rgba(15, 23, 42, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--v2-dur) var(--v2-ease);
    }

    .v2-filters-backdrop.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .v2-filters-sticky {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        z-index: 190;
        transform: translateY(105%);
        transition: transform var(--v2-dur) var(--v2-ease);
        max-height: min(88vh, 720px);
        overflow: hidden;
        pointer-events: none;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .v2-filters-sticky.is-open {
        transform: translateY(0);
        pointer-events: auto;
    }

    .v2-filters-sticky.is-stuck {
        box-shadow: none;
    }

    .v2-filters-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px 10px;
        background: #fff;
        border-bottom: 1px solid var(--v2-border);
        border-radius: 18px 18px 0 0;
        box-shadow: none;
        position: relative;
    }

    .v2-filters-sheet-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 999px;
        background: #cbd5e1;
    }

    .v2-filters-sheet-header h2 {
        margin: 0;
        font-size: 18px;
        font-weight: 800;
    }

    .v2-filters-sheet-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 12px;
        background: #f1f5f9;
        color: var(--v2-text);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        font-family: inherit;
    }

    .v2-filters-sticky .v2-filters {
        border-radius: 0;
        max-height: calc(min(88vh, 720px) - 58px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        background: #fff;
        border-top: none;
        box-shadow: none;
    }

    .v2-filters__row--top .v2-field:first-child {
        display: none;
    }

    .v2-filters-sticky .v2-days-panel {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        box-shadow: none;
        border: none;
        padding: 4px 0 0;
        margin-top: 4px;
    }

    .v2-filters-sticky .v2-days-dropdown.is-open .v2-days-panel {
        display: block;
    }

    body.v2-filters-open {
        overflow: hidden;
    }

    .v2-filter-actions {
        position: sticky;
        bottom: 0;
        background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 24%);
        padding-top: 12px;
        margin-top: 8px;
    }

    .v2-btn-apply,
    .v2-btn-reset {
        min-height: 44px;
    }

    /* ===== Карточки — вертикальный формат ===== */
    .v2-cards-grid {
        gap: 16px;
    }

    .v2-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: unset;
        border-radius: 16px;
    }

    .v2-card__media {
        aspect-ratio: 16 / 10;
        min-height: unset;
        width: 100%;
    }

    .v2-card__image,
    .v2-card__placeholder {
        min-height: unset;
        height: 100%;
        aspect-ratio: 16 / 10;
    }

    .v2-card__badge-new {
        top: 12px;
        left: 12px;
    }

    .v2-card__waitlist-btn {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .v2-card__waitlist-btn .v2-lucide--waitlist {
        width: 19px;
        height: 19px;
    }

    .v2-card__direction-mark {
        right: 12px;
        bottom: 12px;
    }

    .v2-card__body {
        padding: 14px;
    }

    .v2-card__title {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 6px;
    }

    .v2-card__status {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .v2-card__tags {
        margin-bottom: 6px;
    }

    .v2-card__footer {
        gap: 10px;
        padding-top: 12px;
    }

    .v2-card__price-value {
        font-size: 20px;
    }

    .v2-card__actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .v2-card__btn {
        min-height: 44px;
        padding: 12px 14px;
        font-size: 14px;
        flex: 1 1 calc(50% - 4px);
    }

    .v2-card__btn--trial {
        flex: 1 1 100%;
    }

    .v2-shortcuts {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0 0 14px;
        padding: 0;
    }

    .v2-shortcut {
        width: 100%;
        padding: 14px 16px;
    }

    .v2-shortcut__icon {
        width: 42px;
        height: 42px;
    }

    .v2-shortcut__text span {
        display: block;
        font-size: 12px;
    }

    .v2-shortcut__text strong {
        font-size: 14px;
    }

    .v2-course-list {
        margin-bottom: 16px;
    }

    .v2-newsletter {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px;
        margin-bottom: 0;
    }

    .v2-newsletter__label {
        white-space: normal;
        font-size: 13px;
        line-height: 1.35;
    }

    .v2-newsletter__form {
        flex-direction: column;
        align-items: stretch;
        min-width: 0;
        width: 100%;
        gap: 8px;
    }

    .v2-newsletter__input,
    .v2-newsletter__submit {
        width: 100%;
        min-height: 44px;
        height: 44px;
    }

    .v2-newsletter__hint {
        justify-content: flex-start;
        font-size: 12px;
    }

    .v2-scroll-top {
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom));
        width: 44px;
        height: 44px;
    }

    /* ===== Страница кружка ===== */
    .v2-body--course .v2-topbar {
        margin-bottom: 0;
    }

    .v2-course-page {
        padding: 14px 14px 24px;
    }

    .v2-course-back {
        margin-bottom: 10px;
        min-height: 44px;
        align-items: center;
    }

    .v2-course-hero {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 16px;
        border-radius: 18px;
    }

    .v2-course-hero__media {
        order: -1;
        width: 100%;
    }

    .v2-course-title {
        font-size: 22px;
    }

    .v2-course-hero__price strong {
        font-size: 24px;
    }

    .v2-course-hero__btn,
    .v2-course-section,
    .v2-course-bar__btn {
        min-height: 44px;
    }

    .v2-course-bar {
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    }

    .v2-course-bar__inner {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .v2-course-bar__price {
        flex: 1;
        min-width: 0;
    }

    .v2-course-bar__price strong {
        font-size: 18px;
    }

    .v2-course-bar__hint {
        width: auto;
        font-size: 11px;
    }

    .v2-course-bar__actions {
        flex-direction: row;
        width: auto;
        flex-shrink: 0;
        gap: 8px;
    }

    .v2-course-bar__btn {
        padding: 12px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    .v2-course-bar__btn--outline {
        display: none;
    }

    .v2-body--course {
        padding-bottom: calc(88px + env(safe-area-inset-bottom));
    }

    .v2-course-grid {
        gap: 14px;
    }

    .v2-course-section {
        padding: 16px;
        border-radius: 16px;
    }

    .v2-course-spec__row,
    .v2-course-schedule-list__item {
        padding: 10px 0;
    }
}

@media (min-width: 769px) {
    .v2-mobile-toolbar,
    .v2-filters-backdrop,
    .v2-filters-sheet-header,
    .v2-mobile-filter-hint {
        display: none;
    }
}

@media (max-width: 768px) {
    .v2-filters-sticky:not(.is-open) {
        visibility: hidden;
    }

    .v2-filters-sticky.is-open {
        visibility: visible;
    }

    .v2-waitlist-modal .registration-header {
        padding: 16px 20px;
    }

    .v2-waitlist-modal .registration-scrollable {
        padding: 0 20px 20px;
    }

    .v2-waitlist-modal .registration-footer .btn-fixed {
        background: var(--v2-purple);
        box-shadow: 0 4px 12px rgba(91, 91, 247, 0.28);
    }

    .v2-waitlist-modal .registration-footer .btn-fixed:active {
        box-shadow: 0 2px 8px rgba(91, 91, 247, 0.28);
    }
}
