/* =======================================
   نظام التنسيق الموحد والمتجاوب
   Unified Responsive System
   ======================================= */

/* ========== المتغيرات الأساسية ========== */
:root {
    /* الألوان الرئيسية */
    --primary-color: #BD9A68;
    --secondary-color: #202020;
    --accent-color: #F9FAF1;
    --text-color: #797978;
    --heading-color: #202020;
    --white: #FFFFFF;
    --black: #000000;

    /* الخطوط */
    --font-primary: 'Kufam', 'Cairo', 'Tajawal', sans-serif;
    --font-secondary: 'Montserrat', sans-serif;

    /* المسافات الموحدة */
    --spacing-xs: 0.25rem;  /* 4px */
    --spacing-sm: 0.5rem;   /* 8px */
    --spacing-md: 1rem;     /* 16px */
    --spacing-lg: 1.5rem;   /* 24px */
    --spacing-xl: 2rem;     /* 32px */
    --spacing-2xl: 3rem;    /* 48px */
    --spacing-3xl: 4rem;    /* 64px */
    --spacing-4xl: 6rem;    /* 96px */

    /* أحجام الخطوط المتجاوبة */
    --font-xs: clamp(0.75rem, 1.5vw, 0.875rem);
    --font-sm: clamp(0.875rem, 2vw, 1rem);
    --font-base: clamp(1rem, 2.5vw, 1.125rem);
    --font-lg: clamp(1.125rem, 3vw, 1.25rem);
    --font-xl: clamp(1.25rem, 3.5vw, 1.5rem);
    --font-2xl: clamp(1.5rem, 4vw, 2rem);
    --font-3xl: clamp(2rem, 5vw, 3rem);
    --font-4xl: clamp(2.5rem, 6vw, 4rem);
    --font-5xl: clamp(3rem, 7vw, 5rem);

    /* الحاويات */
    --container-xs: 100%;
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;

    /* الظلال */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* الانتقالات */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;

    /* الحدود */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;
}

/* ========== إعادة تعيين الأساسيات ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    overflow-x: hidden;
    direction: rtl;
}

/* ========== نظام الحاويات المتجاوب ========== */
.container {
    width: 100%;
    margin-inline: auto;
    padding-inline: var(--spacing-md);
}

@media (min-width: 640px) {
    .container {
        max-width: var(--container-sm);
        padding-inline: var(--spacing-lg);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: var(--container-md);
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: var(--container-lg);
        padding-inline: var(--spacing-xl);
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: var(--container-xl);
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: var(--container-2xl);
    }
}

/* ========== نظام الشبكة المتجاوب ========== */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

@media (min-width: 640px) {
    .sm\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .sm\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
    .md\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .md\:grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .lg\:grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1280px) {
    .xl\:grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .xl\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .xl\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
    .xl\:grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
}

/* ========== نظام Flexbox المتجاوب ========== */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-col-reverse { flex-direction: column-reverse; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.gap-xs { gap: var(--spacing-xs); }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.gap-xl { gap: var(--spacing-xl); }

/* ========== تنسيقات النصوص المتجاوبة ========== */
h1, .h1 {
    font-size: var(--font-5xl);
    font-weight: 700;
    line-height: 1.2;
    color: var(--heading-color);
    margin-bottom: var(--spacing-lg);
}

h2, .h2 {
    font-size: var(--font-4xl);
    font-weight: 600;
    line-height: 1.3;
    color: var(--heading-color);
    margin-bottom: var(--spacing-lg);
}

h3, .h3 {
    font-size: var(--font-3xl);
    font-weight: 600;
    line-height: 1.4;
    color: var(--heading-color);
    margin-bottom: var(--spacing-md);
}

h4, .h4 {
    font-size: var(--font-2xl);
    font-weight: 500;
    line-height: 1.4;
    color: var(--heading-color);
    margin-bottom: var(--spacing-md);
}

h5, .h5 {
    font-size: var(--font-xl);
    font-weight: 500;
    line-height: 1.5;
    color: var(--heading-color);
    margin-bottom: var(--spacing-sm);
}

h6, .h6 {
    font-size: var(--font-lg);
    font-weight: 500;
    line-height: 1.5;
    color: var(--heading-color);
    margin-bottom: var(--spacing-sm);
}

p {
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
}

/* ========== المكونات المتجاوبة ========== */

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-base);
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

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

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

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-lg);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-sm);
}

/* البطاقات */
.card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-body {
    padding: var(--spacing-lg);
}

.card-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* الصور المتجاوبة */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-fluid {
    width: 100%;
    height: auto;
}

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-contain {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========== أقسام الصفحة ========== */
.section {
    padding: var(--spacing-3xl) 0;
}

@media (min-width: 768px) {
    .section {
        padding: var(--spacing-4xl) 0;
    }
}

.section-sm {
    padding: var(--spacing-2xl) 0;
}

.section-lg {
    padding: var(--spacing-4xl) 0;
}

@media (min-width: 768px) {
    .section-lg {
        padding: calc(var(--spacing-4xl) * 1.5) 0;
    }
}

/* ========== القوائم المتجاوبة ========== */
.navbar {
    position: relative;
    padding: var(--spacing-md) 0;
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    z-index: 1000;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-menu {
    display: none;
}

@media (min-width: 1024px) {
    .navbar-menu {
        display: flex;
        align-items: center;
        gap: var(--spacing-xl);
    }
}

.navbar-menu-item {
    position: relative;
}

.navbar-menu-link {
    display: block;
    padding: var(--spacing-sm) 0;
    color: var(--heading-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-base);
}

.navbar-menu-link:hover {
    color: var(--primary-color);
}

/* قائمة الموبايل */
.mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
}

@media (min-width: 1024px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-base);
    z-index: 2000;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1999;
}

.mobile-menu-overlay.active {
    display: block;
}

/* ========== التذييل المتجاوب ========== */
.footer {
    background-color: var(--secondary-color);
    color: var(--white);
    padding: var(--spacing-3xl) 0 var(--spacing-xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
    margin-bottom: var(--spacing-3xl);
}

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.footer-title {
    font-size: var(--font-xl);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
}

.footer-links {
    list-style: none;
}

.footer-link {
    display: block;
    padding: var(--spacing-xs) 0;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color var(--transition-base);
}

.footer-link:hover {
    color: var(--primary-color);
}

/* ========== الأدوات المساعدة ========== */

/* المسافات */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-inline: auto; }
.my-auto { margin-block: auto; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.p-0 { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.px-sm { padding-inline: var(--spacing-sm); }
.px-md { padding-inline: var(--spacing-md); }
.px-lg { padding-inline: var(--spacing-lg); }
.px-xl { padding-inline: var(--spacing-xl); }

.py-sm { padding-block: var(--spacing-sm); }
.py-md { padding-block: var(--spacing-md); }
.py-lg { padding-block: var(--spacing-lg); }
.py-xl { padding-block: var(--spacing-xl); }

/* النصوص */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-justify { text-align: justify; }

.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-white { color: var(--white); }
.text-muted { color: var(--text-color); }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }
.font-light { font-weight: 300; }

/* الخلفيات */
.bg-primary { background-color: var(--primary-color); }
.bg-secondary { background-color: var(--secondary-color); }
.bg-white { background-color: var(--white); }
.bg-light { background-color: var(--accent-color); }

/* العرض والإخفاء */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

@media (min-width: 640px) {
    .sm\:d-none { display: none; }
    .sm\:d-block { display: block; }
    .sm\:d-flex { display: flex; }
}

@media (min-width: 768px) {
    .md\:d-none { display: none; }
    .md\:d-block { display: block; }
    .md\:d-flex { display: flex; }
}

@media (min-width: 1024px) {
    .lg\:d-none { display: none; }
    .lg\:d-block { display: block; }
    .lg\:d-flex { display: flex; }
}

/* الموضع */
.position-relative { position: relative; }
.position-absolute { position: absolute; }
.position-fixed { position: fixed; }
.position-sticky { position: sticky; }

.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }

/* التأثيرات */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

.hover\:opacity-75:hover { opacity: 0.75; }
.hover\:opacity-100:hover { opacity: 1; }

/* الحركات */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

.animate-fadeIn { animation: fadeIn 0.5s ease-in-out; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease-in-out; }
.animate-fadeInDown { animation: fadeInDown 0.5s ease-in-out; }
.animate-slideInRight { animation: slideInRight 0.5s ease-in-out; }
.animate-slideInLeft { animation: slideInLeft 0.5s ease-in-out; }

/* ========== تخصيصات RTL ========== */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .text-left {
    text-align: right;
}

[dir="rtl"] .text-right {
    text-align: left;
}

/* ========== تحسينات الأداء ========== */
.will-change-transform {
    will-change: transform;
}

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

/* ========== تحسينات الوصولية ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ========== الطباعة ========== */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }

    img, figure {
        page-break-inside: avoid;
    }
}
