/* ========================================================
   MOBILE-FIX.CSS - GOD-LEVEL MOBILE RESPONSIVE
   По ТЗ: production-ready responsive от 320px
   Подключается ПОСЛЕДНИМ после всех CSS
   Ничего не удаляет - только добавляет/перезаписывает
   ======================================================== */

/* ===========================================
   1. ГЛОБАЛЬНЫЕ SAFETY RULES
   =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Запрет горизонтального скролла */
html, body {
    max-width: 100vw;
}

/* Все изображения адаптивные */
img, video, iframe, embed, object, svg {
    max-width: 100%;
    height: auto;
}

/* Таблицы в скролл-контейнере */
table {

    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Длинные слова переносятся */
p, h1, h2, h3, h4, h5, h6, li, td, th, a, span, div, label, blockquote {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Формы: все input на full width */
input, textarea, select {
    max-width: 100%;
    min-width: 0;
}

/* ===========================================
   2. КОНТЕЙНЕР - правильные отступы
   =========================================== */
@media (max-width: 768px) {
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

@media (max-width: 480px) {
    .container {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }
}

/* ===========================================
   3. TYPOGRAPHY - fluid adaptive
   =========================================== */
@media (max-width: 768px) {
    body {
        font-size: 15px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: clamp(1.6rem, 6vw, 2.4rem) !important;
        line-height: 1.15 !important;
        letter-spacing: -0.5px;
    }
    
    h2 {
        font-size: clamp(1.4rem, 5vw, 2rem) !important;
        line-height: 1.2 !important;
    }
    
    h3 {
        font-size: clamp(1.2rem, 4vw, 1.6rem) !important;
    }
    
    h4 {
        font-size: clamp(1rem, 3vw, 1.3rem) !important;
    }
}

@media (max-width: 375px) {
    h1 {
        font-size: clamp(1.4rem, 5.5vw, 2rem) !important;
    }
    
    h2 {
        font-size: clamp(1.2rem, 4.5vw, 1.6rem) !important;
    }
}

/* ===========================================
   4. КНОПКИ - минимум 44px touch target
   =========================================== */
@media (max-width: 768px) {
    button, 
    .btn-hero, 
    .btn-hero-main, 
    .btn-consult, 
    .btn-final-cta, 
    .btn-modal-submit, 
    .btn-delivery-cta,
    .similar-link,
    .care-tab-btn,
    [class*="btn-"] {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .btn-hero,
    .btn-hero-main {
        width: 100%;
        justify-content: center;
        padding: 16px 24px !important;
        font-size: 0.95rem !important;
    }
    
    .btn-final-cta {
        padding: 16px 28px !important;
        font-size: 1rem !important;
    }
    
    .btn-consult {
        padding: 10px 18px;
    }
}

@media (max-width: 480px) {
    .hero-btns {
        flex-direction: column !important;
        gap: 12px !important;
        width: 100%;
    }
    
    .hero-btns a,
    .hero-btns button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ===========================================
   5. HEADER - мобильная адаптация
   =========================================== */
@media (max-width: 768px) {
    header {
        padding: 8px 0 !important;
    }
    
    .logo {
        font-size: 1.1rem !important;
    }
    
    .hamburger span {
        width: 22px;
    }
    
    /* Телефон в хедере */
    .phone-val {
        font-size: 0.9rem !important;
    }
    
    .soc-group {
        gap: 8px;
    }
    
    .soc-group a {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1rem !important;
    }
    
    .mobile-phone-top {
        font-size: 0.8rem !important;
    }
}

/* ===========================================
   6. BREADCRUMBS - мобильный скролл
   =========================================== */
@media (max-width: 768px) {
    .breadcrumbs-inner {
		margin-top: 20px;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 0.8rem;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .breadcrumbs-inner {
        font-size: 0.75rem;
    }
}

/* ===========================================
   7. HERO - мобильная адаптация
   =========================================== */
@media (max-width: 768px) {
    .hero {
        min-height: auto !important;
        padding: 100px 0 60px !important;
    }
    
    .hero-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
    }
    
    .hero-image-right {
        display: none !important;
    }
    
    .hero-features {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .hero-feature {
        flex: 0 0 auto;
    }
    
    .hero-badges-mobile-wrapper {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 90px 0 50px !important;
    }
    
    .hero-feature-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 375px) {
    .hero {
        padding: 85px 0 40px !important;
    }
}

/* ===========================================
   8. GALLERY SLIDER - мобильный
   =========================================== */
@media (max-width: 480px) {
    .gallery-slider-container {
        padding: 0 16px !important;
    }
    
    .gallery-slider {
        height: 250px !important;
    }
    
    .gallery-slide {
        width: 100% !important;
        max-width: 100% !important;
        height: 220px !important;
        border-radius: 16px !important;
    }
    
    .gallery-slide.prev,
    .gallery-slide.next {
        display: none !important;
    }
    
    .gallery-nav-btn {
        width: 40px !important;
        height: 40px !important;
        font-size: 0.9rem !important;
    }
    
    .gallery-nav-btn.prev {
        left: 0 !important;
    }
    
    .gallery-nav-btn.next {
        right: 0 !important;
    }
}

@media (max-width: 375px) {
    .gallery-slider {
        height: 220px !important;
    }
    
    .gallery-slide {
        height: 200px !important;
    }
}

/* ===========================================
   9. SPECS GRID - мобильный
   =========================================== */
@media (max-width: 640px) {
    .specs-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .spec-card {
        padding: 24px 18px !important;
    }
}

/* ===========================================
   10. PRICE/ORDER - мобильный
   =========================================== */
@media (max-width: 768px) {
    .price-order-grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
    
    .price-order-card {
        padding: 24px 18px !important;
    }
    
    .price-includes {
        padding: 24px 18px !important;
    }
}

@media (max-width: 480px) {
    .form-input-price {
        padding: 14px 16px !important;
        font-size: 16px !important; /* предотвращает zoom на iOS */
        border-radius: 10px !important;
    }
}

/* ===========================================
   11. CARE TABS - мобильный
   =========================================== */
@media (max-width: 768px) {
    .care-tabs {
        gap: 8px !important;
        margin-bottom: 30px !important;
    }
    
    .care-tab-btn {
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
        justify-content: center;
    }
    
    .care-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .care-card {
        padding: 24px 18px !important;
    }
}

/* ===========================================
   12. DELIVERY - мобильный
   =========================================== */
@media (max-width: 768px) {
    .delivery-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .delivery-guarantees-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* ===========================================
   13. FAQ - мобильный
   =========================================== */
@media (max-width: 768px) {
    .faq-question {
        font-size: 1rem !important;
        padding-right: 30px !important;
    }
    
    .faq-answer {
        font-size: 0.9rem !important;
    }
    
    .faq-item {
        padding: 18px 0 !important;
    }
}

@media (max-width: 480px) {
    .faq-question {
        font-size: 0.95rem !important;
    }
}

/* ===========================================
   14. SIMILAR CARDS - мобильный
   =========================================== */
@media (max-width: 768px) {
    .similar-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .similar-img-wrapper {
        height: 250px !important;
    }
    
    .similar-content {
        padding: 20px 16px !important;
    }
}

@media (max-width: 480px) {
    .similar-img-wrapper {
        height: 220px !important;
    }
}

/* ===========================================
   15. FINAL CTA - мобильный
   =========================================== */
@media (max-width: 768px) {
    .final-cta-section {
        padding: 60px 0 !important;
    }
    
    .final-cta-buttons {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .final-cta-text {
        font-size: 1rem !important;
        margin-bottom: 30px !important;
    }
}

/* ===========================================
   16. FOOTER - мобильный
   =========================================== */
@media (max-width: 768px) {
    footer {
        padding: 60px 0 30px !important;
    }
    
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center;
    }
    
    .footer-col h4 {
        margin-bottom: 16px !important;
    }
    
    .footer-col li {
        margin-bottom: 10px !important;
    }
    
    .f-contact {
        justify-content: center;
    }
    
    .footer-bottom-row {
        flex-direction: column !important;
        gap: 12px !important;
        text-align: center;
    }
}

/* ===========================================
   17. МОДАЛЬНЫЕ ОКНА - по ТЗ
   =========================================== */
@media (max-width: 768px) {
    .modal {
        padding: 16px !important;
        align-items: flex-end !important; /* iOS bottom sheet pattern */
    }
    
    .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: 20px 20px 0 0 !important;
        margin: 0 !important;
    }
    
    .modal-content {
        padding: 40px 20px 30px !important;
        overflow-y: auto !important;
    }
    
    .modal-close {
        top: 12px !important;
        right: 12px !important;
        width: 36px !important;
        height: 36px !important;
        z-index: 10001 !important;
    }
    
    .modal-title {
        font-size: 1.4rem !important;
        padding-right: 40px;
    }
    
    .form-input-modal {
        padding: 14px 16px !important;
        font-size: 16px !important; /* предотвращает zoom на iOS */
    }
}

@media (max-width: 480px) {
    .modal-box {
        max-height: 92vh !important;
    }
    
    .modal-title {
        font-size: 1.25rem !important;
    }
}

/* Catalog modal */
@media (max-width: 768px) {
    .catalog-modal {
        padding: 20px 16px 100px !important; /* 100px для mobile-tab bar */
    }
    
    .cat-modal-close {
        top: 16px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
    }
    
    .cat-modal-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin: 30px auto !important;
    }
    
    .cat-modal-item {
        padding: 16px !important;
        gap: 14px !important;
    }
}

/* ===========================================
   18. MOBILE NAVIGATION - burger menu
   =========================================== */
.mobile-nav-overlay {
    -webkit-overflow-scrolling: touch;
}

.mobile-nav-box {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Body scroll lock при открытом меню */
body.menu-open,
body.modal-open {
    overflow: hidden !important;
    top: 0;
    width: 100%;
    touch-action: none;
}

/* ===========================================
   19. MOBILE TAB BAR - нижняя навигация
   =========================================== */
@media (max-width: 1024px) {
    .mobile-tab {
        display: flex !important;
    }
    
    /* Отступ снизу для контента чтобы tab bar не перекрывал */
    body {
        padding-bottom: 100px;
    }
    
    footer {
        padding-bottom: 120px !important;
    }
}

@media (max-width: 480px) {
    .mobile-tab {
        bottom: 12px !important;
        left: 10px !important;
        right: 10px !important;
        height: 65px !important;
    }
    
    .tab-item {
        font-size: 0.58rem !important;
        padding: 6px 8px !important;
    }
    
    .tab-item i {
        font-size: 1.2rem !important;
    }
}

@media (max-width: 375px) {
    .mobile-tab {
        bottom: 8px !important;
        left: 8px !important;
        right: 8px !important;
        height: 60px !important;
        border-radius: 40px !important;
    }
    
    .tab-item {
        font-size: 0.55rem !important;
        padding: 5px 6px !important;
    }
}

/* ===========================================
   20. FLOATING ELEMENTS - telegram, scroll-top
   =========================================== */
@media (max-width: 1024px) {
    .floating-telegram {
        bottom: 105px !important;
    }
    
    .scroll-to-top {
        bottom: 105px !important;
        right: 20px !important;
    }
}

@media (max-width: 480px) {
    .floating-telegram {
        bottom: 90px !important;
        right: 12px !important;
        width: 48px !important;
        height: 48px !important;
    }
    
    .floating-telegram svg {
        width: 24px !important;
        height: 24px !important;
    }
    
    .scroll-to-top {
        bottom: 90px !important;
        width: 44px !important;
        height: 44px !important;
    }
}

/* ===========================================
   21. COOKIE BANNER - мобильный
   =========================================== */
@media (max-width: 768px) {
    .cookie-banner {
        padding: 1rem !important;
    }
    
    .cookie-content {
        flex-direction: column !important;
        text-align: center;
        gap: 1rem !important;
    }
    
    .cookie-text {
        min-width: auto !important;
    }
    
    .cookie-buttons {
        width: 100% !important;
        flex-direction: column !important;
    }
    
    .cookie-btn {
        width: 100% !important;
        min-height: 44px;
    }
}

/* ===========================================
   22. PAGE-SPECIFIC OVERRIDES
   =========================================== */

/* Секции с overflow:hidden - безопасно */
@media (max-width: 768px) {
    section {
        overflow-x: hidden;
    }
}

/* Quiz/викторина (если есть) */
@media (max-width: 768px) {
    .quiz-container,
    .quiz-step {
        padding: 20px 16px !important;
    }
    
    .quiz-option {
        min-height: 44px;
        padding: 12px 16px !important;
    }
}

/* Legality section */
@media (max-width: 768px) {
    .legality-grid,
    .about-grid {
        grid-template-columns: 1fr !important;
    }
}

/* SEO blocks */
@media (max-width: 768px) {
    .seo-section {
        padding: 50px 0 !important;
    }
    
    .seo-block {
        padding: 24px 16px !important;
    }
}

/* ===========================================
   23. iOS SPECIFIC FIXES
   =========================================== */

/* Предотвращаем zoom при фокусе на input (iOS) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    input[type="url"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* iOS safe areas */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-tab {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    footer {
        padding-bottom: calc(120px + env(safe-area-inset-bottom));
    }
    
    .cookie-banner {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

/* ===========================================
   24. ULTRA-SMALL SCREENS (320px)
   =========================================== */
@media (max-width: 340px) {
    .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
    
    h1 {
        font-size: 1.3rem !important;
    }
    
    h2 {
        font-size: 1.15rem !important;
    }
    
    .hero {
        padding: 80px 0 35px !important;
    }
    
    .modal-box {
        border-radius: 16px 16px 0 0 !important;
    }
    
    .care-tab-btn {
        padding: 8px 12px !important;
        font-size: 0.75rem !important;
    }
    
    .mobile-tab {
        height: 56px !important;
        border-radius: 35px !important;
    }
}

/* ===========================================
   25. PRINT - скрываем ненужное при печати
   =========================================== */
@media print {
    .mobile-tab,
    .floating-telegram,
    .scroll-to-top,
    .mobile-nav-overlay,
    .cookie-banner {
        display: none !important;
    }
}

/* ===========================================
=========================================== */

@media (max-width: 768px) {
    .hero-main {
        margin-top: 60px;
    }

}