/* Mobile-specific optimizations for QRLink pages */

/* Dubai Font Loading Optimization - Enhanced */
@import url('https://fonts.googleapis.com/css2?family=Dubai:wght@300;400;500;700&display=swap');

/* Keyframes for animations */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Accordion fallback animations */
.accordion-collapse {
    transition: all 0.35s ease;
    overflow: hidden;
}

.accordion-collapse:not(.show) {
    max-height: 0;
    opacity: 0;
}

.accordion-collapse.show {
    max-height: 2000px; /* Large enough to accommodate content */
    opacity: 1;
}

/* Ensure fonts load properly on all devices with higher specificity */
html, body {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

html *, body * {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Arabic text optimizations with higher specificity */
[lang="ar"], [dir="rtl"], .arabic-text, 
[lang="ar"] *, [dir="rtl"] *, .arabic-text * {
    font-family: 'Dubai', 'Tahoma', 'Arial Unicode MS', 'Segoe UI', sans-serif !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "liga", "kern";
    -webkit-font-feature-settings: "liga", "kern";
    -moz-font-feature-settings: "liga", "kern";
}

/* Force font loading for common elements */
h1, h2, h3, h4, h5, h6, p, span, div, a, button, input, textarea {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Ensure font loads in WebAssembly context */
.blazor-web *, 
.blazor-server *,
.blazor-prerendered *,
.qrlink-page * {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Mobile button optimizations */
.btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Specific fixes for Android button white background issue */
.btn:active, 
.btn:focus, 
.btn.active,
.btn:hover {
    background-color: inherit !important;
    border-color: inherit !important;
    color: inherit !important;
    outline: none;
}

/* Language toggle specific mobile optimizations */
.language-toggle-btn {
    /* Ensure proper touch target size */
    min-height: 44px;
    min-width: 80px;
    
    /* Disable text selection and highlight */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    
    /* Prevent zoom on double tap (iOS) */
    touch-action: manipulation;
    
    /* Smooth animations */
    transition: all 0.2s ease-in-out;
    
    /* Ensure font applies */
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

.language-toggle-btn:active {
    transform: scale(0.95);
}

/* Ensure consistent button states across mobile browsers */
.btn-outline-primary {
    background: rgba(255, 255, 255, 0.95) !important;
    border-color: #dee2e6 !important;
    color: #0d6efd !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary.active {
    background: rgba(255, 255, 255, 1) !important;
    border-color: #dee2e6 !important;
    color: #0d6efd !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
}

/* iOS Safari specific fixes */
@supports (-webkit-appearance: none) {
    .btn {
        -webkit-appearance: none;
    }
    
    .language-toggle-btn {
        -webkit-touch-callout: none;
    }
    
    /* iOS font rendering */
    * {
        -webkit-font-smoothing: antialiased;
        font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .btn:active {
        background-color: inherit !important;
    }
    
    /* Android font rendering */
    * {
        font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    }
}

/* Prevent text selection on touch elements */
.card, .alert, .language-toggle-wrapper {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for content */
.card-text, .card-title, .card-subtitle, p, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Responsive font sizes for mobile */
@media (max-width: 768px) {
    .display-6 {
        font-size: 2rem;
    }
    
    .display-7 {
        font-size: 1.75rem;
    }
    
    .language-toggle-btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        min-height: 44px;
    }
    
    /* Improve touch targets on mobile */
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem;
    }
    
    .btn-lg {
        min-height: 48px;
        padding: 1rem 2rem;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body, * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    }
}

/* Force font loading on page load */
@media all {
    body, html {
        font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    }
}

/* Specific WebAssembly font fixes */
.blazor-wasm-app *, 
.blazor-wasm-app {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}

/* Bootstrap override for font consistency */
.container *, 
.container-fluid *,
.row *,
.col *,
[class*="col-"] * {
    font-family: 'Dubai', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
}