/* ========================================
   MOBILE FIXES - LOVEMYDIET PL
   Critical fixes for mobile responsiveness
   ======================================== */

/* 1. KRYTYCZNE - Responsive padding dla sekcji */
@media (max-width: 768px) {
    section[style*="padding: 100px"],
    section[style*="padding: 140px"] {
        padding: 3rem 1rem !important;
    }

    /* Hero sections - specjalne traktowanie */
    section[style*="min-height: 60vh"] {
        padding: 5rem 1rem 2rem !important;
        min-height: auto !important;
    }
}

/* 2. KRYTYCZNE - Fixed width grids */
@media (max-width: 968px) {
    /* O-mnie.html - fix dla grid 400px */
    div[style*="grid-template-columns: 400px 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* Wszystkie pricing grids na 1 kolumnę */
    div[style*="grid-template-columns"][style*="minmax(320px"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns"][style*="minmax(300px"] {
        grid-template-columns: 1fr !important;
    }

    div[style*="grid-template-columns"][style*="minmax(400px"] {
        grid-template-columns: 1fr !important;
    }
}

/* 3. KRYTYCZNE - Carousel i obrazy overflow */
@media (max-width: 768px) {
    .meal-slide,
    div[style*="min-width: 400px"] {
        min-width: 90vw !important;
        max-width: 100% !important;
    }

    .meal-slide img {
        height: 250px !important;
        object-fit: cover;
    }
}

/* 4. WYSOKIE - Touch targets (min 44px) */
@media (max-width: 768px) {
    /* Notification bar button */
    .notification-bar a {
        padding: 0.75rem 1.25rem !important;
        min-height: 44px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    /* Hamburger menu */
    .hamburger {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Book button w navbar */
    .book-btn {
        min-height: 48px !important;
        padding: 14px 32px !important;
    }

    /* Wszystkie primary buttons */
    .btn-primary,
    a[class*="btn"],
    button {
        min-height: 44px !important;
        padding: 12px 24px !important;
    }
}

/* 5. WYSOKIE - Scale transforms na mobile */
@media (max-width: 768px) {
    div[style*="transform: scale(1.05)"],
    .pricing-card.featured {
        transform: scale(1) !important;
    }

    /* Usuń także margin compensation */
    div[style*="transform: scale(1.05)"] {
        margin: 0 !important;
    }
}

/* 6. WYSOKIE - Absolute positioned badges */
@media (max-width: 768px) {
    div[style*="transform: rotate(45deg)"] {
        right: -15px !important;
        font-size: 0.7rem !important;
        padding: 8px 35px !important;
    }
}

/* 7. ŚREDNIE - Spacing reduction */
@media (max-width: 768px) {
    div[style*="margin-bottom: 60px"],
    div[style*="margin-bottom: 80px"] {
        margin-bottom: 2.5rem !important;
    }

    /* Większe odstępy dla pricing/consultation cards na mobile */
    .pricing-grid,
    div[style*="grid-template-columns"][style*="gap: 30px"],
    div[style*="grid-template-columns"][style*="gap: 40px"] {
        gap: 3rem !important;
    }

    /* Mniejsze gappy dla innych elementów */
    div[style*="gap: 40px"]:not([style*="grid-template-columns"]),
    div[style*="gap: 30px"]:not([style*="grid-template-columns"]) {
        gap: 1.25rem !important;
    }
}

/* 8. ŚREDNIE - Black Friday promo button */
@media (max-width: 768px) {
    .black-friday-promo {
        bottom: 15px !important;
        right: 15px !important;
        left: 15px !important;
        max-width: calc(100vw - 30px) !important;
        font-size: 0.85rem !important;
        padding: 12px 18px !important;
    }
}

/* 9. WYSOKIE - Containers max-width */
@media (max-width: 768px) {
    div[style*="max-width: 900px"],
    div[style*="max-width: 800px"],
    div[style*="max-width: 1000px"],
    div[style*="max-width: 1200px"] {
        max-width: 95vw !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Mniejsze containery */
    div[style*="max-width: 500px"],
    div[style*="max-width: 600px"],
    div[style*="max-width: 700px"] {
        max-width: 92vw !important;
    }
}

/* 10. KRYTYCZNE - Prevent horizontal scroll */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
    }

    * {
        max-width: 100% !important;
    }

    /* Wyjątki dla inline elements */
    span, strong, em, b, i, a:not(.btn-primary):not([class*="btn"]) {
        max-width: none !important;
    }
}

/* 11. ŚREDNIE - Typography safety */
@media (max-width: 768px) {
    h1, h2, h3, h4, h5, h6 {
        word-break: normal;
        hyphens: none;
        overflow-wrap: normal;
    }

    /* Zmniejsz font-size dla dużych nagłówków */
    h1[style*="font-size: 4rem"],
    div[style*="font-size: 4rem"] {
        font-size: 2.5rem !important;
    }

    h1[style*="font-size: 3.5rem"],
    div[style*="font-size: 3.5rem"] {
        font-size: 2.2rem !important;
    }

    /* Stats section heading - zapobiegaj dzieleniu słów */
    .stats h2 {
        hyphens: none !important;
        word-break: keep-all !important;
        overflow-wrap: normal !important;
    }
}

/* 12. WYSOKIE - Menu mobile fixes */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed !important;
        max-height: calc(100vh - 78px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        padding: 1rem !important;
        display: block;
    }
}

/* 13. ŚREDNIE - Card padding */
@media (max-width: 768px) {
    div[style*="padding: 40px"] {
        padding: 1.5rem !important;
    }

    .pricing-card,
    .service-card {
        padding: 1.5rem !important;
    }
}

/* 14. NISKIE - Box-shadow performance */
@media (max-width: 768px) {
    div[style*="box-shadow: 0 10px"],
    div[style*="box-shadow: 0 15px"] {
        box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
    }
}

/* 15. NISKIE - Hover effects na touch */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .pricing-card:hover,
    div[style*="transition: transform"]:hover {
        transform: none !important;
    }
}

/* 16. WYSOKIE - Forms na mobile */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        min-height: 44px !important;
        padding: 12px !important;
    }

    textarea {
        min-height: 120px !important;
    }
}

/* 17. ŚREDNIE - Lightbox na mobile */
@media (max-width: 768px) {
    .lightbox,
    div[id*="lightbox"] {
        padding: 1rem !important;
    }

    .lightbox img {
        max-width: 100% !important;
        max-height: 80vh !important;
        width: auto !important;
        height: auto !important;
    }
}

/* 18. WYSOKIE - Pricing cards specific */
@media (max-width: 768px) {
    .pricing-card,
    div[style*="border-radius: 20px"][style*="padding: 40px"] {
        border-radius: 15px !important;
        padding: 1.5rem !important;
    }

    .pricing-price,
    div[style*="font-size: 4rem"] {
        font-size: 3rem !important;
    }
}

/* 19. KRYTYCZNE - Image overflow fix */
@media (max-width: 768px) {
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Hero images */
    div[style*="height: 400px"] img,
    div[style*="height: 300px"] img {
        height: auto !important;
        min-height: 200px !important;
    }
}

/* 20. ŚREDNIE - Footer na mobile */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .footer-section {
        text-align: center;
    }
}

/* 21. WYSOKIE - Countdown timer */
@media (max-width: 768px) {
    div[id*="countdown"] {
        font-size: 1.8rem !important;
        word-break: keep-all;
        white-space: nowrap;
    }

    .notification-bar {
        flex-direction: column !important;
        padding: 0.75rem 1rem !important;
    }
}

/* 22. ŚREDNIE - List items spacing */
@media (max-width: 768px) {
    ul[style*="padding: 0"] li {
        padding: 12px 0 !important;
        font-size: 0.9rem !important;
    }
}

/* 23. WYSOKIE - Sticky/Fixed elements */
@media (max-width: 768px) {
    .navbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 1000 !important;
    }
}

/* 24. KRYTYCZNE - O-mnie hero grid & Contact page grid */
@media (max-width: 968px) {
    section[style*="grid-template-columns"] {
        display: block !important;
    }

    section[style*="grid-template-columns"] > div {
        margin-bottom: 2rem;
    }

    /* Kontakt strona - odwróć kolejność: najpierw tekst, potem zdjęcie */
    section[style*="background: #FFFAF6"] > div > div {
        display: flex;
        flex-direction: column-reverse;
    }
}

/* 25. NISKIE - Smooth scrolling */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* 26. WYSOKIE - Inline padding fixes */
@media (max-width: 768px) {
    div[style*="padding: 20px"] {
        padding: 1rem !important;
    }

    div[style*="padding: 30px"] {
        padding: 1.25rem !important;
    }
}

/* 27. ŚREDNIE - Border radius reduction */
@media (max-width: 768px) {
    div[style*="border-radius: 30px"],
    div[style*="border-radius: 50px"] {
        border-radius: 15px !important;
    }
}

/* 28. WYSOKIE - Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    section[style*="min-height"] {
        min-height: 100vh !important;
    }
}

/* 29. KRYTYCZNE - Prevent text overflow */
@media (max-width: 768px) {
    p, li, span, div {
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
}

/* 30. NISKIE - Animation performance */
@media (max-width: 768px) {
    * {
        transition-duration: 0.2s !important;
    }

    @keyframes gentleShake {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(-2px); }
    }
}
