/* ===================================================
   ZXCRYPTO - Полная мобильная адаптация
   Поддержка всех устройств: 320px - 1024px
   =================================================== */

/* ===== PWA РЕЖИМ - ОТСТУПЫ ДЛЯ СИСТЕМНОЙ ПАНЕЛИ ===== */
/* Когда приложение установлено (standalone mode) */
@media (display-mode: standalone) {
    body {
        /* Отступ сверху для системной панели iOS */
        padding-top: env(safe-area-inset-top);
        padding-top: constant(safe-area-inset-top); /* iOS 11.0 */
    }

    .header {
        /* Увеличиваем высоту header с учетом системной панели */
        padding-top: env(safe-area-inset-top) !important;
        padding-top: constant(safe-area-inset-top) !important; /* iOS 11.0 */
    }

    .header__container {
        /* Центрируем контент header */
        padding-top: 0 !important;
    }
}

/* Дополнительная защита для iOS с вырезом (notch) */
@supports (padding: max(0px)) {
    @media (display-mode: standalone) {
        .header {
            padding-top: max(env(safe-area-inset-top), 0px) !important;
        }
    }
}

/* ===== ОБЩИЕ МОБИЛЬНЫЕ СТИЛИ ===== */
@media (max-width: 1024px) {
    * {
        -webkit-tap-highlight-color: rgba(255, 0, 132, 0.2);
    }
    
    body {
        overflow-x: hidden;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Улучшенная прокрутка для iOS */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Увеличенные touch-области для кнопок */
    button, a, input, select {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ===== ПЛАНШЕТЫ (768px - 1024px) ===== */
@media (min-width: 768px) and (max-width: 1024px) {
    .home__content-title {
        font-size: 64px !important;
        line-height: 1.2;
        padding: 0 30px;
    }

    .home__content-des {
        font-size: 18px !important;
        max-width: 600px !important;
        padding: 0 30px;
    }

    .home__container {
        height: 700px !important;
    }

    .header__logo-text {
        font-size: 20px;
    }

    .header__nav-link {
        font-size: 15px;
        padding: 8px 12px;
    }

    .home__slider-box {
        width: 650px !important;
        bottom: 100px !important;
    }

    .home__bottom-bef {
        bottom: 35px !important;
    }
}

/* ===== МОБИЛЬНЫЕ УСТРОЙСТВА (до 767px) ===== */
@media (max-width: 767px) {
    /* Header адаптация */
    .header__container {
        padding: 0 15px !important;
    }

    .header__logo-img {
        width: 50px !important;
        height: auto !important;
    }

    .header__logo-text {
        font-size: 18px !important;
        display: inline-block;
    }

    .header__nav {
        display: none !important;
    }

    .header__auth-buttons {
        display: none !important;
    }

    .header__btn-box {
        display: flex !important;
        gap: 8px;
    }

    .header__btn {
        font-size: 13px !important;
        padding: 8px 16px !important;
    }

    /* Home секция */
    .home__container {
        height: 600px !important;
        padding: 80px 15px 40px !important;
    }

    .home__content {
        padding-bottom: 130px !important;
    }

    .home__content-title {
        font-size: 42px !important;
        line-height: 1.2 !important;
        padding: 0 15px !important;
        text-align: center;
        margin-bottom: 20px;
    }

    .home__content-des {
        font-size: 16px !important;
        line-height: 1.5 !important;
        max-width: 90% !important;
        padding: 0 20px !important;
        text-align: center;
        margin: 20px auto !important;
    }

    .home__slider-box {
        width: 100% !important;
        max-width: 90vw !important;
        bottom: 30px !important;
        padding: 0 10px;
    }
    
    /* Включаем анимацию бегущей строки */
    .home__slider-left {
        animation: slideCoins 20s infinite linear !important;
    }

    /* КРИТИЧНО: Отступы для мобильного слайдера */
    .home__slider-mobile .home__slider-card,
    .home__slider-card {
        min-width: 180px !important;
        font-size: 14px !important;
        column-gap: 6px !important;
        display: flex !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    /* Двойная защита: margin-right для каждого дочернего элемента */
    /* Логотип - БОЛЬШОЙ отступ справа */
    .home__slider-mobile .home__slider-img,
    .home__slider-img {
        margin-right: 14px !important;
    }

    /* Текст монеты и цена - МАЛЕНЬКИЙ отступ */
    .home__slider-mobile .home__slider-title,
    .home__slider-mobile .home__slider-prise,
    .home__slider-title,
    .home__slider-prise {
        margin-right: 2px !important;
    }

    /* Процент - без отступа */
    .home__slider-mobile .home__slider-present,
    .home__slider-present {
        margin-right: 0 !important;
    }

    .home__slider-img {
        width: 32px !important;
        height: 32px !important;
    }

    .home__slider-prise {
        font-size: 14px !important;
    }

    .home__slider-present {
        font-size: 13px !important;
    }

    .home__bottom-bef {
        bottom: 35px !important;
        width: 120px !important;
        height: 40px !important;
    }

    /* Footer адаптация */
    .footer__container {
        padding: 40px 20px !important;
    }

    .footer__groups {
        flex-direction: column !important;
        gap: 30px !important;
    }

    .footer__group {
        width: 100% !important;
        text-align: center !important;
    }

    .footer__group-title {
        font-size: 18px !important;
        margin-bottom: 15px !important;
    }

    .footer__group-link {
        font-size: 14px !important;
        padding: 8px 0 !important;
    }
}

/* ===== СРЕДНИЕ ТЕЛЕФОНЫ (480px - 767px) ===== */
@media (min-width: 480px) and (max-width: 767px) {
    .home__content-title {
        font-size: 48px !important;
    }

    .home__slider-box {
        max-width: 450px !important;
    }

    .home__slider-card {
        min-width: 200px !important;
        column-gap: 6px !important;
    }
}

/* ===== МАЛЕНЬКИЕ ТЕЛЕФОНЫ (375px - 479px) ===== */
@media (min-width: 375px) and (max-width: 479px) {
    .home__content-title {
        font-size: 36px !important;
    }

    .home__content-des {
        font-size: 14px !important;
    }

    .home__slider-box {
        max-width: 350px !important;
        bottom: 25px !important;
    }

    .home__slider-card {
        min-width: 160px !important;
        font-size: 13px !important;
        column-gap: 5px !important;
    }

    .home__slider-img {
        width: 28px !important;
        height: 28px !important;
    }
    
    .home__slider-prise {
        font-size: 13px !important;
    }

    .header__btn {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
}

/* ===== ОЧЕНЬ МАЛЕНЬКИЕ ТЕЛЕФОНЫ (320px - 374px) ===== */
@media (max-width: 374px) {
    .home__content-title {
        font-size: 28px !important;
        padding: 0 10px !important;
    }

    .home__content-des {
        font-size: 13px !important;
        padding: 0 15px !important;
        line-height: 1.4 !important;
    }

    .home__container {
        height: 550px !important;
    }

    .home__slider-box {
        max-width: 280px !important;
        bottom: 20px !important;
    }

    .home__slider-card {
        min-width: 130px !important;
        font-size: 12px !important;
        column-gap: 4px !important;
    }

    .home__slider-img {
        width: 24px !important;
        height: 24px !important;
    }

    .home__slider-prise {
        font-size: 12px !important;
    }

    .home__slider-present {
        font-size: 11px !important;
    }

    .header__logo-img {
        width: 40px !important;
    }

    .header__logo-text {
        font-size: 16px !important;
    }

    .header__btn {
        font-size: 11px !important;
        padding: 6px 10px !important;
    }

    .home__bottom-bef {
        width: 100px !important;
        height: 35px !important;
    }
}

/* ===== ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ ТЕЛЕФОНОВ ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .home__container {
        height: 400px !important;
    }

    .home__content-title {
        font-size: 32px !important;
        margin-bottom: 10px !important;
    }

    .home__content-des {
        font-size: 13px !important;
        margin: 10px auto !important;
    }

    .home__slider-box {
        bottom: 20px !important;
    }

    .home__content {
        padding-bottom: 80px !important;
    }
}

/* ===== ОПТИМИЗАЦИЯ TOUCH ИНТЕРФЕЙСА ===== */
@media (hover: none) and (pointer: coarse) {
    /* Увеличенные области клика для сенсорных экранов */
    .header__nav-link,
    .header__btn,
    .footer__group-link {
        padding: 12px 16px !important;
    }

    /* Убираем hover эффекты на touch устройствах */
    button:hover,
    a:hover {
        transform: none !important;
    }

    /* Активные состояния для touch */
    button:active,
    a:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* ===== PWA АДАПТАЦИЯ ===== */
@media all and (display-mode: standalone) {
    /* Дополнительный отступ сверху для PWA */
    .header {
        padding-top: env(safe-area-inset-top);
    }

    .home__container {
        padding-top: calc(80px + env(safe-area-inset-top));
    }

    /* Отступы для iPhone с выемкой */
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ===== DARK MODE НА МОБИЛЬНЫХ ===== */
@media (max-width: 767px) and (prefers-color-scheme: dark) {
    [data-theme="light"] {
        /* Автоматически переключаем на темную тему на мобильных в dark mode */
    }
}

/* ===== ACCESSIBILITY - УВЕЛИЧЕННЫЙ ШРИФТ ===== */
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== ВЫСОКАЯ ПЛОТНОСТЬ ПИКСЕЛЕЙ (Retina) ===== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Оптимизация для Retina дисплеев */
    .header__logo-img,
    .home__slider-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== ПЛАНШЕТЫ В ПОРТРЕТНОЙ ОРИЕНТАЦИИ ===== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .home__container {
        height: 750px !important;
    }

    .home__content-title {
        font-size: 58px !important;
    }

    .home__slider-box {
        bottom: 120px !important;
    }
}

/* ===== ПЛАНШЕТЫ В ЛАНДШАФТНОЙ ОРИЕНТАЦИИ ===== */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .home__container {
        height: 550px !important;
    }

    .home__content {
        padding-bottom: 100px !important;
    }

    .home__slider-box {
        bottom: 70px !important;
    }
}

/* ===== ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ ===== */
@media (max-width: 767px) {
    /* Отключаем сложные анимации на слабых устройствах */
    .home__cyber-bg::after {
        animation: none !important;
    }

    /* Упрощаем тени */
    .home__content-title {
        text-shadow: 0 0 10px rgba(255, 0, 132, 0.3) !important;
    }
}
