/* Font Loading and Display Optimization */
/* Font fallbacks handled in font-family declarations */

/* Font Loading Fallbacks */
.font-loading body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Arabic Font Optimization */
html[lang="ar"] * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* English Font Optimization */
html[lang="en"] * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Force font loading for critical text */
.hero-title,
.section-title,
.navbar-brand {
    font-display: block;
}

/* Responsive Media Queries for X-Elevator Landing Page */

/* Extra Small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .cta-button {
        padding: 12px 30px;
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .feature-card,
    .use-case-card,
    .testimonial-card,
    .download-card {
        margin-bottom: 20px;
    }

    .language-switcher {
        top: 10px;
        right: 10px;
        font-size: 0.85rem;
    }

    .sticky-cta {
        bottom: 15px;
        right: 15px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    [dir="rtl"] .language-switcher {
        right: auto;
        left: 10px;
    }

    [dir="rtl"] .sticky-cta {
        right: auto;
        left: 15px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .container {
        max-width: 540px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 2.3rem;
    }

    .feature-card,
    .use-case-card {
        height: 280px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .testimonial-card {
        height: 200px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .hero-title {
        font-size: 3.2rem;
    }

    .section-title {
        font-size: 2.4rem;
    }

    .feature-card,
    .use-case-card {
        height: 300px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .hero-title {
        font-size: 3.5rem;
    }

    .container {
        max-width: 1140px;
    }

    .feature-card,
    .use-case-card {
        height: 320px;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 100vh;
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .scroll-icon {
        display: none;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .feature-icon,
    .download-icon {
        transform: scale(0.9);
    }

    .hero-section::before {
        background-size: 2000px 2000px;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {

    .feature-card:hover,
    .use-case-card:hover,
    .testimonial-card:hover {
        transform: none;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    }

    .cta-button:hover,
    .sticky-cta:hover {
        transform: none;
    }

    /* Larger touch targets */
    .cta-button,
    .sticky-cta,
    .lang-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Print styles */
@media print {
    * {
        color: black !important;
        background: white !important;
    }

    .hero-section {
        background: white !important;
        color: black !important;
        min-height: auto !important;
        padding: 2rem 0 !important;
    }

    .hero-title,
    .section-title {
        color: black !important;
        page-break-after: avoid;
    }

    .feature-card,
    .use-case-card,
    .testimonial-card {
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
        margin-bottom: 1rem !important;
    }

    .modal,
    .language-switcher,
    .sticky-cta,
    .scroll-to-top,
    .video-section,
    .btn,
    .social-icons {
        display: none !important;
    }

    .section-padding {
        padding: 1rem 0 !important;
    }

    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }

    .footer {
        background: white !important;
        color: black !important;
        border-top: 1px solid #ccc !important;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .scroll-icon {
        animation: none !important;
    }

    .particle {
        animation: none !important;
        opacity: 0.3;
    }

    .hero-section::before {
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #003d82;
        --accent-color: #cc5500;
        --dark-color: #000000;
        --light-color: #ffffff;
    }

    .feature-card,
    .use-case-card,
    .testimonial-card,
    .download-card {
        border: 2px solid var(--dark-color) !important;
    }

    .btn {
        border: 2px solid !important;
    }

    .hero-section {
        background: var(--primary-color) !important;
    }

    .section-title::after {
        background: var(--dark-color) !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-bg: #2d2d2d;
        --border-color: #404040;
    }

    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }

    .feature-card,
    .use-case-card,
    .testimonial-card,
    .download-card {
        background: var(--card-bg);
        color: var(--text-color);
        border: 1px solid var(--border-color);
    }

    .modal-content {
        background: var(--card-bg);
        color: var(--text-color);
        border: 1px solid var(--border-color);
    }

    .form-control {
        background: var(--card-bg);
        color: var(--text-color);
        border-color: var(--border-color);
    }

    .accordion-button {
        background: var(--card-bg);
        color: var(--text-color);
        border-color: var(--border-color);
    }

    .language-switcher {
        background: rgba(45, 45, 45, 0.9);
    }

    .video-section,
    .faq-section {
        background: #2a2a2a !important;
    }
}

/* Custom scrollbar */
@media (min-width: 768px) {
    ::-webkit-scrollbar {
        width: 8px;
    }

    ::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 4px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--accent-color);
    }

    @media (prefers-color-scheme: dark) {
        ::-webkit-scrollbar-track {
            background: #333;
        }
    }
}

/* Focus styles for accessibility */
button:focus,
.btn:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Error states */
.error-state {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success states */
.success-state {
    border-color: #28a745;
    background-color: #f8fff9;
}

.success-message {
    color: #28a745;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}