/* CV Style Sheet */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Print Styles for PDF Download */
@media print {
    @page {
        size: A4 portrait;
        margin: 0;
    }
    
    /* تعديل هوامش جميع الصفحات */
    @page {
        margin: 0 !important;
    }
    
    html, body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        /* Removed unsupported color-adjust property */
        background-color: white;
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
        overflow: visible !important;
    }
    
    .cv-container {
        box-shadow: none;
        margin: 0;
        width: 100%;
        height: auto;
        display: flex !important;
        flex-direction: row !important;
        overflow: visible !important;
        page-break-after: avoid !important;
    }
    
    .left-column {
        background-color: #2d2e32 !important;
        color: white !important;
        width: 35% !important;
        padding: 30px !important;
    }
    
    .right-column {
        width: 65% !important;
        padding: 30px !important;
    }
    
    .section-title, .job-title {
        color: #ffc107 !important;
    }
    
    .left-column .section-title::after {
        background: #ffc107 !important;
    }
    
    .contact-item i, .interest-item i {
        color: #ffc107 !important;
    }
    
    /* ===== تنظيم الصفحات للطباعة ===== */
    
    /* إخفاء جميع الأقسام افتراضيًا */
    .profile-section, .contact-section, .skills-section, .interests-section,
    .education-section, .certifications-section, .experience-section, .projects-section, .languages-section {
        display: none !important;
    }
    
    /* تنظيم تدفق المحتوى */
    .cv-container {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .left-column {
        width: 35% !important;
        height: 100% !important;
        overflow: visible !important;
    }
    
    .right-column {
        width: 65% !important;
        height: 100% !important;
        overflow: visible !important;
    }
    
    /* منع فواصل الصفحات داخل الأقسام */
    .section-content {
        page-break-inside: avoid !important;
    }
    
    .timeline-item {
        page-break-inside: avoid !important;
    }
    
    /* ===== الصفحة الأولى ===== */
    /* العمود الأيسر - الصفحة 1: كل شيء ماعدا Interests */
    .left-column .profile-section,
    .left-column .contact-section,
    .left-column .skills-section {
        display: block !important;
    }
    
    /* العمود الأيمن - الصفحة 1: Profile, Education, Languages بالترتيب */
    .right-column .profile-section {
        display: block !important;
        order: 1;
    }
    
    .right-column .education-section {
        display: block !important;
        order: 2;
    }
    
    .right-column .languages-section {
        display: block !important;
        order: 3;
    }
    
    /* فاصل صفحة بعد الصفحة الأولى */
    .right-column .languages-section {
        page-break-after: always !important;
        margin-bottom: 0 !important;
    }
    
    /* ===== الصفحة الثانية ===== */
    /* العمود الأيسر - الصفحة 2: Interests فقط */
    .left-column .interests-section {
        display: block !important;
        page-break-before: always !important;
        margin-top: 20px;
    }
    
    /* العمود الأيمن - الصفحة 2: Certifications & Training فقط */
    .right-column .certifications-section {
        display: block !important;
        page-break-before: always !important;
        order: 4;
        margin-top: 20px;
    }
    
    /* فاصل صفحة بعد الصفحة الثانية */
    .right-column .certifications-section {
        page-break-after: always !important;
    }
    
    /* ===== الصفحة الثالثة ===== */
    /* العمود الأيسر - الصفحة 3: فارغ (فقط لون الخلفية) */
    .left-column .interests-section ~ * {
        display: none !important;
    }
    
    /* إضافة مساحة فارغة في الجزء الأيسر للصفحة الثالثة للحفاظ على لون الخلفية */
    .left-column::after {
        content: "";
        display: block !important;
        height: 1090px !important; /* تحديد ارتفاع كافٍ لملء الصفحة الثالثة */
        page-break-before: always !important;
        background-color: #2d2e32 !important; /* تحديد لون الخلفية بشكل صريح */
    }
    
    /* إضافة عنصر وهمي في العمود الأيسر للصفحة الثالثة لضمان ظهور لون الخلفية */
    .left-column::before {
        content: "";
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 35% !important;
        height: 100% !important;
        background-color: #2d2e32 !important;
        z-index: -1 !important;
        page-break-before: always !important;
    }
    
    /* العمود الأيمن - الصفحة 3: Experience و Projects */
    .right-column .experience-section {
        display: block !important;
        page-break-before: always !important;
        order: 5;
        margin-top: 20px;
    }
    
    .right-column .projects-section {
        display: block !important;
        order: 6;
        page-break-after: avoid !important; /* منع إضافة صفحة فارغة بعد المشاريع */
    }
    
    /* Fix for interest icons */
    .interests-list {
        display: flex !important;
        flex-wrap: wrap !important;
    }
    
    .interest-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        margin-right: 20px !important;
        margin-bottom: 15px !important;
    }
    
    /* تحديد الحد الأقصى لارتفاع الصفحة الثالثة */
    .right-column .projects-section {
        max-height: 800px !important;
        overflow: hidden !important;
    }
    
    /* ضمان ظهور لون الخلفية في الصفحة الثالثة */
    .left-column {
        min-height: 1000px !important;
        background-color: #2d2e32 !important;
    }
    
    .interest-item i {
        font-size: 20px !important;
        color: #ffc107 !important;
        margin-bottom: 5px !important;
        display: inline-block !important;
    }
    
    .interest-item p {
        font-size: 12px !important;
        color: white !important;
    }
    
    .skill-level {
        background: #ffc107 !important;
    }
    
    .section-icon {
        background: #ffc107 !important;
    }
    
    .section-icon i {
        color: #2d2e32 !important;
    }
    
    .timeline-dot {
        background: #ffc107 !important;
    }
    
    .timeline-date {
        color: #ffc107 !important;
    }
    
    /* Ensure page breaks don't occur in the middle of sections */
    .section-content {
        page-break-inside: avoid;
    }
    
    /* تحسين تنسيق الطباعة */
    .right-column .section-content {
        break-inside: avoid;
    }
    
    .right-column .section-title {
        break-after: avoid;
    }
    
    .timeline-item {
        page-break-inside: avoid;
    }
    
    /* Ensure profile image prints correctly */
    .profile-image {
        border: 5px solid #ffc107 !important;
        print-color-adjust: exact;
    }
    
    .profile-image img {
        max-width: 100%;
        height: auto;
    }
    
    /* Ensure skill bars print correctly */
    .skill-bar {
        background: rgba(255, 255, 255, 0.2) !important;
    }
    
    /* Hide download button when printing */
    .download-button-container {
        display: none !important;
    }
}

/* CV Container */
.cv-container {
    display: flex;
    max-width: 1000px;
    margin: 20px auto;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Left Column Styles */
.left-column {
    width: 35%;
    background-color: #2d2e32;
    color: white;
    padding: 30px;
}

.profile-section {
    text-align: center;
    margin-bottom: 30px;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 20px;
    border: 5px solid #ffc107;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.job-title {
    font-size: 16px;
    font-weight: 500;
    color: #ffc107;
    margin-bottom: 15px;
}

.section-title {
    position: relative;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    color: #ffc107;
}

.left-column .section-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background: #ffc107;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.contact-item i {
    width: 25px;
    margin-right: 10px;
    color: #ffc107;
}

.contact-item p {
    font-size: 14px;
}

.skills-section {
    margin-bottom: 30px;
}

.skill-item {
    margin-bottom: 15px;
}

.skill-item p {
    margin-bottom: 5px;
    font-size: 14px;
}

.skill-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.skill-level {
    height: 100%;
    background: #ffc107;
    border-radius: 4px;
}

.interests-section {
    margin-bottom: 30px;
}

.interests-list {
    display: flex;
    flex-wrap: wrap;
}

.interest-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 20px;
    margin-bottom: 15px;
}

.interest-item i {
    font-size: 20px;
    color: #ffc107;
    margin-bottom: 5px;
}

.interest-item p {
    font-size: 12px;
}

/* Right Column Styles */
.right-column {
    width: 65%;
    padding: 30px;
}

.right-column .section-title {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    color: #333;
}

.section-icon {
    width: 40px;
    height: 40px;
    background: #ffc107;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.section-icon i {
    color: #2d2e32;
    font-size: 18px;
}

.right-column .section-content {
    margin-bottom: 30px;
}

.right-column p {
    margin-bottom: 10px;
    text-align: justify;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
    margin-bottom: 20px;
}

.timeline-dot {
    position: absolute;
    left: 0;
    top: 5px;
    width: 12px;
    height: 12px;
    background: #ffc107;
    border-radius: 50%;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 17px;
    width: 2px;
    height: calc(100% + 10px);
    background: rgba(0, 0, 0, 0.1);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.timeline-content h5 {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-bottom: 5px;
}

.timeline-date {
    font-size: 13px;
    color: #ffc107;
    font-weight: 500;
    margin-bottom: 5px;
}

.project-item {
    margin-bottom: 15px;
}

.project-item h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.language-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.language-item h4 {
    font-size: 16px;
    font-weight: 600;
}

/* Download Button Styles */
.download-button-container {
    display: flex;
    justify-content: center;
    padding: 15px 0;
    background-color: #f5f5f5;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffc107;
    color: #2d2e32;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.download-btn i {
    margin-right: 8px;
}

.download-btn:hover {
    background-color: #e0a800;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hide download button when printing */
@media print {
    .download-button-container {
        display: none;
    }
    
    /* تحسين تنسيق الطباعة */
    html, body {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .cv-container {
        flex-direction: column;
    }
    
    .left-column, .right-column {
        width: 100%;
    }
}

/* تحسينات إضافية للطباعة */
@page {
    size: A4 portrait;
    margin: 10mm 0 10mm 0; /* هوامش بسيطة أعلى وأسفل الصفحات */
}

/* تحديد عدد الصفحات المطلوبة فقط */
@media print {
    .cv-container::after {
        content: "";
        display: block;
        height: 0;
        page-break-after: avoid !important;
    }
}

@media print {
    body {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #fff;
    }
    
    .cv-container {
        width: 100%;
        height: auto;
        margin: 0;
        padding: 0;
        box-shadow: none;
    }
    
    /* منع إنشاء صفحة رابعة فارغة */
    body::after {
        content: "";
        display: block;
        height: 0;
        page-break-after: avoid !important;
    }
    
    /* تحديد عدد الصفحات بدقة */
    
    /* تحسين ظهور لون الخلفية في الصفحة الثالثة */
    .cv-container {
        break-inside: avoid !important;
    }
    
    /* ضمان استمرار لون الخلفية في الصفحة الثالثة */
    .left-column {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        /* Removed unsupported color-adjust property */
    }
}