/* =========================================
   CRITICAL FIXES FOR ALL DEVICES
   ========================================= */

/* Fix iOS Safari Issues */
@supports (-webkit-touch-callout: none) {
    /* iOS specific fixes */
    body {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix iOS input zoom */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Fix position fixed issues */
    .navbar {
        position: -webkit-sticky;
        position: sticky;
    }
}

/* Android Chrome Fixes */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    /* Prevent text size adjustment */
    body {
        text-size-adjust: none;
        -webkit-text-size-adjust: none;
    }
}

/* Samsung Internet Browser Fixes */
@supports (-webkit-appearance:none) and (stroke-color:transparent) {
    .navbar {
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* Windows Specific Fixes */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* IE 11 specific fixes */
    .services-grid,
    .pricing-grid {
        display: -ms-grid;
        display: grid;
    }
}

/* Edge Browser Fixes */
@supports (-ms-ime-align:auto) {
    .container {
        max-width: 100%;
        width: 100%;
    }
}

/* Firefox Specific */
@-moz-document url-prefix() {
    /* Firefox scrollbar */
    * {
        scrollbar-width: thin;
        scrollbar-color: rgba(0,0,0,0.3) transparent;
    }
}

/* Global Mobile Fixes */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Fix containers */
    .container,
    section,
    .nav-container {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Fix images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Fix modals */
    .modal,
    .modal-content {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Fix tables */
    table {
        display: block;
        overflow-x: auto;
        max-width: 100%;
    }

    /* Fix pre and code blocks */
    pre, code {
        overflow-x: auto;
        max-width: 100%;
        word-wrap: break-word;
    }
}

/* Tablet Specific Fixes */
@media (min-width: 768px) and (max-width: 1024px) {
    /* iPad specific */
    @supports (-webkit-touch-callout: none) {
        .navbar {
            position: -webkit-sticky;
            position: sticky;
        }
    }

    /* Grid adjustments */
    .services-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Desktop/Laptop Fixes */
@media (min-width: 1024px) {
    /* Scrollbar styling for desktop */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: rgba(0,0,0,0.05);
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.2);
        border-radius: 5px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(0,0,0,0.3);
    }
}

/* High DPI Screen Fixes */
@media
(-webkit-min-device-pixel-ratio: 2),
(min--moz-device-pixel-ratio: 2),
(-o-min-device-pixel-ratio: 2/1),
(min-device-pixel-ratio: 2),
(min-resolution: 192dpi),
(min-resolution: 2dppx) {
    /* Ensure sharp images */
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }

    /* Thin borders for retina */
    * {
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
}

/* Orientation Change Fixes */
@media (orientation: landscape) and (max-height: 500px) {
    /* Mobile landscape adjustments */
    .hero {
        min-height: 100vh;
        padding-top: 60px;
    }

    .navbar {
        height: 50px !important;
    }

    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover,
    .pricing-card:hover,
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: none !important;
        box-shadow: none !important;
    }

    /* Increase touch targets */
    button, a, .clickable {
        min-height: 44px;
        min-width: 44px;
        padding: 12px;
    }
}

/* Print Styles */
@media print {
    /* Hide unnecessary elements */
    .navbar,
    .footer,
    .modal,
    .hamburger,
    .chat-widget,
    .video-container,
    .back-to-top {
        display: none !important;
    }

    /* Optimize for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black !important;
        background: white !important;
    }

    .container {
        width: 100%;
        max-width: none;
    }

    /* Ensure content breaks properly */
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    img {
        page-break-inside: avoid;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Auto dark mode support */
    :root {
        --bg-primary: #1a1a1a;
        --text-primary: #f0f0f0;
    }
}

/* Final Global Fixes */
* {
    /* Prevent text selection issues */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;

    /* Smooth rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Social Media Icons - Black Theme Override */
.social-link {
    border: 2px solid #000000 !important;
}

.social-link i {
    color: #000000 !important;
}

.social-link:hover {
    background: #000000 !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
}

.social-link:hover i {
    color: #FFFFFF !important;
}

/* Wellness Match Question - Black Text Override */
#question-title,
.question-content h3 {
    color: #000000 !important;
}

.option-btn {
    color: #000000 !important;
}

.option-btn:hover {
    color: #000000 !important;
}

/* Footer Social Icons - Force Visibility Override */
.footer-section .social-icons {
    display: flex !important;
    gap: 15px !important;
    justify-content: center !important;
    margin-top: 20px !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999 !important;
    position: relative !important;
}

.footer-section .social-icons a {
    text-decoration: none !important;
    font-size: 28px !important;
    color: #8B7355 !important;
    transition: color 0.3s ease !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1000 !important;
    position: relative !important;
    background: none !important;
    border: none !important;
    width: auto !important;
    height: auto !important;
    padding: 5px !important;
}

.footer-section .social-icons a i {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-family: "Font Awesome 6 Brands" !important;
    color: inherit !important;
}

.footer-section .social-icons a:hover {
    color: #FFD700 !important;
}

.footer-section .social-icons a.facebook:hover {
    color: #1877f2 !important;
}

.footer-section .social-icons a.instagram:hover {
    color: #e1306c !important;
}

.footer-section .social-icons a.linkedin:hover {
    color: #0077b5 !important;
}

.footer-section .social-icons a.youtube:hover {
    color: #ff0000 !important;
}

/* Override any conflicting social styles */
.social-icons {
    display: flex !important;
}

.social-icons a {
    color: #8B7355 !important;
    font-size: 28px !important;
}

/* Ensure clickable elements are accessible */
button, a, [role="button"] {
    cursor: pointer;
}

/* Fix flex and grid issues */
.services-grid,
.pricing-grid,
.merchandise-grid {
    display: -ms-grid;
    display: grid;
}

/* Fallback for older browsers */
@supports not (display: grid) {
    .services-grid,
    .pricing-grid {
        display: flex;
        flex-wrap: wrap;
    }

    .service-card,
    .pricing-card {
        flex: 1 1 300px;
        margin: 10px;
    }
}