/* Import Cairo font for Arabic */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

/* Arabic and RTL font styling */
[dir="rtl"] {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: right;
}

[dir="rtl"] * {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Loading state */
body:not(.loaded) {
    opacity: 0;
}

body.loaded {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* Touch device optimizations */
.touch-device button,
.touch-device a[class*="bg-"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Enhanced language dropdown animation */
.lang-dropdown-content {
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.lang-dropdown-content:not(.hidden) {
    transform: translateY(0);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #008b2c;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00a632;
}

/* Print styles */
@media print {
    .fixed,
    .absolute {
        position: static !important;
    }
    
    .no-print {
        display: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-white\/5 {
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
}

/* 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;
        scroll-behavior: auto !important;
    }
}

/* Focus styles for accessibility */
:focus-visible {
    outline: 2px solid #008b2c;
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #008b2c;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Custom utilities that extend Tailwind */
.gradient-text {
    background: linear-gradient(45deg, #008b2c, #00a632);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-border {
    position: relative;
    background: linear-gradient(45deg, #008b2c, #F2CD00);
    border-radius: inherit;
    padding: 1px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 1px;
    background: inherit;
    border-radius: inherit;
    z-index: -1;
}

.border-gradient {
    border: 2px solid transparent;
    background: -webkit-linear-gradient(white, white) padding-box,
                -webkit-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: -moz-linear-gradient(white, white) padding-box,
                -moz-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, #008b2c, #F2CD00) border-box;
}

.border-gradient-rounded {
    border: 2px solid transparent;
    background: -webkit-linear-gradient(white, white) padding-box,
                -webkit-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: -moz-linear-gradient(white, white) padding-box,
                -moz-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    border-radius: 1rem;
}

.border-gradient-full {
    border: 2px solid transparent;
    background: -webkit-linear-gradient(white, white) padding-box,
                -webkit-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: -moz-linear-gradient(white, white) padding-box,
                -moz-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    border-radius: 9999px;
}

.border-gradient-glass {
    border: 2px solid transparent;
    background: -webkit-linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)) padding-box,
                -webkit-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: -moz-linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)) padding-box,
                -moz-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)) padding-box,
                linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    border-radius: 1.5rem;
}

.slider-button-transparent {
    border: 2px solid transparent;
    background: -webkit-linear-gradient(transparent, transparent) padding-box,
                -webkit-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: -moz-linear-gradient(transparent, transparent) padding-box,
                -moz-linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    background: linear-gradient(transparent, transparent) padding-box,
                linear-gradient(45deg, #008b2c, #F2CD00) border-box;
    border-radius: 1rem;
}

.glass-effect {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animation enhancements */
@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* RTL animation adjustments */
[dir="rtl"] .animate-slide-in-right {
    animation: slideInFromLeft 0.6s ease-out;
}

[dir="rtl"] .animate-slide-in-left {
    animation: slideInFromRight 0.6s ease-out;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    /* Optimize touch targets */
    button,
    a[role="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Reduce motion intensity on mobile */
    .animate-bounce-slow {
        animation-duration: 4s;
    }
    
    .animate-pulse-custom {
        animation-duration: 3s;
    }
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* GPU acceleration for smooth animations */
.gpu-accelerated {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}