/* Universal Fixes for Cross-Device Compatibility */

/* Reset and base styles */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Prevent horizontal scrolling everywhere */
body, html {
    overflow-x: hidden !important;
    max-width: 100vw;
}

/* Ensure proper scrolling */
.scrollable {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* iOS smooth scrolling */
}

/* Fix for viewport issues on mobile */
@viewport {
    width: device-width;
}

/* Cross-browser fixes */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 0; /* Reset iOS styling */
}

/* Prevent iOS zoom on input focus */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    font-size: 16px !important;
}

/* Fix for older Android browsers */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Ensure buttons work on all devices */
button, .btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: pointer;
}

/* Fix for Safari iOS */
.container, .chat-container, .main-chat {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Universal responsive breakpoints */
@media screen and (max-width: 1024px) {
    .hide-on-tablet {
        display: none !important;
    }
    
    .full-width-on-tablet {
        width: 100% !important;
    }
}

@media screen and (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    
    .full-width-on-mobile {
        width: 100% !important;
    }
    
    /* Stack elements on mobile */
    .flex-desktop {
        flex-direction: column !important;
    }
    
    /* Ensure text is readable */
    body {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
}

@media screen and (max-width: 480px) {
    /* Extra small devices */
    .container {
        padding: 10px !important;
        margin: 5px !important;
    }
    
    h1 {
        font-size: 1.8em !important;
    }
    
    h2 {
        font-size: 1.5em !important;
    }
}

/* Print styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid #000;
    }
}

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

/* Fix for older browsers */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Ensure images don't break layout */
img {
    max-width: 100%;
    height: auto;
}

/* Fix for IE11 and older */
.flex-container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.flex-item {
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
} 