/**
 * Chofli Platform - Critical Icons Fix
 * This file ensures Font Awesome icons work properly
 */

/* CRITICAL: Import Font Awesome with multiple fallbacks */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');
@import url('https://use.fontawesome.com/releases/v6.4.0/css/all.css');
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');

/* Force Font Awesome font loading */
@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff2') format('woff2'),
         url('https://use.fontawesome.com/releases/v6.4.0/webfonts/fa-solid-900.woff2') format('woff2'),
         url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-solid-900.woff') format('woff');
}

@font-face {
    font-family: 'Font Awesome 6 Free';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-regular-400.woff2') format('woff2'),
         url('https://use.fontawesome.com/releases/v6.4.0/webfonts/fa-regular-400.woff2') format('woff2'),
         url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-regular-400.woff') format('woff');
}

@font-face {
    font-family: 'Font Awesome 6 Brands';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-brands-400.woff2') format('woff2'),
         url('https://use.fontawesome.com/releases/v6.4.0/webfonts/fa-brands-400.woff2') format('woff2'),
         url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/webfonts/fa-brands-400.woff') format('woff');
}

/* CRITICAL: Force all Font Awesome classes to work */
.fas, .fa-solid, .fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", sans-serif !important;
    font-weight: 900 !important;
    font-style: normal !important;
    display: inline-block !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
}

.far, .fa-regular {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", sans-serif !important;
    font-weight: 400 !important;
    font-style: normal !important;
    display: inline-block !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
}

.fab, .fa-brands {
    font-family: "Font Awesome 6 Brands", "Font Awesome 5 Brands", "FontAwesome", sans-serif !important;
    font-weight: 400 !important;
    font-style: normal !important;
    display: inline-block !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
}

/* Force all i elements with fa classes */
i[class*="fa"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome", sans-serif !important;
    font-weight: 900 !important;
    font-style: normal !important;
    display: inline-block !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
}

/* Specific icon fixes for Arabic RTL */
.icon-fix {
    margin-right: 0 !important;
    margin-left: 3px !important;
    display: inline-block !important;
    font-style: normal !important;
}

/* Property icons specific spacing */
.property-icon {
    margin-right: 0 !important;
    margin-left: 5px !important;
    color: #6b7280 !important;
    font-size: 0.875rem !important;
}

/* Service icons specific */
.service-icon {
    color: inherit !important;
    font-size: 1em !important;
    margin: 0 !important;
}

/* Search icon specific */
.search-icon {
    margin-right: 0 !important;
    margin-left: 8px !important;
}

/* Navigation icons */
nav i[class*="fa"] {
    margin-right: 0 !important;
    margin-left: 5px !important;
}

/* Button icons */
button i[class*="fa"], 
a i[class*="fa"] {
    margin-right: 0 !important;
    margin-left: 3px !important;
}

/* Force visibility for all icons */
i[class*="fa"]:before {
    display: inline-block !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    content: attr(data-icon) !important;
}

/* Fallback: If Font Awesome fails, use Unicode symbols */
.fa-home:before { content: "🏠" !important; }
.fa-search:before { content: "🔍" !important; }
.fa-heart:before { content: "❤️" !important; }
.fa-star:before { content: "⭐" !important; }
.fa-phone:before { content: "📞" !important; }
.fa-envelope:before { content: "✉️" !important; }
.fa-map-marker-alt:before { content: "📍" !important; }
.fa-calendar:before, .fa-calendar-check:before { content: "📅" !important; }
.fa-clock:before { content: "🕐" !important; }
.fa-user:before { content: "👤" !important; }
.fa-users:before { content: "👥" !important; }
.fa-check:before, .fa-check-circle:before { content: "✓" !important; }
.fa-times:before, .fa-times-circle:before { content: "✗" !important; }
.fa-plus:before { content: "+" !important; }
.fa-minus:before { content: "-" !important; }
.fa-edit:before { content: "✏️" !important; }
.fa-trash:before { content: "🗑️" !important; }
.fa-download:before { content: "⬇️" !important; }
.fa-upload:before { content: "⬆️" !important; }
.fa-share:before { content: "📤" !important; }
.fa-print:before { content: "🖨️" !important; }
.fa-save:before { content: "💾" !important; }
.fa-copy:before { content: "📋" !important; }
.fa-cut:before { content: "✂️" !important; }
.fa-paste:before { content: "📋" !important; }
.fa-undo:before { content: "↶" !important; }
.fa-redo:before { content: "↷" !important; }
.fa-comments:before { content: "💬" !important; }
.fa-comment:before { content: "💬" !important; }
.fa-balance-scale:before { content: "⚖️" !important; }
.fa-shield-alt:before { content: "🛡️" !important; }
.fa-arrow-right:before { content: "→" !important; }
.fa-arrow-left:before { content: "←" !important; }
.fa-arrow-up:before { content: "↑" !important; }
.fa-arrow-down:before { content: "↓" !important; }
.fa-exclamation-circle:before { content: "⚠️" !important; }
.fa-info-circle:before { content: "ℹ️" !important; }
.fa-question-circle:before { content: "❓" !important; }
.fa-cog:before, .fa-settings:before { content: "⚙️" !important; }
.fa-bars:before { content: "☰" !important; }
.fa-list:before { content: "📋" !important; }
.fa-th:before { content: "▦" !important; }
.fa-th-large:before { content: "▦" !important; }
.fa-grid:before { content: "▦" !important; }
.fa-calculator:before { content: "🧮" !important; }
.fa-paper-plane:before { content: "✈️" !important; }

/* Social media icons */
.fa-facebook:before { content: "📘" !important; }
.fa-twitter:before { content: "🐦" !important; }
.fa-instagram:before { content: "📷" !important; }
.fa-linkedin:before { content: "💼" !important; }
.fa-youtube:before { content: "📺" !important; }
.fa-whatsapp:before { content: "💚" !important; }

/* Ensure icons are always visible */
i[class*="fa"] {
    min-width: 1em !important;
    text-align: center !important;
}

/* Force redraw on load */
@keyframes iconFix {
    0% { opacity: 0.99; }
    100% { opacity: 1; }
}

i[class*="fa"] {
    animation: iconFix 0.1s ease-in-out !important;
}

/* Media queries for responsive icons */
@media (max-width: 768px) {
    i[class*="fa"] {
        font-size: 0.9em !important;
    }
    
    .icon-fix {
        margin-left: 2px !important;
    }
}

/* Print styles */
@media print {
    i[class*="fa"]:before {
        content: "" !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    i[class*="fa"] {
        font-weight: 900 !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    i[class*="fa"] {
        animation: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    i[class*="fa"] {
        color: inherit !important;
    }
}
