/* START OF FILE cv.css */
/* متغيرات الألوان والأبعاد */
:root {
    --primary-color: #2563eb; /* أزرق */
    --secondary-color: #4b5563; /* رمادي أغمق للنصوص الرئيسية */
    --text-muted-color: #6b7280; /* رمادي للنصوص الفرعية */
    --header-bg: linear-gradient(90deg, #2563eb 0%, #3b82f6 100%); /* تدرج أزرق للرأس */
    --footer-bg: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%); /* تدرج أزرق للتذييل */
    --header-height: 35px; /* ارتفاع أقل قليلاً */
    --footer-height: 28px; /* ارتفاع أقل قليلاً */
    --section-padding-y: 1.5rem; /* تقليل padding لضغط المحتوى قليلاً */
    --container-padding-x: 1.5rem;
}

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

/* إعدادات الصفحة للطباعة الأصلية من المتصفح */
@page {
    size: A4;
    margin: 0; /* يتم التحكم بالهوامش عبر العناصر المؤقتة في html2pdf */

    /* هذه لطباعة المتصفح، html2pdf لا يستخدمها مباشرة */
    /* @top-center {
        content: element(cvPageHeaderPrint);
        padding-top: 10mm;
    }
    @bottom-center {
        content: "Page " counter(page) " of " counter(pages);
        font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        font-size: 0.8rem;
        color: var(--text-muted-color);
        padding-bottom: 10mm;
        vertical-align: bottom;
    } */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--secondary-color);
    background: #f9fafb; /* خلفية رمادية فاتحة جداً للجسم */
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* --- Screen Fixed Header/Footer --- */
/* هذه تظهر على الشاشة فقط، ويتم إخفاؤها عند تصدير PDF */
.cv-header, .cv-footer {
    position: fixed;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 var(--container-padding-x);
    color: white;
    font-size: 0.85em;
    box-sizing: border-box;
}

.cv-header {
    top: 0;
    height: var(--header-height);
    background: var(--header-bg);
    justify-content: space-between;
}

.cv-footer {
    bottom: 0;
    height: var(--footer-height);
    background: var(--footer-bg);
    justify-content: flex-end;
}
.cv-footer .cv-page-number { /* هذا حالياً فارغ، قد يستخدم لشيء آخر */
    font-size: 0.9em;
}

/* --- Container & PDF Export specific styles --- */
.container {
    max-width: 210mm; /* A4 width */
    margin: 0 auto;
    padding: var(--section-padding-y) var(--container-padding-x);
    background: #fff;
    position: relative;
    box-shadow: 0 0 15px rgba(0,0,0,0.05); /* ظل خفيف للحاوية على الشاشة */
}

/* تعديل padding للحاوية على الشاشة لاستيعاب الرأس/التذييل المثبتين */
body:not(.pdf-export) .container {
    padding-top: calc(var(--header-height) + var(--section-padding-y));
    padding-bottom: calc(var(--footer-height) + var(--section-padding-y));
}

/* عند تصدير PDF، يتم إخفاء الرأس/التذييل المثبتين الأصليين */
body.pdf-export > .cv-header,
body.pdf-export > .cv-footer {
    display: none !important;
}

/* عند تصدير PDF، لا تحتاج الحاوية لـ padding إضافي لأن الرأس/التذييل المؤقتين داخلها */
body.pdf-export .container {
    padding-top: 0;
    padding-bottom: 0;
    box-shadow: none; /* لا ظل في الـ PDF */
}

/* --- Temporary Header/Footer for PDF (cloned by JS) --- */
.pdf-temp-header, .pdf-temp-footer {
    display: flex;
    align-items: center;
    color: white; /* أو حسب التصميم */
    padding: 0.5em 1em;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.85em;
}
.pdf-temp-header {
    background: var(--header-bg);
    height: var(--header-height);
    justify-content: space-between;
    margin-bottom: var(--section-padding-y); /* مسافة قبل المحتوى الرئيسي */
}
.pdf-temp-footer {
    background: var(--footer-bg);
    height: var(--footer-height);
    justify-content: flex-end; /* سيتم إضافة ترقيم الصفحات بواسطة jsPDF مباشرة */
    margin-top: var(--section-padding-y); /* مسافة بعد المحتوى الرئيسي */
}
.pdf-temp-footer .cv-page-number {
    /* إذا كنت ستضع نصاً ثابتاً هنا، قم بتصميمه */
    /* إذا كان jsPDF سيرسم أرقام الصفحات، يمكن إخفاء هذا أو تركه فارغاً */
    display: none; /* الأفضل إخفاؤه لأن jsPDF سيضيف الترقيم */
}


/* --- Main Header (Name, Title, Contact) --- */
/* هذا هو الـ <header> داخل .container */
header {
    text-align: center;
    margin-bottom: 1.5rem; /* تقليل المسافة */
    padding: 1.5rem 0;
    border-bottom: 2px solid var(--primary-color);
    /* position: running(cvPageHeaderPrint); /* لطباعة المتصفح الأصلية إذا أردت استخدام هذا الهيدر */
}

h1 {
    font-size: 2.2rem; /* تقليل حجم الخط قليلاً */
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.contact-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem; /* تقليل الفجوة */
    margin-top: 1rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}
.contact-item a {
    color: var(--primary-color);
    text-decoration: none;
}
.contact-item a:hover {
    text-decoration: underline;
}
.contact-item i {
    color: var(--primary-color);
}

/* --- Section Styles --- */
.section {
    margin-bottom: 1.5rem; /* تقليل المسافة */
    padding-top: var(--section-padding-y);
    padding-bottom: var(--section-padding-y);
}
.section:first-of-type {
    padding-top: 0; /* أول قسم بعد الهيدر الرئيسي لا يحتاج padding علوي كبير */
}

.section-title {
    font-size: 1.15rem; /* تعديل طفيف */
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.4rem;
    border-bottom: 1.5px solid var(--primary-color);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.experience-item, .education-item {
    margin-bottom: 1.2rem;
}

.experience-title, .education-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--secondary-color); /* تغيير لون العنوان لتمييزه أكثر */
    margin-bottom: 0.2rem;
}

.experience-company, .education-school {
    color: var(--primary-color); /* جعل اسم الشركة/المدرسة بارزاً */
    font-style: normal;
    font-weight: 500;
}

.experience-date, .education-date {
    color: var(--text-muted-color);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

ul {
    list-style-position: outside;
    padding-left: 1.2em; /* لضمان ظهور النقاط بشكل جيد */
}
li {
    margin-bottom: 0.3rem;
}


/* --- Skills List Simple --- */
.skills-list-simple {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem; /* row-gap column-gap */
    margin-top: 1rem;
    margin-bottom: 1rem;
}
.skill-group {
    min-width: 170px; /* تقليل العرض الأدنى */
    margin-bottom: 0.3rem;
}
.skill-level-title {
    color: var(--primary-color);
    font-size: 1rem; /* تعديل حجم الخط */
    font-weight: 600;
    margin-bottom: 0.6rem; /* زيادة المسافة قليلاً */
    letter-spacing: 0.01em;
    border-bottom: 1px dashed #ddd; /* خط سفلي خفيف */
    padding-bottom: 0.3rem;
}
.skill-group ul {
    list-style-type: none; /* إزالة النقاط الافتراضية */
    margin-left: 0;
    padding-left: 0;
}
.skill-group ul li {
    font-size: 0.95rem;
    color: var(--secondary-color);
    margin-bottom: 0.3rem;
    font-weight: 400;
    position: relative;
    padding-left: 1.1em; /* مسافة للأيقونة */
}
.skill-group ul li::before { /* إضافة أيقونة مخصصة */
    content: '\f00c'; /* FontAwesome check icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 1px;
    font-size: 0.8em;
}


.languages {
    display: flex;
    gap: 2rem;
    justify-content: flex-start; /* محاذاة لليسار لتتناسق مع باقي العناوين */
    margin-top: 1rem;
}

.language-item {
    text-align: left;
}
.language-item div:first-child {
    font-weight: 500;
}
.language-level {
    font-size: 0.9rem;
    color: var(--text-muted-color);
}

/* --- Print Button Styles --- */
.print-button {
    position: fixed;
    top: calc(var(--header-height) + 20px); /* تحت الهيدر المثبت */
    right: 20px;
    padding: 10px 18px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1001; /* فوق الهيدر المثبت */
    transition: background-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.print-button:hover {
    background-color: #1d4ed8; /* أزرق أغمق عند التحويم */
}
body.pdf-export .print-button { /* إخفاء الزر أثناء عملية التصدير الفعلية */
    display: none !important;
}

.print-button.lang-switch-button {
    /* Same as print-button, but can be customized if needed */
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 1rem;
    padding: 10px 18px;
    position: fixed;
    /* top, left/right set by JS */
}

.print-button, .print-button.lang-switch-button {
    width: 100px;
    justify-content: center;
    direction: ltr;
}

.footer-lang-switch {
    background: none !important;
    color: #fff !important;
    border: none !important;
    font-size: 1rem;
    cursor: pointer;
    margin: 0 0.5em;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: none !important;
    direction: ltr;
}

/* --- Print Styles (Native Browser Print) --- */
@media print {
    body {
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 10pt; /* حجم خط مناسب للطباعة */
    }
    .container {
        box-shadow: none;
        padding: 10mm var(--container-padding-x); /* هوامش فعلية للطباعة */
        width: 210mm;
        margin: 0 auto;
    }

    .print-button, .cv-header, .cv-footer { /* إخفاء العناصر غير المرغوبة في الطباعة الأصلية */
        display: none !important;
    }

    .lang-switch-button {
        display: none !important;
    }

    .section {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }
    header { /* الهيدر الرئيسي داخل container */
        padding: 1rem 0;
        margin-bottom: 1rem;
    }
    h1 { font-size: 1.8rem; }
    .subtitle { font-size: 1rem; }
    .section-title { font-size: 1.1rem; }
    .experience-title, .education-title { font-size: 1rem; }

    /* هنا يمكن استخدام @page rules إذا أردت رأس وتذييل مخصصين للطباعة الأصلية */
    .skills-list-simple {
      display: flex !important;
      flex-wrap: wrap !important;
      gap: 1.5rem 2.5rem !important;
    }
    .skill-group {
      min-width: 170px !important;
    }
}

.keep-together {
  page-break-inside: avoid;
  break-inside: avoid;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    body:not(.pdf-export) .container { /* تعديل ليتناسب مع الشاشات الصغيرة والهيدر الفوتر المثبت */
        padding-top: calc(var(--header-height) + 1rem);
        padding-bottom: calc(var(--footer-height) + 1rem);
    }

    .contact-info {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
    .print-button {
        top: calc(var(--header-height) + 10px);
        right: 10px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    .skills-list-simple {
        gap: 1rem; /* تقليل الفجوة في الشاشات الصغيرة */
    }
    .skill-group {
        min-width: 100%; /* كل مجموعة مهارات تأخذ عرض كامل */
    }
}
/* END OF FILE cv.css */