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

/* Browser Compatibility Polyfills */
/* CSS Variables Fallbacks for IE11 */
:root {
    --primary-gold: #B48A34;
    --dark-gray: #3A3A3A;
    --light-gray: #f8f9fa;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* تحسينات الأداء والوصولية */
html {
    scroll-behavior: smooth;
    -webkit-scroll-behavior: smooth; /* Safari */
    -ms-scroll-behavior: smooth; /* IE/Edge */
}

/* تحسين الخطوط للقراءة */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* تحسين التباين للوصولية */
@media (prefers-contrast: high) {
    :root {
        --primary-gold: #8B6914;
        --dark-gray: #000000;
    }
}

/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box; /* Safari/Chrome */
    -moz-box-sizing: border-box; /* Firefox */
}

/* تحسين الأداء للصور */
img {
    max-width: 100%;
    height: auto;
    loading: lazy;
    -ms-interpolation-mode: bicubic; /* IE */
    image-rendering: -webkit-optimize-contrast; /* Safari */
    image-rendering: optimize-contrast; /* Standard */
}

/* تحسين الوصولية للروابط */
a:focus,
button:focus,
input:focus,
textarea:focus {
    outline: 2px solid var(--primary-gold);
    outline-offset: 2px;
}

/* إخفاء المحتوى للقارئات الشاشة فقط */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    color: #3A3A3A;
    background-color: #f8f9fa;
}

/* متغيرات الألوان */
:root {
    --primary-gold: #B48A34;
    --dark-gray: #3A3A3A;
    --light-gray: #f8f9fa;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* الحاوي الرئيسي */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    /* IE11 Flexbox fix */
    -ms-flex-direction: column;
    -webkit-flex-direction: column;
    flex-direction: column;
}

/* الهيدر */
header {
    background: var(--white);
    background: #ffffff; /* IE11 fallback */
    box-shadow: 0 2px 10px var(--shadow);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* IE11 fallback */
    -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Safari */
    -moz-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Firefox */
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.header-content {
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    justify-content: space-between;
    -webkit-justify-content: space-between; /* Safari */
    -ms-flex-pack: justify; /* IE10 */
    align-items: center;
    -webkit-align-items: center; /* Safari */
    -ms-flex-align: center; /* IE10 */
    padding: 1rem 0;
}

.logo {
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    align-items: center;
    -webkit-align-items: center; /* Safari */
    -ms-flex-align: center; /* IE10 */
    gap: 10px;
    /* IE11 gap fallback */
    margin-right: -10px;
}

.logo > * {
    margin-right: 10px;
}

.logo a {
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    align-items: center;
    -webkit-align-items: center; /* Safari */
    -ms-flex-align: center; /* IE10 */
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.3s ease;
    -webkit-transition: opacity 0.3s ease; /* Safari */
    -moz-transition: opacity 0.3s ease; /* Firefox */
    -o-transition: opacity 0.3s ease; /* Opera */
}

.logo a:hover {
    opacity: 0.8;
}

.logo img {
    height: 50px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.logo-text {
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    flex-direction: column;
    -webkit-flex-direction: column; /* Safari */
    -ms-flex-direction: column; /* IE10 */
    line-height: 1.2;
}

.logo-text > div:first-child {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-gold);
}

.logo-text > div:last-child {
    font-size: 0.8rem;
    color: #666;
    font-weight: 400;
}

/* القائمة الرئيسية */
nav ul {
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    list-style: none;
    gap: 2rem;
    /* IE11 gap fallback */
    margin-right: -2rem;
}

nav ul > li {
    margin-right: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--dark-gray);
    color: #3A3A3A; /* IE11 fallback */
    font-weight: 500;
    transition: color 0.3s ease;
    -webkit-transition: color 0.3s ease; /* Safari */
    -moz-transition: color 0.3s ease; /* Firefox */
    -o-transition: color 0.3s ease; /* Opera */
    padding: 0.5rem 1rem;
    border-radius: 5px;
    -webkit-border-radius: 5px; /* Safari */
    -moz-border-radius: 5px; /* Firefox */
}

nav a:hover,
nav a.active {
    color: var(--primary-gold);
    color: #B48A34; /* IE11 fallback */
    background-color: rgba(180, 138, 52, 0.1);
    /* IE11 rgba fallback */
    background-color: #f5f1e8;
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#19B48A34,endColorstr=#19B48A34); /* IE8-9 */
}

/* قائمة الموبايل */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-gray);
    cursor: pointer;
}

/* المحتوى الرئيسي */
main {
    margin-top: 80px;
    min-height: calc(100vh - 160px);
}

/* البانر الرئيسي */
.hero-banner {
    background: linear-gradient(rgba(58, 58, 58, 0.7), rgba(180, 138, 52, 0.7)), url('../images/hero-bg.jpg');
    /* IE9 gradient fallback */
    background: url('../images/hero-bg.jpg');
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#B33A3A3A,endColorstr=#B3B48A34); /* IE8-9 */
    background-size: cover;
    -webkit-background-size: cover; /* Safari */
    -moz-background-size: cover; /* Firefox */
    -o-background-size: cover; /* Opera */
    background-position: center;
    height: 70vh;
    /* IE fallback */
    height: 500px;
    display: flex;
    display: -webkit-flex; /* Safari */
    display: -ms-flexbox; /* IE10 */
    align-items: center;
    -webkit-align-items: center; /* Safari */
    -ms-flex-align: center; /* IE10 */
    justify-content: center;
    -webkit-justify-content: center; /* Safari */
    -ms-flex-pack: center; /* IE10 */
    text-align: center;
    color: var(--white);
    color: #ffffff; /* IE11 fallback */
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
}

/* الأزرار */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--primary-gold);
    color: var(--white);
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-gold);
    cursor: pointer;
    font-family: inherit;
}

.btn:hover {
    background-color: transparent;
    color: var(--primary-gold);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-gold);
    border: 2px solid var(--primary-gold);
}

.btn-secondary:hover {
    background-color: var(--primary-gold);
    color: var(--white);
}

/* الأقسام */
.section {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--dark-gray);
    margin-bottom: 3rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 3px;
    background-color: var(--primary-gold);
}

/* الشبكة */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* البطاقات */
.card {
    background: var(--white);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 5px 15px var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow);
}

.card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.card h3 {
    color: var(--dark-gray);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.card p {
    color: #666;
    line-height: 1.6;
}

/* النماذج */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-gray);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-gold);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

/* الفوتر */
footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--primary-gold);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.footer-section p,
.footer-section a {
    color: #ccc;
    text-decoration: none;
    line-height: 1.8;
}

.footer-section a:hover {
    color: var(--primary-gold);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #555;
    color: #999;
}

/* الاستجابة للموبايل */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    nav ul {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--white);
        flex-direction: column;
        padding: 1rem;
        box-shadow: 0 2px 10px var(--shadow);
        gap: 0.5rem;
        margin-right: 0;
        border-radius: 0 0 10px 10px;
        border-top: 3px solid var(--primary-gold);
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    nav ul > li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    nav ul.show {
        display: flex;
    }
    
    nav a {
        display: block;
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
        border-radius: 8px;
        transition: all 0.3s ease;
        border: 1px solid transparent;
    }
    
    nav a:hover,
    nav a.active {
        background-color: var(--primary-gold);
        color: var(--white);
        border-color: var(--primary-gold);
        transform: translateX(5px);
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .section {
        padding: 2rem 0;
    }
    
    .card {
        padding: 1rem;
    }
}

/* أنيميشن التحميل */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* رسائل التنبيه */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* تصحيح اتجاه أرقام الهاتف للعربية */
.phone-number,
a[href^="tel:"],
.footer-section p:has(i.fa-phone),
.contact-info .phone {
    direction: ltr;
    text-align: right;
    unicode-bidi: embed;
}

/* تصحيح عرض الأرقام في جميع أنحاء الموقع */
.phone-display {
    direction: ltr;
    display: inline-block;
    text-align: right;
    unicode-bidi: plaintext;
    font-family: 'Arial', sans-serif;
}

/* تصحيح خاص للأرقام العربية والإنجليزية */
.phone-display,
.phone-display * {
    direction: ltr !important;
    unicode-bidi: bidi-override !important;
}

/* تصحيح عرض الأرقام في الروابط */
a.phone-display {
    text-decoration: none;
}

a.phone-display:hover {
    text-decoration: underline;
}