/* ============================================================
   HOSPITAL CHEAT - Мобильные стили
   Оптимизация для телефонов и планшетов
   ============================================================ */

/* =====================
   SAFE AREA (iPhone X и новее)
   ===================== */
@supports (padding-top: env(safe-area-inset-top)) {
    .site-nav {
        padding-top: calc(6px + env(safe-area-inset-top));
        padding-left: calc(10px + env(safe-area-inset-left));
        padding-right: calc(10px + env(safe-area-inset-right));
    }
    footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    main {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* =====================
   ТАЧ-ОПТИМИЗАЦИЯ
   ===================== */

/* Увеличенная область касания для интерактивных элементов */
@media (max-width: 768px) {
    /* Минимальный размер 44x44px для тач-элементов (рекомендация Apple) */
    .btn, button, input[type="submit"], input[type="button"],
    .nav-link, .dropdown-item, .pricing-hero-btn,
    .auth-btn, .auth-oauth-btn, .auth-toggle-pass,
    .h-btn, .h-btn-primary, .h-btn-ghost,
    .product-btn, .pay-btn, .sub-btn, .site-nav-toggle,
    .mobile-menu-panel a, .mobile-menu-panel .close-menu {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Интервалы между кнопками в мобильном меню */
    .mobile-menu-panel a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    /* Убираем ховер-эффекты (они мешают на тач-экранах) */
    .btn-primary:hover {
        transform: none;
    }
    .card:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* Активные состояния для тач-экранов */
    a:active, button:active {
        opacity: 0.7;
    }
    
    /* Scroll-behavior для touch-скролла */
    .table-responsive, .overflow-auto {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Убираем выделение текста на мобильных */
    .site-nav, .mobile-menu-panel, footer {
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Разрешаем выделение в инпутах */
    input, textarea {
        -webkit-user-select: text !important;
        user-select: text !important;
    }
}

/* =====================
   АДАПТИВНАЯ ТИПОГРАФИКА
   ===================== */
@media (max-width: 576px) {
    body {
        font-size: 15px;
    }
    
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1.05rem; }
    
    .display-4 { font-size: 2rem; }
    .display-5 { font-size: 1.5rem; }
    
    .lead { font-size: 1rem; }
    small { font-size: 0.8rem; }
}

/* =====================
   МОБИЛЬНАЯ НАВИГАЦИЯ
   ===================== */
@media (max-width: 768px) {
    .site-nav-bar {
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* =====================
   КАРТОЧКИ ПОДПИСОК (МОБИЛЬНЫЕ)
   ===================== */
@media (max-width: 768px) {
    .subscription-card {
        margin-bottom: 16px;
    }
    .subscription-card.featured {
        border-width: 1.5px;
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
    }
    .subscription-card .card-header {
        padding: 1rem;
    }
    .subscription-card .card-body {
        padding: 1rem;
    }
    .subscription-price {
        font-size: 1.6rem;
    }
    .subscription-features li {
        padding: 8px 0;
        font-size: 0.85rem;
    }
}

/* =====================
   ФОРМЫ (МОБИЛЬНЫЕ)
   ===================== */
@media (max-width: 768px) {
    .form-control {
        padding: 10px 14px;
        font-size: 16px !important; /* Запрет зума на iOS */
    }
    .form-label {
        font-size: 0.75rem;
    }
    textarea.form-control {
        font-size: 16px !important;
    }
    
    /* Кнопки форм на всю ширину */
    form .btn {
        width: 100%;
    }
}

/* =====================
   АДМИН-ПАНЕЛЬ (МОБИЛЬНАЯ)
   ===================== */
@media (max-width: 768px) {
    .admin-sidebar {
        position: sticky;
        top: 60px;
        z-index: 50;
        border-radius: 0;
        margin: -12px -12px 12px -12px;
        padding: 8px;
        min-height: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .admin-sidebar .nav-link {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 0.75rem;
        flex-shrink: 0;
        min-height: 38px;
    }
    .admin-sidebar .nav-link i {
        margin-right: 6px;
    }
    
    /* Таблицы адаптивные */
    .table-responsive {
        margin: 0 -12px;
        width: calc(100% + 24px);
    }
    .table {
        font-size: 0.75rem;
    }
    .table th, .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
}

/* =====================
   ПРОФИЛЬ (МОБИЛЬНЫЙ)
   ===================== */
@media (max-width: 576px) {
    .avatar-lg {
        width: 80px;
        height: 80px;
    }
    .avatar-md {
        width: 60px;
        height: 60px;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* =====================
   ТАБЛИЦЫ (МОБИЛЬНЫЕ)
   ===================== */
@media (max-width: 576px) {
    /* Карточный вид таблицы на маленьких экранах */
    .table-card-view tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 8px;
        padding: 8px;
        background: var(--card-bg);
    }
    .table-card-view td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 4px 0;
    }
    .table-card-view td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--muted-color);
        margin-right: 8px;
        font-size: 0.7rem;
        text-transform: uppercase;
    }
}

/* =====================
   МОДАЛЬНЫЕ ОКНА (МОБИЛЬНЫЕ)
   ===================== */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px;
    }
    .modal-content {
        border-radius: 12px;
    }
    .modal-header {
        padding: 12px 16px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
    }
    .modal-footer .btn {
        width: 100%;
        margin: 4px 0;
    }
}

/* =====================
   УВЕДОМЛЕНИЯ (МОБИЛЬНЫЕ)
   ===================== */
@media (max-width: 576px) {
    .notification-item {
        padding: 12px;
    }
    .notification-item .notification-icon {
        font-size: 1.2rem;
    }
    .notification-item .notification-title {
        font-size: 0.85rem;
    }
}

/* =====================
   ФУТЕР (МОБИЛЬНЫЙ)
   ===================== */
@media (max-width: 576px) {
    footer {
        font-size: 0.75rem;
        padding: 1rem 0;
    }
}

/* =====================
   УТИЛИТЫ ДЛЯ МОБИЛЬНЫХ
   ===================== */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    .show-mobile {
        display: block !important;
    }
    .text-center-mobile {
        text-align: center !important;
    }
    .w-100-mobile {
        width: 100% !important;
    }
    .gap-2-mobile {
        gap: 8px !important;
    }
    .mb-3-mobile {
        margin-bottom: 1rem !important;
    }
}

/* Планшеты */
@media (min-width: 577px) and (max-width: 992px) {
    .hide-tablet {
        display: none !important;
    }
}

/* =====================
   ОТКЛЮЧЕНИЕ HOVER НА ТАЧАХ
   ===================== */
@media (hover: none) and (pointer: coarse) {
    a:hover, button:hover, .btn:hover, .card:hover {
        transform: none !important;
    }
    .subscription-card:hover {
        transform: none !important;
    }
}

/* =====================
   LANDSCAPE-ОРИЕНТАЦИЯ
   ===================== */
@media (max-width: 992px) and (orientation: landscape) {
    .site-nav {
        padding: 4px 10px;
    }
    main {
        padding-top: 50px !important;
    }
    .mobile-menu-panel {
        width: 320px;
    }
}

/* =====================
   ТЕМНАЯ ТЕМА (уже темная, но для совместимости)
   ===================== */
@media (prefers-color-scheme: dark) {
    /* Сайт уже темный, но на всякий случай */
    body {
        background: #0a0a0f;
    }
}

/* =====================
   УМЕНЬШЕННАЯ АНИМАЦИЯ (доступность)
   ===================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =====================
   ДОПОЛНИТЕЛЬНЫЕ ФИКСЫ ДЛЯ ТЕЛЕФОНОВ
   ===================== */

/* Исправление для featured карточек на главной (убираем scale на мобильных) */
@media (max-width: 768px) {
    .pricing-hero-card.featured {
        transform: none !important;
    }
    .pricing-hero-card.featured:hover {
        transform: translateY(-4px) !important;
    }
    
    /* Кнопки на всю ширину на телефонах */
    .pricing-hero-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =====================
   ФИКС: Слишком широкие инпуты
   ===================== */
@media (max-width: 576px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        max-width: 100%;
    }
}

/* =====================
   HOSPITAL THEME — mobile touch
   ===================== */
@media (max-width: 768px) {
    .h-btn, .h-btn-primary, .h-btn-ghost,
    .product-btn, .pay-btn, .sub-btn,
    .quick-amount, .pbtn, .btn-topup, .btn-red, .btn-ghost {
        min-height: 48px;
        padding: 14px 20px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        position: relative;
        z-index: 2;
    }

    .h-hero { padding: 40px 18px 32px; margin-top: 4px; }
    .h-hero-logo { width: 56px; height: 56px; margin-bottom: 16px; }
    .h-hero-title { font-size: 1.85rem; }
    .h-hero-actions { flex-direction: column; width: 100%; }
    .h-hero-actions .h-btn { width: 100%; }

    .h-stats { flex-direction: column; gap: 10px; }
    .h-bento { gap: 10px; }

    .products-grid { gap: 12px; }
    .product-card { padding: 20px 16px; }

    .about-actions { flex-direction: column; }
    .about-actions .h-btn { width: 100%; min-width: 0; }

    .cabinet-page,
    .cabinet-topup-page { padding: 12px 10px 48px; }

    .quick-amounts {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .quick-amount {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    main.container,
    main.site-main.container {
        padding-left: 12px !important;
        padding-right: 12px !important;
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Lock page scroll only — never touch-action:none on body (kills iOS scroll if class sticks) */
    body.menu-open {
        overflow: hidden;
        overscroll-behavior: none;
    }
    body.menu-open .mobile-menu-panel.active {
        touch-action: pan-y;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

body:not(.menu-open) #mobileMenuOverlay,
body:not(.menu-open) #mobileMenuPanel {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transform: translateX(100%) !important;
}

/* Overlay и панель — полностью выключены когда закрыты */
.mobile-menu-overlay:not(.active) {
    display: none !important;
    pointer-events: none !important;
}
.mobile-menu-overlay.active {
    display: block !important;
    pointer-events: auto !important;
}
.mobile-menu-panel:not(.active) {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transform: translateX(100%) !important;
}
.mobile-menu-panel.active {
    display: flex !important;
    pointer-events: auto !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

/* Улучшение touch-кликов на телефонах */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .h-btn, .pricing-hero-btn, .hero-btn-primary, .hero-btn-ghost,
    .product-btn, .pay-btn, .auth-btn, .site-nav-toggle, button {
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Only interactive controls — not every link (scale makes layout look crooked) */
    .btn:active, .h-btn:active, .pricing-hero-btn:active, .hero-btn-primary:active,
    .hero-btn-ghost:active, .product-btn:active, .pay-btn:active, button:active {
        opacity: 0.88;
    }
}

/* ============================================================
   ДОПОЛНИТЕЛЬНАЯ МОБИЛЬНАЯ АДАПТАЦИЯ СТРАНИЦ
   ============================================================ */

/* =====================
   ГЛОБАЛЬНЫЕ ФИКСЫ ДЛЯ ТЕЛЕФОНОВ
   ===================== */
@media (max-width: 576px) {
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    /* Уменьшаем отступы у карточек */
    .card-body {
        padding: 0.75rem 0.5rem;
    }
    
    .card-header {
        padding: 0.6rem 0.75rem;
    }
    
    /* Отключаем лишние анимации на мобильных для производительности */
    .card, .btn, .subscription-card, a {
        transition: opacity 0.2s ease, background-color 0.2s ease !important;
    }
    
    /* Убираем transform анимации на мобильных */
    .card:hover, .btn:hover, .subscription-card:hover {
        transform: none !important;
    }
    
    /* Запрещаем зум на инпутах (iOS) */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* =====================
   СТРАНИЦЫ ВХОДА / РЕГИСТРАЦИИ (login.php / register.php)
   ===================== */
@media (max-width: 576px) {
    body.page-auth main.site-main.container {
        padding-left: 10px !important;
        padding-right: 10px !important;
        max-width: 100%;
    }

    .auth-scene {
        width: 100%;
        max-width: 100%;
    }

    .auth-shell {
        width: 100%;
        max-width: 100%;
    }

    .auth-panel-head h2 {
        font-size: 1.3rem;
    }

    .auth-checkbox label {
        font-size: 0.82rem;
        line-height: 1.45;
    }

    .auth-oauth-row {
        flex-direction: column;
        gap: 10px;
    }

    .auth-oauth-btn {
        width: 100%;
    }
}

/* =====================
   СТРАНИЦА ПРОФИЛЯ (profile.php)
   ===================== */
@media (max-width: 768px) {
    .profile-sidebar-card {
        margin-bottom: 16px;
    }
    
    /* Нав-пиллы (табы) горизонтальным скроллом */
    .profile-tabs-nav {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .profile-tabs-nav::-webkit-scrollbar {
        display: none;
    }
    
    .profile-tabs-nav .nav-item {
        flex-shrink: 0;
    }
    
    .profile-tabs-nav .nav-link {
        white-space: nowrap;
        font-size: 0.78rem;
        padding: 8px 14px;
    }
    
    /* Размещаем метки полей над инпутами */
    .profile-form .row > .col-sm-3 {
        margin-bottom: 4px;
    }
    
    .profile-form .col-form-label {
        padding-bottom: 0;
        font-size: 0.78rem;
        color: var(--muted-color, rgba(255,255,255,0.5));
    }
}

@media (max-width: 576px) {
    /* Аватар и информация — в колонку */
    .profile-header-card {
        text-align: center;
    }
    
    .profile-header-card img,
    .profile-header-card .avatar-placeholder {
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Карточка подписки в сайдбаре */
    .profile-subscription-card {
        text-align: center;
    }
    
    /* HWID секция — компактный вид */
    .hwid-status-card {
        padding: 12px !important;
    }
    
    .hwid-status-card > div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    .hwid-status-card > div:first-child > div {
        min-width: auto !important;
        text-align: center;
    }
    
    /* Кнопка сброса HWID на всю ширину */
    .hwid-status-card #hwidResetBtn,
    .hwid-status-card .btn-outline-danger {
        width: 100%;
    }
    
    /* Вывод HWID — копировать под ним */
    #hwidDisplay {
        font-size: 10px !important;
        padding: 8px !important;
        word-break: break-all;
    }
    
    /* История — таблицы в карточный вид */
    .history-table-card thead {
        display: none;
    }
    
    .history-table-card tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 8px;
        padding: 10px;
        background: rgba(255,255,255,0.02);
    }
    
    .history-table-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 6px 0;
    }
    
    .history-table-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        color: var(--muted-color, rgba(255,255,255,0.4));
        letter-spacing: 0.5px;
    }
    
    /* Баланс — компактный */
    .balance-card {
        font-size: 0.85rem;
    }
    
    .balance-amount {
        font-size: 1.2rem !important;
    }
}

/* =====================
   СТРАНИЦА СКАЧИВАНИЯ (downloads.php)
   ===================== */
@media (max-width: 576px) {
    .dl-ui-center {
        gap: 18px;
        width: 100%;
    }

    .dl-install-wrap {
        width: 100%;
    }

    .dl-terminal-wrap,
    .dl-filename-box {
        width: 100%;
        max-width: none;
    }

    .dl-retry-btn {
        min-height: 44px;
        width: 100%;
    }

    /* Инструкция — компактные шаги */
    .download-step {
        padding: 12px !important;
    }
    
    .download-step .step-number {
        font-size: 1.2rem !important;
        min-width: 32px !important;
        height: 32px !important;
        line-height: 32px !important;
    }
    
    .download-step .step-title {
        font-size: 0.9rem !important;
    }
    
    .download-step .step-desc {
        font-size: 0.8rem !important;
    }
    
    /* Таблица горячих клавиш — карточный вид */
    .hotkeys-table thead {
        display: none;
    }
    
    .hotkeys-table tbody tr {
        display: block;
        margin-bottom: 8px;
        border: 1px solid rgba(255,255,255,0.06);
        border-radius: 8px;
        padding: 8px 10px;
        background: rgba(255,255,255,0.02);
    }
    
    .hotkeys-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 4px 0;
        font-size: 0.8rem;
    }
    
    .hotkeys-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        color: var(--muted-color, rgba(255,255,255,0.4));
        letter-spacing: 0.5px;
    }
    
    /* Предупреждения */
    .download-warning {
        padding: 10px 12px !important;
        font-size: 0.8rem;
    }
    
    /* Карточка версии */
    .version-card {
        text-align: center;
    }
    
    .version-card .btn {
        width: 100%;
    }
}

/* =====================
   СТРАНИЦА ПОДПИСОК (subscription.php)
   ===================== */
@media (max-width: 576px) {
    /* Карточки подписок в столбик */
    .subscription-card {
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .subscription-card.featured {
        transform: none !important;
    }
    
    /* Заголовок карточки */
    .subscription-card .card-header h3 {
        font-size: 1.1rem;
    }
    
    /* Цена — компактно */
    .subscription-price {
        font-size: 1.4rem !important;
    }
    
    .subscription-price small {
        font-size: 0.7rem !important;
    }
    
    /* Список возможностей */
    .subscription-features li {
        font-size: 0.8rem !important;
        padding: 6px 0 !important;
    }
    
    /* Кнопка на всю ширину */
    .subscription-card .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Период подписки — кнопки выбора */
    .plan-period-selector .btn {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* =====================
   СТРАНИЦА ПОПОЛНЕНИЯ (top-up.php)
   ===================== */
@media (max-width: 576px) {
    /* Сетка способов оплаты */
    .payment-methods {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    
    .payment-method-card {
        padding: 12px !important;
    }
    
    .payment-method-card .method-icon {
        font-size: 1.5rem !important;
    }
    
    .payment-method-card .method-name {
        font-size: 0.9rem !important;
    }
    
    /* Поле ввода суммы */
    .amount-input {
        font-size: 1.3rem !important;
        padding: 12px !important;
    }
    
    /* Кнопка пополнения */
    .top-up-btn {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }
    
    /* Инструкция под формой */
    .payment-info {
        font-size: 0.8rem;
    }
}

/* =====================
   СТРАНИЦЫ ОСТАЛЬНЫЕ (forgot-password / reset-password / activate-key)
   ===================== */
@media (max-width: 576px) {
    .forgot-password-form .btn,
    .reset-password-form .btn,
    .activate-key-form .btn {
        width: 100%;
    }
    
    .forgot-password-form .form-control,
    .reset-password-form .form-control,
    .activate-key-form .form-control {
        font-size: 16px !important;
        padding: 12px 14px;
    }
    
    .forgot-password-form h1,
    .reset-password-form h1,
    .activate-key-form h1 {
        font-size: 1.3rem;
    }
}

/* =====================
   АДМИН-ПАНЕЛЬ — УЛУЧШЕНИЯ ДЛЯ ТЕЛЕФОНОВ
   ===================== */
@media (max-width: 768px) {
    /* Сайдбар уже адаптирован, но добавим больше */
    .admin-sidebar {
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: 6px 8px;
        margin: -8px -8px 8px -8px;
        gap: 2px;
        background: rgba(15, 15, 25, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    
    .admin-sidebar .nav-link {
        font-size: 0.7rem;
        padding: 6px 10px;
        min-height: 34px;
    }
    
    .admin-sidebar .nav-link i {
        margin-right: 4px;
        font-size: 0.8rem;
    }
    
    /* Статистические карточки — 2 в ряд */
    .admin-stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .admin-stat-card {
        padding: 12px !important;
    }
    
    .admin-stat-card .stat-value {
        font-size: 1.2rem !important;
    }
    
    .admin-stat-card .stat-label {
        font-size: 0.65rem !important;
    }
    
    /* Хлебные крошки компактнее */
    .admin-breadcrumb {
        font-size: 0.75rem;
        padding: 8px 0;
    }
}

/* =====================
   360px — САМЫЕ МАЛЕНЬКИЕ ТЕЛЕФОНЫ (iPhone SE и т.д.)
   ===================== */
@media (max-width: 380px) {
    body {
        font-size: 14px;
    }
    
    h1 {
        font-size: 1.2rem !important;
    }
    h2 {
        font-size: 1rem !important;
    }
    h3 {
        font-size: 0.9rem !important;
    }
    
    .card-body {
        padding: 0.5rem 0.4rem;
    }
    
    .container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    /* Убираем иконки из кнопок навигации если не помещаются */
    .site-nav-link i {
        display: none;
    }
    
    /* Админ-панель — супер-компакт */
    .admin-sidebar .nav-link {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
}

/* =====================
   FIX: Исправление sticky position для админ-сайдбара
   ===================== */
@media (max-width: 768px) {
    .admin-sidebar.fixed-sidebar {
        position: sticky;
        top: 0;
        z-index: 100;
    }
    
    /* Контент не перекрывается сайдбаром */
    .admin-content-wrapper {
        padding-top: 0;
    }
}

/* =====================
   ОПТИМИЗАЦИЯ ИЗОБРАЖЕНИЙ ДЛЯ ТЕЛЕФОНОВ
   ===================== */
@media (max-width: 576px) {
    /* Аватарки меньше */
    .avatar-lg {
        width: 72px !important;
        height: 72px !important;
    }
    
    .avatar-md {
        width: 48px !important;
        height: 48px !important;
    }
    
    .avatar-sm {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Изображения внутри карточек */
    .card-img-top {
        max-height: 180px;
        object-fit: cover;
    }
}

/* =====================
   HERO-СЕКЦИЯ НА ТЕЛЕФОНАХ
   ===================== */
@media (max-width: 576px) {
    .hero-section {
        padding: 2rem 0 1.5rem !important;
        min-height: auto !important;
    }
    
    .hero-title {
        font-size: 1.4rem !important;
    }
    
    .hero-subtitle {
        font-size: 0.85rem !important;
    }
    
    /* CTA кнопки */
    .hero-cta .btn {
        width: 100%;
        margin: 4px 0;
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 6px;
    }
}

/* =====================
   ВИДЕО СЕКЦИЯ НА ТЕЛЕФОНАХ
   ===================== */
@media (max-width: 576px) {
    .video-wrapper {
        border-radius: 8px !important;
    }
    
    .video-wrapper iframe {
        min-height: 200px !important;
    }
}

/* =====================
   АДАПТАЦИЯ "HOW IT WORKS" НА ТЕЛЕФОНАХ
   ===================== */
@media (max-width: 576px) {
    .how-steps {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .how-step {
        padding: 16px !important;
    }
    
    .how-step-icon {
        font-size: 1.5rem !important;
    }
}

/* =====================
   АДАПТАЦИЯ ДРУГИХ СТРАНИЦ
   ===================== */
@media (max-width: 576px) {
    /* Reviews / Article / About */
    .review-card {
        padding: 12px !important;
        text-align: center;
    }
    
    .review-card .review-author {
        justify-content: center;
    }
    
    .article-content {
        font-size: 0.85rem;
    }
    
    .article-content img {
        max-width: 100%;
        height: auto;
    }
}

/* =====================
   ФИКС: Большие модальные окна на телефонах
   ===================== */
@media (max-width: 576px) {
    .modal-dialog.modal-lg {
        max-width: calc(100vw - 20px);
        margin: 10px;
    }
    
    .modal-dialog-scrollable {
        max-height: calc(100vh - 60px);
    }
}

/* =====================
   ФИКС: Таблицы с большим кол-вом колонок
   ===================== */
@media (max-width: 576px) {
    .table-responsive-wide {
        margin: 0 -12px;
        width: calc(100% + 24px);
    }
}

/* =====================
   ФИКС: Слишком широкие инпуты
   ===================== */
@media (max-width: 576px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        max-width: 100%;
    }
}

/* ============================================================
   MOBILE SCROLL + LAYOUT HARD FIX (phones)
   Blocks that "won't move", clipped accordions, crooked CTAs
   ============================================================ */
html {
    overflow-x: clip;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: auto;
}

html, body {
    overscroll-behavior-y: auto;
    height: auto;
    min-height: 100%;
}

body:not(.menu-open):not(.site-intro-lock):not(.hfx-modal-open) {
    overflow-x: clip !important;
    overflow-y: auto !important;
    touch-action: pan-x pan-y !important;
    position: static !important;
    height: auto !important;
}

#particles-canvas,
.page-bg,
.ambient-orbs,
.orb {
    pointer-events: none !important;
}

.lb-scroll,
.nest-scroll,
.table-responsive,
.profile-tabs-nav,
.admin-sidebar,
.mobile-menu-panel.active {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

@media (max-width: 768px) {
    .faq-item.open .faq-a,
    .about-content.open {
        max-height: none !important;
        overflow: visible !important;
    }

    .hero-cta-row,
    .h-hero-actions,
    .about-actions,
    .hero-cta,
    .cta-actions,
    .auth-oauth-row,
    .hfx-modal-actions,
    .error-actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
        gap: 10px;
    }

    .hero-cta-row > *,
    .h-hero-actions > *,
    .about-actions > *,
    .hero-cta > *,
    .cta-actions > *,
    .auth-oauth-row > *,
    .pricing-hero-btn,
    .hero-btn-primary,
    .hero-btn-ghost,
    .h-btn,
    .product-btn,
    .pay-btn,
    .sub-btn,
    .auth-btn,
    .top-up-btn,
    .dl-retry-btn {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        justify-content: center !important;
        text-align: center;
        white-space: normal;
        min-height: 48px;
    }

    .profile-tabs-nav,
    .plan-period-selector,
    .admin-sidebar {
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
    }

    .lb-scroll,
    .nest-scroll {
        overflow-y: auto !important;
        max-height: min(60vh, 420px);
        touch-action: pan-y;
        overscroll-behavior: contain;
    }

    .h-card,
    .product-card,
    .product-card-v2,
    .cabinet-card,
    .dash-card,
    .faq-item,
    .about-panel,
    .subscription-card {
        contain: none !important;
    }

    .footer-social,
    .footer-badges {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        max-width: 100%;
    }

    .pricing-grid,
    .products-grid,
    .subscription-grid,
    .features-grid,
    .how-steps,
    .how_steps,
    .st-plats,
    .plat-imgui-row,
    .pp-custom-grid,
    .pp-feat-grid,
    .pp-why-grid,
    .social-grid {
        grid-template-columns: 1fr !important;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .st-strip,
    .st-strip-inner,
    .st-badges,
    .st-plat,
    .how_step_card,
    .pp-feat,
    .plat-pill,
    .h-hero,
    .h-hero-title,
    .h-hero-lead {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .st-badge {
        white-space: normal;
        word-break: break-word;
    }

    .how_arrow {
        transform: rotate(90deg);
        padding: 4px 0;
    }

    .pp-feat.is-wide {
        grid-column: span 1 !important;
    }

    img, video, iframe {
        max-width: 100%;
        height: auto;
    }

    .site-nav {
        touch-action: manipulation;
    }
}

@media (max-width: 380px) {
    .h-btn, .btn, .pricing-hero-btn, .hero-btn-primary, .auth-btn {
        padding-left: 14px !important;
        padding-right: 14px !important;
        font-size: 0.82rem !important;
    }
}

