/* Reset et styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
  --pcolor: #1D6F42;
  --pcolorop: #d1dbe8;
  --linkcolor: #1D6F42;
  --blackcolor: #000;
  --bgblock: #f5f6f7;
  --bglight: #fff;
  --bg: #f4f8fb;
  
}



body {
    background: var(--bg);
    min-height: 100vh;
    padding: 0;
    direction: ltr;
    margin: 0;
}

/* Barre de contrôle */
.control-bar {
    background: white;
    border-radius: 0;
    padding: 0px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  height: 50px;
  width: 100%;
  background: #fff;
  z-index: 9;
  -webkit-box-shadow: 0 0 7px rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 0 7px rgba(0, 0, 0, 0.1) !important;
  -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .1);
    position: fixed; /* ثابت بدلاً من sticky */
    top: 4px;
    left: 0; /* ليمتد من أقصى اليسار */
    right: 0; /* ليمتد إلى أقصى اليمين */
    z-index: 1000; /* زيادة قيمة z-index */
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

.topline {
    background: var(--pcolor);
    height: 4px;
        position: fixed; /* ثابت بدلاً من sticky */
    top: 0;
    left: 0; /* ليمتد من أقصى اليسار */
    right: 0; /* ليمتد إلى أقصى اليمين */
}
.z-10 {
    z-index: 10 !important;
}
.site-logo {
  padding: 7px 0;
}
@media (min-width: 320px) and (max-width: 1000px) {
    .site-logo {
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: fit-content;
        height: fit-content;
    }

    .site-logo svg {
        width: auto;
        height: auto;
    }
}
.logo {
    font-size: 28px;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.color-picker-wrapper,
.font-control-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
   /* background: #f1f5f9; */
    padding: 5px 12px;
    border-radius: 8px;
}

.color-picker-label,
.font-control-label {
    color: #475569;
    font-weight: 600;
    font-size: 14px;
}

#colorPicker {
    width: 35px;
    height: 35px;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    background: none;
}

#fontSelector {
    padding: 9px 15px;
    border: 2px solid #ffffff;
    border-radius: 0px;
    background: white;
    font-size: 14px;
    color: #334155;
    min-width: 200px;
}

#sizeSelector {
    padding: 9px 15px;
    border: 2px solid #ffffff;
    border-radius: 0px;
    background: white;
    font-size: 14px;
    color: #334155;
    min-width: 200px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-primary {
    background: #0469ed;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: #226fc2;
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* الشبكة: صورتين في السطر */
.templates-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* في الهاتف: صورة واحدة في السطر */
@media (max-width: 600px){
  .templates-grid{
    grid-template-columns:  repeat(2, minmax(0, 1fr));
  }
}

/* ضع span و grid داخل نفس الحاوية، وطبّق هذا على الحاوية */
.templates-section{
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* الكارد */
.template-card{
  border: 0px solid #e6e6e6;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.template-card:hover{
  transform: translateY(-2px);
}

/* معاينة الصورة (شكل CV طولي) */
.template-preview{
  width: 100%;
  aspect-ratio: 3 / 4;       /* شكل طولي مناسب للسيرة الذاتية */
  background: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-preview img{
  width: 100%;
  height: 100%;
  object-fit: cover;          /* غيّرها إلى contain إذا تريد الصورة كاملة بدون قص */
  display: block;
border: 1px solid #cacaca;
}

/* العنوان تحت الصورة */
.template-name{
  padding: 10px 12px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: #222;
  border-top: 0px solid #eee;
}


/* Styles des modèles de démonstration */
.template1-demo {
    padding: 0;
}

.template1-demo .demo-header {
    height: 60px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.template1-demo .demo-photo {
    width: 70px;
    height: 70px;
    background: #cbd5e1;
    border-radius: 50%;
    margin-bottom: 15px;
}

.template2-demo {
    display: flex;
    height: 100%;
}

.template2-demo .demo-sidebar {
    width: 100px;
    height: 100%;
}

.template2-demo .demo-main {
    flex: 1;
    padding: 0;
}

.template2-demo .demo-photo {
    position: absolute;
    width: 60px;
    height: 60px;
    background: #cbd5e1;
    border-radius: 50%;
    top: 20px;
    right: 20px;
}

.demo-line {
    background: #e2e8f0;
    border-radius: 2px;
    margin-bottom: 10px;
}

.demo-line.short {
    width: 60%;
    height: 8px;
}

.demo-line.medium {
    width: 80%;
    height: 8px;
}

.demo-line.long {
    width: 100%;
    height: 8px;
}

/* Contenu principal */
.fo-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    min-height: 70vh;
    max-width: 2000px;
    margin: 0 auto;
}

@media (max-width: 1200px) {
    .fo-container {
        grid-template-columns: 1fr;
        height: auto;
    }
}

/* Section formulaire */
.form-section {
    background: white;
    border-radius: 0px;
    overflow: hidden;
}

@media (max-width: 1200px) {
  .form-section {
background: white;
  border-radius: 0px;
  overflow: hidden;
  margin: -55px -13Px;
  padding: 0px;
  }
  .form-container {
    height: 100%;
    overflow-y: auto;
    padding: 15px 5px;
    background-color: var(--bg);
}
  
  /* إذا كان هناك عنصر بعده، نزيل الهامش السفلي */
  .form-section + * {
    margin-top: 0;
  }
  h3.form-section-title {
    font-size: 15px !important;
  /*text-transform: uppercase !important;*/
  }
}

/* إظهار في الشاشات الكبيرة (1200px فما فوق) */
@media (min-width: 1201px) {
  .preview-section {
    background: white;
    border-radius: 0px;
    overflow: hidden;
  }

.form-container {
    height: 100%;
    overflow-y: auto;
    padding: 0px 5px 15px 5px;
    max-height: 92vh;
    background-color: var(--bg);
}
}



.form-section-title {
  cursor: pointer;
  display: flex;
  align-items: center;
  /* justify-content: space-between; */
  user-select: none;
}

h3.form-section-title {
    font-size: 18px;
    /*  text-transform: uppercase;*/
}

/* جسم البطاقة القابل للطي */
.form-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

/* عندما تكون البطاقة مفتوحة */
.form-section-card.active .form-section-body {
  /* max-height سيضبطه JS إلى scrollHeight لكن هذا يساعد في حال الcss-only fallback */
  max-height: 2000px; /* قيمة كبيرة كـ fallback */
}

.form-section-title::before {content:"\f078";font-family:"Font Awesome 6 Free";font-weight:900;font-size:23px;color:var(--pcolor);transition:transform .35s}

.form-section-card.active .form-section-title::before {
  transform: rotate(180deg);
}

/* يحافظ على شكل البطاقة كما عندك */
.form-section-card { /* يبقى كما لديك */ }


.form-section-title i {
    color: #000;
    margin-right: 10px;
}

.form-section-card{background:#fff;border-radius:5px;margin-bottom:10px;transition:.3s;padding:2px 0;box-shadow:2px 2px 6px 1px rgba(1,91,145,.17);-webkit-box-shadow:2px 2px 6px 1px rgba(1,91,145,.17);-moz-box-shadow:2px 2px 6px 1px rgba(1,91,145,.17)}.form-section-card.optional-section-hidden{display:none!important}.optional-sections-picker{margin:10px 0 14px;background:#fff;border-radius:10px;padding:10px 12px;box-shadow:2px 2px 6px 1px rgba(1,91,145,.12)}.optional-sections-picker-title{margin:0 0 8px;font-size:12px;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.8px}.optional-section-item{width:100%;border:0;background:0 0;display:flex;align-items:center;justify-content:space-between;padding:8px 4px;color:#0f172a;cursor:pointer;border-bottom:1px dashed #dbe4ef}.optional-section-item:last-child{border-bottom:0}.optional-section-item i{color:var(--pcolor);font-size:14px}.optional-section-item-label{text-transform:uppercase;font-size:14px;font-weight:600}.form-section-title{cursor:pointer;display:flex;align-items:center;gap:8px;user-select:none}h3.form-section-title{font-size:17px;letter-spacing:1.5px;padding:15px 18px;border-radius:10px 10px 0 0;color:var(--scolor)}h3.form-section-title .section-title-text{text-transform:capitalize!important}h3.form-section-title .section-title-text::first-letter{text-transform:uppercase!important}.form-section-title .section-title-text{display:inline-flex;align-items:center;gap:8px}.form-section-title i {font-family:"Font Awesome 6 Free";font-weight:900;font-size:14px;color:#fff;content:"\f15c";background:var(--pcolor);width:40px;height:40px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.form-section-title[data-i18n=profile]::before{content:"\f007"}.form-section-title[data-i18n=experience]::before,.form-section-title[data-i18n=shortexperience]::before{content:"\f0b1"}.form-section-title[data-i18n=education]::before{content:"\f19d"}.form-section-title[data-i18n=skills]::before{content:"\f0ad"}.form-section-title[data-i18n=languages]::before{content:"\f1ab"}.form-section-title[data-i18n=software]::before{content:"\f121"}.form-section-title[data-i18n=socials]::before{content:"\f1e0"}.form-section-title[data-i18n=hobbies]::before{content:"\f004"}.form-section-title[data-i18n=references]::before{content:"\f2bb"}.form-section-title[data-i18n=benevole]::before{content:"\f4be"}.form-section-title[data-i18n=cours]::before{content:"\f0a3"}.form-section-title[data-i18n=project]::before,.form-section-title[data-i18n=projects]::before{content:"\f542"}.form-section-title[data-i18n=sectionlibre]::before{content:"\f15b"}.form-section-title[data-i18n=info]::before{content:"\f2bb"}.form-section-card.active .form-section-title::after{transform:rotate(180deg)}.form-section-body{max-height:0;overflow:hidden;transition:max-height .35s}.form-section-card.active .form-section-body{max-height:2000px;will-change:max-height;padding:10px}



.add-btn {
    background: var(--bglight);
    border: 2px solid var(--pcolor) !important;
    color: var(--pcolor);
    padding: 6px 12px;
    margin: 5px 0px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-group {
    margin-bottom: 5px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #475569;
    font-size: 14px;
    padding: 5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--pcolorop);
   border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
    color: #334155;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.help-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
    font-style: italic;
}

/* Styles pour les éléments répétables */
.repeatable-item {
    background: #f4f7f9;
   /* border: 2px solid #e2e8f0; */
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    margin-top: 20px;
}

.repeatable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /*margin-bottom: 15px;*/
}

.repeatable-title {
    font-weight: 600;
    color: #475569;
    font-size: 16px;
}

.delete-btn {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #fecaca;
}

.fo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0px 15PX;
    /*margin-bottom: 15px;*/
}

.photo-upload {
display: flex;
  align-items: center !important;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.photo-upload .btn {
display: inline-flex;
  align-items: center !important;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50%;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  width: 50px;
  height: 50px;
}



.photo-upload .btn-secondary {
    background: var(--pcolor);
    color: white;
    border: none;
}

.photo-upload .btn-secondary:hover {
    background: var(--pcolor);
    transform: translateY(-2px);
    opacity: 0.9;
}

.photo-upload .btn-danger {
    background: #dc3545;
    color: white;
    border: none;
}

.photo-upload .btn-danger:hover {
    background: #dc3545;
    transform: translateY(-2px);
    opacity: 0.9;
}

#photoName {
    font-size: 14px;
    color: #666;
    font-style: italic;
    flex-grow: 1;
    min-width: 200px;
}

.photo-preview {
margin-top: 15px !important;
  margin-bottom: 15px !important;
  min-height: 140px;
  width: 140px;
  border: 4px solid var(--pcolor);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f8f9fa;
  margin: 0 auto;
  margin-top: 0px;
  margin-bottom: 0px;
}

.photo-preview:hover {
    border-color: #007bff;
}

.help-text {
    font-size: 13px;
    color: #6c757d;
    margin-top: 10px;
    line-height: 1.5;
    font-style: italic;
}

.mt-20 {
    margin-top: 20px;
}

/* === تنسيق للهاتف والشاشات الصغيرة === */
@media (max-width: 768px) {
    /* جعل جميع العناصر في عمود واحد */
    .photo-upload {
display: flex;
  align-items: center !important;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 15px;
    }
    
    /* جعل الأزرار تأخذ عرض كامل */
    .photo-upload .btn {
display: inline-flex;
  align-items: center !important;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 50%;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  width: 50px;
  height: 50px;
    }
    
    /* نص اسم الملف يأخذ عرض كامل */
    #photoName {
        width: 100%;
        min-width: 100%;
        text-align: center;
        padding: 10px;
        background: #f8f9fa;
        border-radius: 8px;
        margin: 5px 0;
        order: 3; /* تأخير ظهوره بعد الأزرار */
    }
      
    /* نص المساعدة يأخذ عرض كامل */
    .help-text {
        width: 100%;
        text-align: center;
        padding: 10px;
        background: #f8f9fa;
        border-radius: 8px;
        margin-top: 10px;
    }
    
    /* تعديلات إضافية للشاشات الصغيرة جداً */
    @media (max-width: 480px) {
        .form-group label {
            font-size: 16px;
            text-align: left;
            margin-bottom: 5px;
        }
        
        .photo-upload .btn {
            padding: 14px 15px;
            font-size: 16px;
        }
        
        .photo-upload .btn i {
            font-size: 18px;
        }
        
        #photoName {
            font-size: 15px;
            padding: 12px;
        }
        
        .help-text {
            font-size: 14px;
            padding: 12px;
        }
    }
}

/* === تنسيق للشاشات المتوسطة === */
@media (min-width: 769px) and (max-width: 1024px) {
    .photo-upload {
        flex-wrap: nowrap;
    }
    
    .photo-upload .btn {
        flex-shrink: 0;
    }
    
    #photoName {
        min-width: 150px;
    }
}

/* === تأثيرات للصور عند التحميل === */
.photo-preview.has-photo {
    border-style: solid;
    border-color: #28a745;
    background: white;
}

.photo-preview.loading {
    position: relative;
}

.photo-preview.loading::after {
    content: "Chargement...";
    position: absolute;
    color: #007bff;
    font-weight: 500;
}

/* Checkbox pour "En cours" */
.current-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.current-checkbox input {
    width: auto;
}

/* Section aperçu */
.preview-section {
    background: white;
    border-radius: 0px;
    overflow: auto;
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); */
max-height: 92vh;
}

@media (max-width: 1200px) {
  .preview-section {
    display: none;
  }
  
  /* إذا كان هناك عنصر بعده، نزيل الهامش السفلي */
  .preview-section + * {
    margin-top: 0;
  }
}

/* إظهار في الشاشات الكبيرة (1200px فما فوق) */
@media (min-width: 1201px) {
  .preview-section {
    display: block;
  }
}

.preview-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 7px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f4f8fb;
}

.preview-header h3 {
    color: #0469ed;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.preview-header i {
    color: #0469ed;
}

.preview-header h3{color:#334155;display:flex;align-items:center;gap:10px}
.page-size{padding:5px 15px;border-radius:20px;font-size:12px;color:#fff;font-weight:600;background:var(--pcolor);margin:0 auto}
/* Aperçu CV */
/* =========== إصلاحات المعاينة الرئيسية والمنبثقة =========== */

/* إعدادات أساسية للورقة A4 */
.a4-page{
  width: 210mm;
  min-height: 297mm;      /* بدل height */
  height: auto;           /* يسمح بتعدد الصفحات داخل نفس الورقة في المعاينة */
  background: #fff;
  box-shadow: 0 0 20px rgba(0,0,0,.1);
  margin: 0;
  overflow: visible;      /* بدل hidden */
  /* احذف transform: none !important; لأنه هو سبب كِبر المعاينة */
}

/* المعاينة الرئيسية (الجانب الأيمن) */
.preview-section {
    display: block;
}

.preview-wrapper .a4-page{
  transform: scale(var(--zoom));
  transform-origin: top center;
}

/* المودال المنبثق */
.modal-overlay.active .a4-page {
    transform: scale(1);
    margin: 0 auto;
}

.modal-body{
  --zoom: 0.85;
  padding: 15px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.modal-body .a4-page{
  transform: scale(var(--zoom));
  transform-origin: top center;
}

/* preview zoom */
@media (max-width: 1600px){ .preview-wrapper{ --zoom: 0.9; } }
@media (max-width: 1200px){ .preview-wrapper{ --zoom: 0.8; } }
@media (max-width: 992px){  .preview-wrapper{ --zoom: 0.7; } }
@media (max-width: 768px){  .preview-wrapper{ --zoom: 0.6; } }
@media (max-width: 576px){  .preview-wrapper{ --zoom: 0.5; } }

/* modal zoom */
@media (max-width: 1200px){ .modal-body{ --zoom: 0.8; } }
@media (max-width: 768px){  .modal-body{ --zoom: 0.65; } }
@media (max-width: 480px){  .modal-body{ --zoom: 0.55; } }


/* =========== تحسينات للشاشات المختلفة =========== */

/* =========== إصلاحات للمحتوى داخل الورقة =========== */

/* ضمان أن المحتوى يبقى داخل الورقة */
.cv-template {
    width: 100%;
    min-height: 100%;
    height: auto;          /* بدل 100% */
    overflow: visible;     /* بدل hidden */
    padding: 15mm;
    box-sizing: border-box;
}

/* منع العناصر من الخروج */
.cv-template * {
    max-width: 100%;
    word-wrap: break-word;
}

/* تحسينات إضافية للطباعة */
@media print {
    .a4-page {
        transform: scale(1) !important;
        box-shadow: none !important;
        margin: 0 !important;
    }
}

/* =========== إصلاح مشكلة الظهور في الزاوية =========== */

/* إعادة ضبط الموقع للعناصر المقطوعة */
.preview-wrapper,
.modal-body {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    height: 100% !important;
}

/* ضمان أن الورقة تظهر في المنتصف */
.a4-page {
    display: block !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

/* =========== تحسينات التمرير =========== */

.preview-wrapper::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.preview-wrapper::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.preview-wrapper::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* =========== تحسينات خاصة للمعاينة الرئيسية =========== */

/* عند إخفاء المعاينة على الشاشات الصغيرة */
@media (max-width: 1200px) {
    .preview-section {
        display: none;
    }
}

/* عند إظهار المعاينة على الشاشات الكبيرة */
@media (min-width: 1201px) {
    .preview-section {
        display: block;
        max-height: 92vh;
    }
}

.preview-notes {
    padding: 15px 25px;
    border-top: 2px solid #f1f5f9;
    background: #fefce8;
}

.preview-notes p {
    color: #854d0e;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#pageCountInfo {
    margin-top: 5px;
    font-weight: bold;
}

/* Styles du CV */
.cv-template {
    height: 100%;
    color: #000000;
    background: white;
    padding: 0;
}

.cv-template .fa,
.cv-template .fas,
.cv-template .far,
.cv-template .fal {
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900;
}

.cv-template .fab {
    font-family: 'Font Awesome 6 Brands' !important;
    font-weight: 400;
}


.cv-template * {
    font-family: inherit;
}

.cv-template1 .cv-section:last-child{
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* قالب 1: بسيط */
.cv-template1 {
    text-align: left;
    padding: 11mm;
}

.cv-template1 .cv-header {
    margin-bottom: 15px;
    padding-bottom: 20px;
    border-bottom: 2px solid;
}

.cv-template1 .cv-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 10px;
    border: 0px solid #f1f5f9 !important;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-template1 .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* قالب 2: احترافي */
.cv-template2 {
    display: flex;
    min-height: 100%;
}

.cv-template2 .cv-title{ 
    font-size: 16px;
    font-weight:700;
margin: 0;
  padding: 0;
  padding-bottom: 10px;
}

.cv-template2 .cv-sidebar {
    width: 35%;
    padding: 25px;
    border-right: 2px solid #e2e8f0;
}

.cv-template2 .cv-main {
    width: 65%;
    padding: 25px;
}

/* =========================================================
   TEMPLATE 2 (mobile): garder sidebar + main côte à côte
   IMPORTANT: override uniquement sur petits écrans
   ========================================================= */

@media (max-width: 768px) {
  .cv-template2{
    flex-direction: row !important;   /* ne jamais passer en colonne */
    flex-wrap: nowrap !important;     /* empêcher le retour à la ligne */
    align-items: stretch;
  }

  .cv-template2 .cv-sidebar{
    width: 35% !important;
    flex: 0 0 35% !important;         /* largeur fixe */
    padding: 16px !important;         /* padding plus petit pour mobile */
  }

  .cv-template2 .cv-main{
    width: 65% !important;
    flex: 1 1 65% !important;
    padding: 16px !important;
  }

  /* Optionnel: éviter un débordement horizontal si un texte est trop long */
  .cv-template2 .cv-sidebar,
  .cv-template2 .cv-main{
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* =========================================================
   TEMPLATE 2: Sidebar background full height (multi-pages)
   Solution: background on .cv-template2 via ::before, not on .cv-sidebar
   ========================================================= */

.cv-template2{
  position: relative;
}

/* Couche de fond qui couvre toute la hauteur du CV */
.cv-template2::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;              /* couvre toute la hauteur */
  left: 0;
  width: 35%;
  z-index: 0;
 background-color: var(--primary-color);
  opacity: 0.12;                 /* نفس تأثير color-mix تقريبًا */
  border-right: 2px solid rgba(0,0,0,0.08);
  z-index: 0;
}

/* Si le navigateur supporte color-mix, on utilise la vraie couleur */
@supports (background: color-mix(in srgb, red 10%, white)) {
  .cv-template2::before{
    background: color-mix(in srgb, var(--primary-color) 10%, white);
    border-right-color: color-mix(in srgb, var(--primary-color) 18%, #e2e8f0);
  }
}

/* Le contenu doit passer au-dessus de la couche ::before */
.cv-template2 .cv-sidebar,
.cv-template2 .cv-main{
  position: relative;
  z-index: 1;
}

/* La sidebar ne porte plus la couleur de fond (sinon elle s'arrête avec le contenu) */
.cv-template2 .cv-sidebar{
  background: transparent !important;
  border-right: none !important; /* déjà géré par ::before */
}

.cv-template2 .cv-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 25px;
    border: 8px solid white;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-template2 .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* عندما لا توجد صورة */
.cv-photo:empty {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-photo:empty::after {
    content: "👤";
}

/* طريقة بسيطة لإخفاء الصورة والمكان عندما تكون فارغة */
.cv-photo {
    transition: all 0.3s ease;
}

.cv-photo:not(:has(img)) {
    display: none;
    height: 0;
    width: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
    visibility: hidden;
}

/* =========== PHOTO VISIBILITY CONTROL =========== */
.cv-photo.no-photo {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.cv-photo.has-photo {
    display: block !important;
}

/* Adjust layout when no photo - Template 1 */
.cv-template1 .cv-header:has(~ .cv-photo.no-photo) {
    margin-top: 0 !important;
}

/* Adjust layout when no photo - Template 2 */
.cv-template2:has(.cv-photo.no-photo) .cv-sidebar {
    padding-top: 15px !important;
}

.cv-template2:has(.cv-photo.no-photo) .cv-sidebar > :first-child {
    margin-top: 0 !important;
}

/* تعديلات تلقائية للمحتوى عند اختفاء الصورة */
.cv-template:has(.cv-photo:not(:has(img))) .cv-header {
    margin-top: 0;
}

.cv-template1:has(.cv-photo:not(:has(img))) .cv-header {
    margin-top: 0;
}

.cv-template2:has(.cv-sidebar .cv-photo:not(:has(img))) .cv-sidebar {
    padding-top: 20px;
}

.cv-template2:has(.cv-sidebar .cv-photo:not(:has(img))) .cv-sidebar > :first-child:not(.cv-photo) {
    margin-top: 0;
}
.cv-template1 .cv-name {
    font-size: 32px !important;
    margin-bottom: 10px;
    font-weight: bold;
    color: inherit;
    text-align: center;
}

.cv-template1 .cv-title {
    font-size: 16px !important;
    font-weight: bold;
    color: #64748b;
    margin-bottom: 15px;
    text-align: center;
}

.cv-template1 .cv-section-title {
    font-size: 22px !important;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid;
    color: inherit;
}

.cv-template1 .cv-skills-modern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}

/* Template 5 & 6: لازم الحاوية تتمدد */
.cv-template5,
.cv-template6,
.template5,
.template6,
#cvTemplate5,
#cvTemplate6 {
  height: auto !important;
  overflow: visible !important;
}


.cv-template5 .cv-skills-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}

/* container: 3 لغات في السطر */
.cv-template5 .cv-languages-classic{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
  margin-top: 10px;
}

.cv-template5 .cv-languages-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}


.cv-template1 .cv-skills-classic {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-template1 .cv-skill-tag {
    background: #f1f5f9;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
    border: 1px solid #e2e8f0;
}

.cv-template1 .cv-languages-modern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}


/* container: 3 لغات في السطر */
.cv-template1 .cv-languages-classic{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 20px;
  margin-top: 10px;
}

/* عنصر اللغة */
.cv-template1 .cv-language-item-classic{
  display: inline-flex;
  align-items: center;
gap: 0;
padding: 0;
border: none;
}

/* اسم اللغة */
.cv-template1 .cv-language-item-classic span:first-child{
  color: #000;
  margin: 0;
  padding: 0;
}

/* المستوى */
.cv-template1 .cv-language-item-classic span:last-child{
  color: #000;
  margin: 0;
  padding: 0px 10px;
}

.cv-template1 .skill-progress-item,
.cv-template1 .language-progress-item {
    margin-bottom: 15px;
}

.cv-template1 .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: left;
    margin-bottom: 8px;
}

.cv-template1 .progress-name {
    font-weight: 600;
    color: #475569;
    font-size: 15px;
}

.cv-template1 .progress-percentage {
    font-weight: 700;
    color: var(--primary-color, #2563eb);
}

.cv-template1 .progress-bar {
    height: 15px;
    background: #e2e8f0;
    border-radius: 0px;
    overflow: hidden;
    position: relative;
}

.cv-template1 .progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    position: relative;
    background: var(--primary-color, #2563eb);
}

/* عندما لا توجد صورة */
.cv-template1 .templatecv1-photo:not(:has(img)) {
    display: none;
}

.cv-template1 .templatecv1-photo:empty {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 40px;
}

.cv-template1 .templatecv1-photo:empty::after {
    content: "👤";
}

/* التكيف عند عدم وجود صورة */
.cv-template1:has(.templatecv1-photo:not(:has(img))) .templatecv1-header {
    justify-content: center;
    text-align: center;
}

.cv-name {
    font-size: 32px !important;
    margin-bottom: 10px;
    font-weight: bold;
    color: inherit;
}

.cv-title {
    font-size: 18px !important;
    font-weight: bold;
    color: #000000;
    margin-bottom: 15px;
}

.cv-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #000000;
    margin-top: 10px;
}

.cv-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-contact-item i {
  width: 36px;
  height: 36px;
  color: inherit;
  background: var(--primary-color);
  padding: 10px;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cv-template1 .cv-contact-item i {
  color: var(--primary-color) !important;
  background: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cv-template4 .cv-contact-item i {
  width: initial !important;
  height: initial !important;
  background: initial !important;
  padding: 0px 5px 0px 0px !important;;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.cv-section {
    margin-bottom: 25px;
    page-break-inside: avoid;
}

.cv-section-title {
    font-size: 18px !important;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    padding-bottom: 8px;
    color: inherit;
}

.cv-summary {
    line-height: 1.6;
    color: #475569;
    margin-bottom: 25px;
}

/* عناصر CV */
.cv-item {
    margin-bottom: 20px;
    page-break-inside: avoid;
}

.cv-item-header {
   /* display: flex;*/
    /* justify-content: space-between;*/
    /* align-items: flex-start;*/
    /*margin-bottom: 8px;*/
}


.cv-item-title {
    font-weight: bold;
    font-size: 16px;
    color: #000;
    padding: 5PX 0PX 5PX 0Px;
}

.cv-item-subtitle {
    color: #475569;
    font-size: 15px;
    padding: 5PX 0PX 5PX 0Px;
}

.cv-item-date {
    color: #64748b;
    white-space: nowrap;
}

.cv-item-description {
    color: #475569;
    line-height: 1.6;
    margin-top: 5px;
}


.cv-template1 .cv-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-template1 .cv-skill {
    background: #b6b6b6;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
}

.cv-template2 .cv-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-template2 .cv-item-date {
    color: var(--primary-color);
    white-space: nowrap;
}

.cv-template2 .cv-skill {
    background: #fff;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
}

.cv-template2 .progress-bar {
  height: 10px;
  background: #fff;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.cv-template2 .cv-section-title {
    font-size: 18px !important;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid; 
    color: inherit;
}

.cv-language-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.cv-language-note {
    color: #64748b;
    font-size: 12px;
    font-style: italic;
    margin-top: 3px;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 4px;
    border-left: 2px solid #94a3b8;
}

.cv-languages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cv-language {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cv-list-name {
    font-weight: normal;
    color: #000;
}

.cv-language-name {
    font-weight: 600;
    color: #000;
}

.cv-language-level {
    color: #000;
}

.cv-reference {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}
/* Projets/Bénévolat/Centres d'intérêt/Références/Cours */
.cv-interest-item,
.cv-volunteer-item,
.cv-reference-item,
.cv-course-item,
.cv-project-item {
    margin-bottom: 15px;
}

.cv-project-type,
.cv-reference-position,
.cv-course-institution {
/*    font-weight: 600;*/
    color: #475569;
    margin-bottom: 3px;
}

/* تحسين الاستجابة */
@media (max-width: 768px) {
    .cv-template2 {
        flex-direction: column;
    }
    
    .cv-template2 .cv-sidebar,
    .cv-template2 .cv-main {
        width: 100%;
    }
    
    .cv-name {
        font-size: 28px;
    }
    
    .fo-row {
        grid-template-columns: 1fr;
    }
    
    .date-row {
        grid-template-columns: 1fr;
    }
    
    .fo-container {
        gap: 20px;
    }
    
    .control-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .templates-grid {
        grid-template-columns:  repeat(2, minmax(0, 1fr));
    }
}

/* Barre de défilement */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal de recadrage */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 15px;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--pcolor);
    color: white;
    border-radius: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.crop-container {
    width: 100%;
    height: 400px;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    flex-shrink: 0; /* منع التقلص */
}

#imageToCrop {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.crop-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
    flex-shrink: 0; /* منع التقلص */
}

.crop-controls .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.crop-controls .btn-secondary {
    background: #64748b;
    color: white;
    border: none;
}

.crop-controls .btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.modal-footer {
    padding: 20px 30px;
    border-top: 2px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    background: #f8fafc;
    border-radius: 0 0 15px 15px;
    flex-shrink: 0; /* منع التقلص */
}

/* === تنسيق للهاتف والشاشات الصغيرة === */
@media (max-width: 768px) {
    .modal-body {
        padding: 20px 15px;
        overflow-y: auto;
    }
    
    .crop-container {
        height: 300px; /* تقليل الارتفاع على الهواتف */
        margin-bottom: 15px;
        order: 1; /* يأتي أولاً */
    }
    
    .crop-controls {
        order: 2; /* يأتي ثانياً */
        flex-direction: column; /* الأزرار في عمود */
        width: 100%;
        gap: 10px;
        margin-top: 15px;
    }
    
    .crop-controls .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 15px;
        font-size: 15px;
    }
    
    .modal-footer {
        padding: 15px;
        flex-direction: column; /* الأزرار في عمود */
        gap: 10px;
        order: 3; /* يأتي ثالثاً */
    }
    
    .modal-footer .btn {
        width: 100%;
        justify-content: center;
        padding: 14px 15px;
        font-size: 16px;
    }
}

/* === تنسيق للشاشات الصغيرة جداً === */
@media (max-width: 480px) {
    .crop-container {
        height: 250px; /* مزيد من التقليل للارتفاع */
    }
    
    .crop-controls .btn,
    .modal-footer .btn {
        padding: 16px 15px;
        font-size: 16px;
    }
    
    .crop-controls .btn i,
    .modal-footer .btn i {
        font-size: 18px;
    }
}

/* === تنسيق للشاشات المتوسطة === */
@media (min-width: 769px) and (max-width: 1024px) {
    .crop-container {
        height: 350px;
    }
    
    .crop-controls {
        flex-wrap: nowrap; /* منع كسر الأسطر */
    }
    
    .crop-controls .btn {
        flex: 1; /* توزيع متساوي */
        min-width: 0;
    }
}

/* === تنسيق لشاشات كبيرة جداً === */
@media (min-width: 1200px) {
    .crop-container {
        height: 450px;
    }
}

/* === تحسينات للوضع الأفقي على الهاتف === */
@media (max-height: 600px) and (orientation: landscape) {
    .modal-body {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 15px;
    }
    
    .crop-container {
        width: 60%;
        height: 300px;
        margin-right: 15px;
        margin-bottom: 0;
    }
    
    .crop-controls {
        width: 35%;
        flex-direction: column;
        margin-top: 0;
        justify-content: flex-start;
    }
    
    @media (max-width: 768px) {
        .crop-controls .btn {
            padding: 10px 15px;
            font-size: 14px;
        }
    }
}

/* === تحسينات للوصول وإمكانية الاستخدام === */
.crop-controls .btn:active {
    transform: scale(0.98);
}

.crop-controls .btn:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* === تحسينات للصور الكبيرة === */
.crop-container img {
    transition: transform 0.3s ease;
}

.crop-container.zoomed img {
    transform: scale(1.5);
    cursor: move;
}

/* Alertes */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.alert.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.alert.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.cv-name {
    font-size: 32px;
}

.cv-title {
    /*font-size: 20px;*/
}

.cv-section-title {
    font-size: 18px !important;
}

.cv-item-title {
    font-size: 16px;
}

.cv-template2 .cv-contact-item {
    display: flex;
    width: 100%;
}

/* الطباعة */
@media print {
    body * {
        visibility: hidden;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .a4-page,
    .a4-page * {
        visibility: visible !important;
    }
    
    .a4-page {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    
    .cv-template * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Styles pour le multi-pages */
.cv-page-break {
    page-break-before: always;
    break-before: page;
}

/* Styles améliorés pour les dates */
.date-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.date-fields {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.date-fields select {
    flex: 1;
}

.month-year-group {
    display: flex;
    gap: 10px;
}

.month-year-group select {
    flex: 1;
}

.date-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
}

.date-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.date-checkbox label {
    font-size: 14px;
    color: #475569;
    font-weight: normal;
}
/* Styles pour les sauts de page */
.page-break-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 10%, 
        #dc2626 10%, 
        #dc2626 90%, 
        transparent 90%);
    z-index: 1000;
    pointer-events: none;
    opacity: 0.7;
}

.page-break-line::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 12px;
    background: #dc2626;
    border-radius: 0 0 6px 6px;
    opacity: 0.8;
}

.page-break-hint {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 10px;
    font-weight: normal;
}

/* Empêcher la coupure inappropriée */
.cv-section,
.cv-item {
    break-inside: avoid;
    page-break-inside: avoid;
}

/* Position relative pour les sauts de page */
#cvPreview {
    position: relative;
}

/* Masquer les lignes lors de l'impression */
@media print {
    .page-break-line {
        display: none !important;
    }
}
/* =========== أنماط النجوم للقسم الجديد =========== */
.stars-rating {
    display: flex;
    gap: 8px;
    margin: 12px 0;
    direction: ltr;
}

.stars-rating .star {
    font-size: 28px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.stars-rating .star:hover {
    transform: scale(1.2);
    color: #ffc107;
}

.stars-rating .star.active {
    color: #ffc107;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.stars-rating .star.active:hover ~ .star {
    color: #ccc;
}

.stars-value {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

/* =========== أنماط قوائم المهارات واللغات =========== */
.add-skill-form,
.add-language-form {
    background: #e1e6e8;
    padding: 0;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.skills-list-container,
.languages-list-container {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.skills-list-container h4,
.languages-list-container h4 {
    margin-bottom: 15px;
    color: #334155;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.skills-list-container h4::before,
.languages-list-container h4::before {
    content: "📋";
    font-size: 18px;
}

.skills-list,
.languages-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.skills-list::-webkit-scrollbar,
.languages-list::-webkit-scrollbar {
    width: 6px;
}

.skills-list::-webkit-scrollbar-track,
.languages-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.skills-list::-webkit-scrollbar-thumb,
.languages-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.skill-item,
.language-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.skill-item:hover,
.language-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.skill-item-info,
.language-item-info {
    flex: 1;
}

.skill-item-name,
.language-item-name {
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
    font-size: 15px;
}

.skill-item-stars {
    font-size: 16px;
    color: #ffc107;
    letter-spacing: 2px;
}


.skill-item-actions,
.language-item-actions {
    display: flex;
    gap: 8px;
}

.skill-item-actions button,
.language-item-actions button {
    background: none;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.skill-item-actions button:hover,
.language-item-actions button:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #dc2626;
}

.empty-message {
    text-align: center;
    color: #94a3b8;
    font-style: italic;
    padding: 0;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

/* =========== أنماط المعاينة للوضعين =========== */
/* الوضع Classic */
.cv-skills-classic {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-skill-tag {
    background: #f1f5f9;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
    border: 1px solid #e2e8f0;
}

/* الوضع Modern */
.cv-skills-modern {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.skill-progress-item {
    margin-bottom: 15px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-name {
    font-weight: 600;
    color: #475569;
    font-size: 15px;
}

.progress-percentage {
    font-weight: 700;
    color: inherit;
}

.progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* اللغات - الوضع Classic */
.cv-languages-classic {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cv-language-item-classic {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dotted #888787;
}

.cv-language-item-classic:last-child {
    border-bottom: none;
}

.cv-language-item-classic span:first-child {
    font-weight: 600;
    color: #000;
}

.cv-language-item-classic span:last-child {
    color: #000;
}

/* اللغات - الوضع Modern */
.cv-languages-modern {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.language-progress-item {
    margin-bottom: 15px;
}

/* =========== تعديلات التجاوب =========== */
@media (max-width: 768px) {
    .stars-rating .star {
        font-size: 24px;
    }
    
    .skill-item,
    .language-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .skill-item-actions,
    .language-item-actions {
        align-self: flex-end;
    }
    
    .progress-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .progress-percentage {
        align-self: flex-end;
    }
}
/* تحسين أزرار التعديل والحذف */
.skill-item-actions button,
.language-item-actions button {
    background: none;
    border: 1px solid #e2e8f0;
    color: #64748b;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.skill-item-actions button:hover,
.language-item-actions button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.skill-item-actions button:first-child:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.skill-item-actions button:last-child:hover {
    background: #fee2e2;
    color: #dc2626;
}
/* =========== أنماط النموذج الثالث =========== */
.template3-demo {
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.template3-demo .demo-header-bar {
    height: 30px;
    border-radius: 5px 5px 0 0;
    margin-bottom: 20px;
}

.template3-demo .demo-content-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.template3-demo .demo-photo-side {
    width: 80px;
    height: 80px;
    background: #cbd5e1;
    border-radius: 50%;
    flex-shrink: 0;
}

.template3-demo .demo-info-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template3-demo .demo-section-title {
    position: relative;
    height: 25px;
    margin-top: 10px;
}

.template3-demo .demo-title-bg {
    width: 150px;
    height: 100%;
    border-radius: 5px 5px 0 0;
    position: absolute;
    left: 0;
    top: 0;
}

.template3-demo .demo-title-line {
    position: absolute;
    left: 150px;
    right: 0;
    top: 50%;
    height: 2px;
    background: #e2e8f0;
    transform: translateY(-50%);
}

/* =========== أنماط CV للنموذج الثالث =========== */
.cv-template3 {
    font-family: inherit;
    height: 100%;
    color: #000000;
    background: white;
    padding: 0;
}

.cv-template3 .templatecv3-header {
    background-color: var(--primary-color, #25eb5d);
    color: white;
    padding: 15px 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    min-height: 180px;
    position: relative;
}

.cv-template3 .templatecv3-header-content {
    flex: 1;
    z-index: 2;
}

.cv-template3 .templatecv3-photo-container {
    position: relative;
    z-index: 3;
}

.cv-template3 .templatecv3-photo {
width: 160px;
  height: 160px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cv-template3 .templatecv3-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-template3 .templatecv3-name {
    font-size: 32px !important;
    font-weight: bold;
    margin-bottom: 10px;
    color: rgb(0, 0, 0);
}

.cv-template3 .templatecv3-title {
    font-size: 20px !important;
    color: rgba(0, 0, 0, 0.9);
    margin-bottom: 15px;
}

.cv-template3 .templatecv3-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 15px;
}

.cv-template3 .templatecv3-contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv-template3 .templatecv3-contact-item i {
    width: 16px;
    color: var(--primary-color);
}

.cv-template3 .templatecv3-content {
    padding: 20px 30px;
}

.cv-template3 .templatecv3-section {
    margin-bottom: 30px;
    page-break-inside: avoid;
}

.cv-template3 .templatecv3-section-title {
    position: relative;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    border-bottom: 3PX solid;
}

.cv-template3 .templatecv3-section-title-bg {
    color: rgb(0, 0, 0);
    padding: 8px 0px;
    border-radius: 0;
    font-size: 18px !important;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 2;
    position: relative;
    min-width: 200px;
    letter-spacing: 2.5px;
}

.cv-template3 .templatecv3-section-title-line {
    flex: 1;
    height: 5px;
    background-color: var(--primary-color, #2563eb);
    margin-left: -10px;
    z-index: 1;
}

.cv-template3 .templatecv3-summary {
    line-height: 1.6;
    color: #000;
    margin-bottom: 25px;
    font-size: 15px;
}

.cv-template3 .templatecv3-item {
    margin-bottom: 20px;
    page-break-inside: avoid;
}

.cv-template3 .templatecv3-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.cv-template3 .templatecv3-item-title {
    font-weight: bold;
    font-size: 16px;
    color: #000;
}

.cv-template3 .templatecv3-item-subtitle {
    color: #475569;
    font-size: 15px;
}

.cv-template3 .templatecv3-item-date {
    color: #64748b;
    white-space: nowrap;
}

.cv-template3 .templatecv3-item-description {
    color: #475569;
    line-height: 1.6;
    margin-top: 5px;
}

.cv-template3 .templatecv3-skills-modern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}

.cv-template3 .templatecv3-skills-classic {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-template3 .templatecv3-skill-tag {
    background: #f1f5f9;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
    border: 1px solid #e2e8f0;
}

.cv-template3 .templatecv3-languages-modern {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 18px;
  margin-top: 10px;
}


/* container: 3 لغات في السطر */
.cv-template3 .templatecv3-languages-classic{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 20px;
  margin-top: 10px;
}

/* عنصر اللغة */
.cv-template3 .templatecv3-language-item-classic{
  display: inline-flex;
  align-items: center;
gap: 0;
padding: 0;
border: none;
}

/* اسم اللغة */
.cv-template3 .templatecv3-language-item-classic span:first-child{
  font-weight: 600;
  color: #000;
  margin: 0;
  padding: 0;
}

/* المستوى */
.cv-template3 .templatecv3-language-item-classic span:last-child{
  color: #000;
  margin: 0;
  padding: 0px 10px;
}


.cv-template3 .skill-progress-item,
.cv-template3 .language-progress-item {
    margin-bottom: 0px;
}

.cv-template3 .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.cv-template3 .progress-name {
    font-weight: 600;
    color: #475569;
    font-size: 15px;
}

.cv-template3 .progress-percentage {
    font-weight: 700;
    color: var(--primary-color, #2563eb);
}

.cv-template3 .progress-bar {
    height: 10px;
    background: #959393 !important;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.cv-template3 .progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    position: relative;
    background: var(--primary-color, #2563eb);
}

/* عندما لا توجد صورة */
.cv-template3 .templatecv3-photo:not(:has(img)) {
    display: none;
}

.cv-template3 .templatecv3-photo:empty {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 40px;
}

.cv-template3 .templatecv3-photo:empty::after {
    content: "👤";
}

/* التكيف عند عدم وجود صورة */
.cv-template3:has(.templatecv3-photo:not(:has(img))) .templatecv3-header {
    justify-content: center;
    text-align: center;
}

/* =========== أنماط Radio Buttons الجديدة =========== */
.radio-buttons {
    margin-top: 8px;
}

.radio-button-group {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
}

.radio-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    font-weight: 600;
    color: #475569;
    flex: 1;
    text-align: center;
    position: relative;
    border-right: 1px solid #e2e8f0;
}

.radio-button:last-child {
    border-right: none;
}

.radio-button:hover {
    background: #e1e6e8;
    color: #334155;
}
.radio-button:hover {
    background: #e1e6e8;
    color: #334155;
}

.radio-button:has(input:checked) {
background: #e1e6e8;
color: #334155;
}

.radio-button input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-button input[type="radio"]:checked + .radio-button-label {
    color: #0469ed;
}

.radio-button-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 12px 20px;
    gap: 8px;
    transition: all 0.3s ease;
}

/* تأثير الضغط عند النقر */
.radio-button:active .radio-button-label {
    transform: translateY(1px);
        background: #e1e6e8;

}

/* تحسين الاستجابة */
@media (max-width: 768px) {
    .radio-button-group {
        flex-direction: column;
        gap: 0;
    }
    
    .radio-button {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .radio-button:last-child {
        border-bottom: none;
    }
}

/* تصميم أنيق للزر المحدد */
.radio-button input[type="radio"]:checked + .radio-button-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
}

.radio-button-label i {
    font-size: 14px;
    transition: all 0.3s ease;
}

.radio-button input[type="radio"]:checked + .radio-button-label i {
    color: #0469ed;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  width: min(900px, 100%);
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  border: 0;
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 5px;
}
.modal-close i {
color: var(--pcolor);
}
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.modal-back {
  border: 2px solid var(--pcolor);
  color: var(--pcolor);
  background: #fff;
  padding: 10px 14px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  margin: 0 auto;
}
@media (max-width: 1200px) {
  .top-actions {
    flex-direction: column; /* تصطف الأزرار عمودياً */
    width: 90%; /* مناسب للشاشات الصغيرة */
  }

  .top-actions button {
    min-width: auto;
    width: 100%;
    border-right: none; /* إزالة الحدود الجانبية */
    border-bottom: 1px solid #e5e7eb; /* خط فاصل بين الأزرار عمودياً */
    display: flex;
    flex-direction: column; /* يجعل العناصر داخل الزر عمودية */
    align-items: center; /* يوسّط العناصر أفقيًا */
    justify-content: center; /* يوسّط العناصر عموديًا */
    padding: 12px 16px;
    gap: 6px; /* مسافة بين الأيقونة والنص */
  }

  .top-actions button:last-child {
    border-bottom: none;
  }

  .top-actions button span {
    font-size: 14px;
    order: 2; /* يجعل النص يأتي بعد الأيقونة */
  }

  .top-actions button i {
    font-size: 16px;
    order: 1; /* يجعل الأيقونة تأتي قبل النص */
  }
}

@media (max-width: 480px) {
  .top-actions button {
    padding: 10px 12px;
    font-size: 13px;
  }

  .modal-box {
    width: 95%; /* تقريب العرض للهواتف */
    max-height: 85vh;
  }

  #cvPreviewModal {
    transform: scale(0.85);
  }
}
/* Custom Color Picker */
.custom-color-picker {
    position: relative;
    display: inline-block;
}

.hidden-color-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.color-display-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: linear-gradient(135deg, var(--current-color, #2563eb) 0%, var(--current-color, #2563eb) 100%);
    position: relative;
    overflow: hidden;
}

.color-display-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-display-button:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.color-display-button:hover::after {
    opacity: 1;
}

.color-display-button:active {
    transform: scale(0.95);
}

.color-display-button i {
    color: white;
    font-size: 16px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.color-display-button:hover i {
    transform: scale(1.2);
}

.color-display-button.active {
    border: 3px solid #334155;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.size-suggestions{
   /* margin-top: 15px;*/
   /* padding-top: 15px;*/
}

.suggestion-sizes{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.size-suggestion{
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s ease;
      color: #000;
    font-weight: normal;
}

.size-suggestion:hover{
  border-color: #2563eb;
}

.size-suggestion.active{
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.font-suggestions{
   /* margin-top: 15px;*/
   /* padding-top: 15px;*/
}

.suggestion-fonts{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.font-suggestion{
  min-width: 70px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
  transition: all .2s ease;
color: #000;
font-weight: normal;
}

.font-suggestion:hover{
  border-color: #2563eb;
}

.font-suggestion.active{
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

/* Suggestions de couleurs */
.color-suggestions {
   /* margin-top: 15px;*/
   /* padding-top: 15px;*/
}

.label {
    font-size: 16px;
    color: #000;
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

.suggestion-colors {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-suggestion {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 0px solid white;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    padding: 0;
    position: relative;
}

.color-suggestion:hover {
border: 0px solid #fff;}


.color-suggestion.active {
    border: 0px solid #fff;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .color-display-button {
        width: 40px;
        height: 40px;
    }
    
    .color-suggestion {
        width: 30px;
        height: 30px;
    }
    
    .suggestion-colors {
        gap: 8px;
    }
}
/* Tooltip amélioré */
.tooltip-container {
    position: relative;
}

.tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #334155;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #334155;
}

.tooltip-container:hover .tooltip {
    visibility: visible;
    opacity: 1;
}
/* =========== أنماط محرر النصوص =========== */
.editor-wrapper {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

.editor-toolbar {
    background: #f8fafc;
    padding: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.editor-btn {
    background: white;
    border: 1px solid #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    transition: all 0.2s ease;
    font-size: 14px;
}

.editor-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #2563eb;
}

.editor-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.editor-separator {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 8px;
}

.editor-content {
    min-height: 150px;
    padding: 15px;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    color: #334155;
    overflow-y: auto;
    max-height: 300px;
}

.editor-content[contenteditable="true"]:empty:before {
    content: attr(placeholder);
    color: #94a3b8;
    pointer-events: none;
}

.editor-content:focus {
    outline: none;
}

.editor-content ul,
.editor-content ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

.editor-content p {
    margin-bottom: 10px;
}

/* تحسينات للمحتوى داخل المحرر */
.editor-content b,
.editor-content strong {
    font-weight: bold;
}

.editor-content i,
.editor-content em {
    font-style: italic;
}

.editor-content u {
    text-decoration: underline;
}

.editor-content .text-left {
    text-align: left;
}

.editor-content .text-center {
    text-align: center;
}

.editor-content .text-right {
    text-align: right;
}

/* تحسين الاستجابة */
@media (max-width: 768px) {
    .editor-toolbar {
        gap: 4px;
        padding: 8px;
    }
    
    .editor-btn {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .editor-separator {
        margin: 0 4px;
    }
    
    .editor-content {
        min-height: 120px;
        padding: 12px;
        font-size: 14px;
    }
}

/* =========== أنماط عرض المحتوى في المعاينة =========== */
.cv-libre-content {
    line-height: 1.6;
    color: #475569;
}

.cv-libre-content ul,
.cv-libre-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.cv-libre-content p {
    margin-bottom: 10px;
}

.cv-libre-content b,
.cv-libre-content strong {
    font-weight: bold;
}

.cv-libre-content i,
.cv-libre-content em {
    font-style: italic;
}

.cv-libre-content u {
    text-decoration: underline;
}

.cv-libre-content .text-left {
    text-align: left;
}

.cv-libre-content .text-center {
    text-align: center;
}

.cv-libre-content .text-right {
    text-align: right;
}

/* عندما يكون المحتوى محاذاة لليسار (الإفتراضي) */
.cv-libre-content .text-left {
    text-align: left;
}

/* عندما يكون المحتوى محاذاة في الوسط */
.cv-libre-content .text-center {
    text-align: center;
}

/* عندما يكون المحتوى محاذاة لليمين */
.cv-libre-content .text-right {
    text-align: right;
}
/* CSS للأيقونات والعناصر */
.cv-actions-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 5px;
}

.cv-action-section {
    background: #fff;
    border-radius: 0px;
    padding: 25px 30px;
    margin-bottom: 25px;
    /*box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);*/
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border-left: 5px solid var(--pcolor);
    position: relative;
    z-index: 1;
}

/* .cv-action-section::before تم إزالته */

.action-description {
    flex: 1;
    padding-right: 30px;
    position: relative;
    z-index: 2; /* ضمان أن النص فوق الخلفية */
}

.action-description h4 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-description h4 i {
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
}

.action-description p {
    margin-bottom: 0;
    color: #5a6c7d;
    line-height: 1.7;
    font-size: 14px;
}

/* تأكد من أن الأزرار قابلة للنقر */
.btn-action {
    min-width: 200px;
    padding: 5px 15px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    white-space: nowrap;
    cursor: pointer !important; /* تأكيد أن المؤشر يظهر */
    position: relative;
    z-index: 10; /* ضمان أن الزر فوق كل شيء */
    pointer-events: auto !important; /* التأكيد على تفعيل النقر */
}

.btn-action:hover {
    transform: translateY(-3px);
}

.btn-action:active {
    transform: translateY(0);
}

/* التأكد من أن جميع العناصر قابلة للنقر */
button, input[type="file"] {
    pointer-events: auto !important;
}

/* تنسيق خاص لقسم الحذف */
.cv-action-section:nth-child(4) .action-description p {
    background: rgba(220, 53, 69, 0.05);
    padding: 10px 15px;
    border-radius: 8px;
    border-left: 3px solid #dc3545;
}

/* إصلاحات للاستجابة */
@media (max-width: 768px) {
    .cv-action-section {
        flex-direction: column;
        text-align: center;
        padding: 0;
    }
    
    .action-description {
        padding-right: 0;
        margin-bottom: 20px;
    }
    
    .action-description h4 {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-action {
        width: 100%;
        max-width: 250px;
        margin-top: 10px;
    }
}

/* إصلاح لون النص */
.text-primary { color: #007bff !important; }
.text-secondary { color: #6c757d !important; }
.text-info { color: #17a2b8 !important; }
.text-danger { color: #dc3545 !important; }

.fa, .fas, .far, .fal, .fad, .fab {
    font-family: 'Font Awesome 6 Free' !important;
    font-weight: 900;
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid #e5e7eb;
  border-radius: 25px;
  overflow: hidden;
  background: #fff;
  justify-content: center;
  width: fit-content;
  margin: 10px auto;
 /* box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);*/
  position: relative;
  transition: all 0.3s ease;
  z-index: 1000;
}

/* تنسيق الأزرار */
.top-actions button {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #444;
  transition: 0.2s ease;
  min-width: 120px;
  justify-content: center;
}

.top-actions button:not(:last-child) {
  border-right: 0px solid #e5e7eb;
}

.top-actions button i {
  font-size: 16px;
  opacity: 0.85;
}

.top-actions button:hover {
  /*background: #f3f4f6;*/
}

.top-actions button.active {
 /* background: #111827;*/
  color: #1d6f42;
}

.top-actions button.active i {
  opacity: 1;
}

/* تأثير الـ pulse للعناصر النشطة */
@keyframes pulse-selected {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.radio-button input[type="radio"]:checked + .radio-button-label {
  animation: pulse-selected 0.5s ease;
}

/* تنسيق اللوحات */
.panel {
  display: none;
  padding: 5px;
  border: 0px solid #ccc;
}

.panel.active {
  display: block;
}

/* العناوين */
h3.panels {
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  position: relative;
}

h3.panels::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: #111827;
  margin: 8px auto 0;
  border-radius: 2px;
}

.preview-btn {
    background: linear-gradient(135deg, #22a85f 0%, #1d6f42 100%) !important;
    color: white !important;
}

.preview-btn:hover {
    background: linear-gradient(135deg, #22a85f 0%, #1d6f42 100%) !important;
}
@media (max-width: 1200px) {
  /* تثبيت العنصر في الأسفل */
  .top-actions {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    background: #fff;
    justify-content: space-between;
    padding: 8px 10px;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* الأزرار في صف أفقي مع أيقونة فوق النص */
  .top-actions button {
    flex: 1;
    min-width: 0;
    padding: 8px 5px;
    font-size: 12px;
    flex-direction: column; /* تغيير من row إلى column */
    gap: 4px; /* تقليل المسافة بين الأيقونة والنص */
    border: none !important;
    border-radius: 8px;
    margin: 0 3px;
    height: auto; /* تغيير من ارتفاع ثابت إلى تلقائي */
    min-height: 55px; /* ارتفاع أدنى */
    display: flex;
    align-items: center; /* توسيط أفقي */
    justify-content: center; /* توسيط عمودي */
    white-space: nowrap;
  }

  .top-actions button span {
    display: inline-block !important;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center; /* توسيط النص */
    width: 100%; /* لجعل النص في المنتصف */
    padding-top: 5px;
  }

  .top-actions button i {
    font-size: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .top-actions button:not(:last-child) {
    border-right: none !important;
  }

  body {
    padding-bottom: 70px !important; /* زيادة قليلة بسبب ارتفاع الأزرار */
  }
}

/* ===== تنسيق إضافي للشاشات الصغيرة ===== */
@media (max-width: 480px) {
  .top-actions {
    padding: 6px 8px;
  }
  
  .top-actions button {
    padding: 6px 4px;
    font-size: 11px;
    min-height: 50px; /* تقليل الارتفاع قليلاً */
    gap: 3px;
  }
  
  .top-actions button span {
    font-size: 10px;
  }
  
  .top-actions button i {
    font-size: 16px; /* تقليل حجم الأيقونة قليلاً */
  }
}

@media (max-width: 360px) {
  .top-actions button {
    min-height: 48px;
    padding: 5px 3px;
  }
  
  .top-actions button span {
    font-size: 9px;
  }
  
  .top-actions button i {
    font-size: 15px;
  }
}

/* ===== تنسيق إضافي للشاشات المتوسطة ===== */
/* هذا التنسيق للشاشات بين 769px و 1200px */
@media (min-width: 769px) and (max-width: 1200px) {
  .top-actions {
    width: 100%;
  }
  
  .top-actions button {
    min-width: 100px;
    padding: 10px 15px;
  }
}

/* ===== تحسينات عامة ===== */
.top-actions * {
  pointer-events: auto !important;
}

.top-actions::-webkit-scrollbar {
  display: none;
}

.top-actions {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
/* =========================
   A4 MULTI-PAGES PREVIEW
   ========================= */

/* container الذي سيحمل عدة صفحات */
#a4Pages,
#cvPreview.a4-pages,
#cvPreviewModal.a4-pages {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

/* كل صفحة A4 في المعاينة */
.preview-page {
  width: 210mm;
  height: 297mm;          /* مهم: صفحة ثابتة */
  background: #fff;
  position: relative;
  overflow: hidden;        /* مهم: لقص المحتوى داخل الصفحة */
  box-shadow: 0 0 20px rgba(0,0,0,0.10);
}

/* حاوية “النسخة” التي سنزحزحها للأعلى/الأسفل */
.preview-page .cv-slice {
.preview-page .cv-slice { display: none !important; }

}

/* ضروري لأن عندك .cv-template { height:100% } وهذا يسبب مشاكل عند القص */
.preview-page .cv-template,
.preview-page .cv-template1,
.preview-page .cv-template2,
.preview-page .cv-template3,
.preview-page .cv-template4 {
  height: auto !important;
  min-height: 297mm !important;    /* بدل unset */
}

/* =========================
   PREVIEW MODAL (إذا كان عندك modal-overlay)
   ========================= */

.modal-overlay{
  display: none;                 /* JS يفتحه */
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 20000;
  padding: 20px;
}

.modal-overlay.show{
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box{
  width: min(980px, 95vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-body{
  padding: 18px;
  overflow: auto;                /* مهم: التمرير داخل المودال */
  background: #f8fafc;
}

.modal-body .a4-pages{
  align-items: center;
}
/* =========================================================
   PREVIEW: Adapter l'A4 à la largeur (sans scroll horizontal)
   Objectif: garder le rendu "impression A4" mais responsive.
   ========================================================= */

/* Le wrapper ne doit jamais scroller horizontalement */
.preview-wrapper{
  overflow-x: hidden;          /* important: pas de scroll droite/gauche */
  overflow-y: auto;            /* autoriser le scroll vertical si besoin */
}

/* Conteneur qui centre la page */
.preview-wrapper{
  display: flex;
  justify-content: center;
}

/* La page A4 reste en dimensions "impression" mais on la scale via CSS variable */
#cvPreview{
  transform-origin: top center;
  transform: scale(var(--preview-scale, 1));
  /* évite qu'un scale crée un dépassement horizontal */
  margin: 0 auto;
}
/* =========================================================
   MODAL: éviter la coupe en haut + pas de scroll horizontal
   ========================================================= */

.modal-body{
  overflow-x: hidden;          /* pas de scroll horizontal */
  overflow-y: auto;            /* scroll vertical si le contenu est long */
  display: flex;
  justify-content: center;
  align-items: flex-start;     /* important: يبدأ من الأعلى (plus de coupe) */
  padding-top: 18px;           /* مساحة بسيطة فوق */
}

/* Scale responsive dans le modal أيضاً */
#cvPreviewModal{
  transform-origin: top center;
  transform: scale(var(--modal-scale, 1));
  margin: 0 auto;
}
/* =========================================================
   PATCH PREVIEW (A4 responsive) + FIX MODAL CROP
   Objectif:
   - Pas de scroll horizontal (mobile / petits écrans)
   - Garder le rendu "A4 impression" via un scale
   - Corriger la coupe en haut dans le Preview Modal
   ========================================================= */

/* -------- Aperçu à droite: pas de scroll horizontal -------- */
.preview-wrapper{
  overflow-x: hidden;           /* pas de scroll droite/gauche */
}

/* Scale responsive de la page A4 dans l'aperçu */
#cvPreview{
  transform-origin: top center;
  transform: scale(var(--preview-scale, 1));
  margin: 0 auto;
}

/* -------- Preview Modal: corriger coupe + pas de scroll horizontal -------- */
#previewModal .modal-box{
  display: flex;
  flex-direction: column;
  max-height: 90vh;             /* la box ne dépasse pas l'écran */
  overflow: hidden;              /* on scrolle dans le body */
}

/* IMPORTANT: override de .modal-body global (qui a overflow:hidden) */
#previewModal .modal-body{
  overflow-y: auto !important;  /* autoriser le scroll vertical si besoin */
  overflow-x: hidden !important;/* pas de scroll horizontal */
  padding-top: 16px;            /* évite la coupe en haut */
  display: flex;
  justify-content: center;
  align-items: flex-start;      /* commencer en haut (plus de coupe) */
}

/* Scale responsive de la page A4 dans le modal */
#cvPreviewModal{
  transform-origin: top center;
  transform: scale(var(--modal-scale, 1));
  margin: 0 auto;
}
/* =========================================================
   FIX: Coupe en haut dans la Prévisualisation du CV
   (uniquement pour le Preview Modal)
   ========================================================= */

#previewModal .preview-modal-body{
  overflow-y: auto;          /* autoriser le scroll vertical */
  overflow-x: hidden;        /* jamais de scroll horizontal */
  display: flex;
  justify-content: center;
  align-items: flex-start;   /* IMPORTANT: يبدأ من الأعلى */
  padding-top: 16px;         /* évite la coupe du header CV */
}
/* =========================================================
   FIX PREVIEW MODAL: pas de coupe en haut + pas de flex
   (uniquement pour #previewModal)
   ========================================================= */

#previewModal .modal-body{
  overflow-y: auto !important;   /* au lieu de hidden */
  overflow-x: hidden !important;
  display: block !important;     /* مهم: لا flex هنا */
  padding-top: 16px !important;  /* يمنع القص من الأعلى */
}

/* اختياري: يوسّط الصفحة بدون flex */
#previewModal #cvPreviewModal{
  margin: 0 auto;
}
/* =========================================================
   FIX TEMPLATE 2: fond sidebar jusqu'en bas de chaque page A4
   Contexte: en mode "multi-pages", .cv-template2 devient height:auto
   => le fond s'arrête avec le contenu. On force une hauteur minimale A4.
   ========================================================= */

/* =========================================================
   A4 PREVIEW (droite) + MODAL PREVIEW (sans duplication)
   + MULTI-PAGES (pages A4)
   ========================================================= */

/* A4 base */
.a4-page{
  width: 210mm;
  height: 297mm;                 /* صفحة A4 ثابتة */
  background: #fff;
  box-shadow: 0 0 20px rgba(0,0,0,.10);
  overflow: hidden;              /* مهم لقص المحتوى داخل الصفحة */
  position: relative;
}

/* Aperçu à droite */
.preview-wrapper{
  --zoom: 0.85;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 15px;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.preview-wrapper .a4-page{
  transform: scale(var(--zoom));
  transform-origin: top center;
}

/* Modal preview (scopé فقط لـ previewModal) */
#previewModal .modal-box{
  width: min(980px, 95vw);
  max-height: 90vh;
  background: #fff;
  border-radius: 0px !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* هذا أهم سطر: يمنع القص + يمنع مشاكل template2 */
#previewModal .modal-body{
  padding: 18px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: block !important;     /* لا flex هنا */
  background: #f8fafc;
}

#previewModal .a4-page{
  margin: 0 auto;
}

/* Zoom responsive */
@media (max-width: 1600px){ .preview-wrapper{ --zoom: 0.9; } }
@media (max-width: 1200px){ .preview-wrapper{ --zoom: 0.8; } }
@media (max-width: 992px){  .preview-wrapper{ --zoom: 0.7; } }
@media (max-width: 768px){  .preview-wrapper{ --zoom: 0.6; } }
@media (max-width: 576px){  .preview-wrapper{ --zoom: 0.5; } }

#cvPreview :where(
  p, span, div, h1, h2, h3, h4, h5, h6,
  li, td, th, strong, em, small, label
),
#cvPreviewModal :where(
  p, span, div, h1, h2, h3, h4, h5, h6,
  li, td, th, strong, em, small, label
) {
  font-family: var(--cv-font, "Roboto") !important;
  font-size: var(--cv-size, "12px");
}

/* Font Awesome – ضروري لـ html2canvas */
#cvPreview .cv-template .fa,
#cvPreview .cv-template .fas {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
}

#cvPreview .cv-template .far {
  font-family: "Font Awesome 6 Free";
  font-weight: 400;
}

#cvPreview .cv-template .fab {
  font-family: "Font Awesome 6 Brands";
  font-weight: 400;
}


/* container الذي سيحمل عدة صفحات */
#cvPreview.a4-pages,
#cvPreviewModal.a4-pages{
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
}

/* كل صفحة A4 في المعاينة */
.preview-page{
  width: 210mm;
  height: 297mm;
  background: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,0.10);
}

/* حاوية النسخة المزاحة للأعلى/الأسفل */
.preview-page .cv-slice{
  position: relative;
  width: 210mm;
}
/* =========================================================
   FIX GLOBAL: السماح للقوالب تتبع طول المحتوى
   (بدون ما نكسر القص داخل صفحات A4 لأن A4 هو اللي كيقص)
   ========================================================= */

.cv-template{
  width: 100%;
  height: auto !important;       /* مهم */
  min-height: unset !important;
  overflow: visible !important;  /* مهم */
  box-sizing: border-box;
}
/* =========================================================
   TEMPLATE 2: Sidebar + Main
   - Fond sidebar sur toute la hauteur (multi-pages)
   - 2 colonnes même sur mobile (dans l'aperçu A4)
   ========================================================= */

.cv-template2{
 font-family: inherit;
  display: flex;
  position: relative;            /* لازم لـ ::before */
  height: auto !important;
  min-height: 297mm !important;  /* مهم: يضمن أن الخلفية تصل لأسفل A4 */
}

/* طبقة خلفية sidebar تمتد حتى آخر القالب */
.cv-template2::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 35%;
  z-index: 0;
 background-color: var(--primary-color);
  opacity: 0.12;                 /* نفس تأثير color-mix تقريبًا */
  border-right: 2px solid rgba(0,0,0,0.08);
  z-index: 0;
}
/* sidebar */
.cv-template2 .cv-sidebar{
  width: 35%;
  flex: 0 0 35%;
  padding: 25px;
  background: transparent !important; /* الخلفية على ::before */
  border-right: none !important;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* main */
.cv-template2 .cv-main{
  width: 65%;
  flex: 1 1 65%;
  padding: 25px;
  position: relative;
  z-index: 1;
  min-width: 0;
}

/* تجنب خروج نص طويل */
.cv-template2 .cv-sidebar,
.cv-template2 .cv-main{
  overflow-wrap: anywhere;
  word-break: break-word;
}


/* =========================================================
   OVERRIDE: على الهاتف (داخل المعاينة A4) نبقى 2 colonnes
   لأن عندك Rule أخرى فآخر الملف كتدير column وكتكسر التصميم
   ========================================================= */
@media (max-width: 768px){
  /* مهم: نقيّدوها داخل صفحات المعاينة فقط */
  .a4-page .cv-template2,
  .preview-page .cv-template2{
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    min-height: 297mm !important;
  }

  .a4-page .cv-template2::before,
  .preview-page .cv-template2::before{
    width: 35% !important;
  }

  .a4-page .cv-template2 .cv-sidebar,
  .preview-page .cv-template2 .cv-sidebar{
    width: 35% !important;
    flex: 0 0 35% !important;
    padding: 16px !important;
  }

  .a4-page .cv-template2 .cv-main,
  .preview-page .cv-template2 .cv-main{
    width: 65% !important;
    flex: 1 1 65% !important;
    padding: 16px !important;
  }
}
.repeatable-item.is-collapsed .repeatable-body {
  display: none;
}

.collapse-btn {
  background: rgba(0,0,0,.06);
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}
.collapse-btn:hover {
  background: rgba(0,0,0,.06);
}
/* =========================================================
   FIX TEMPLATE 2: fond sidebar jusqu'en bas de chaque page A4
   Contexte: en mode "multi-pages", .cv-template4 devient height:auto
   => le fond s'arrête avec le contenu. On force une hauteur minimale A4.
   ========================================================= */

.cv-template4 {
    display: flex;
    min-height: 100%;
}

.cv-template4 .cv-header {
    margin-bottom: 15px;
}
.cv-template4 .cv-sidebar {
    width: 38%;
    background: #1f2437;
    padding: 25px;
}

.cv-template4 .cv-sidebar * {
    color: #FFF !important;
}

.cv-template4 .cv-main {
    width: 62%;
    padding: 25px;
    background: #e5e5e5;
}

.cv-template4 .progress-bar {
    height: 15px;
    background: #dbdbdb;
    border-radius: 0px !important;
    overflow: hidden;
    position: relative;
}

.cv-template4 .progress-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 0px !important;
    position: relative;
    background: var(--primary-color, #2563eb);
}

.cv-template4 .cv-section-title {
    font-size: 22px !important;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 5px;
    padding-bottom: 5px;
letter-spacing: 2px;
}

.cv-template4 .cv-skill-tag * {
    background: #f1f5f9 !important;
    padding: 6px 15px;
    border-radius: 20px;
    color: #fff;
    border: 1px solid #e2e8f0 !important;
}

.cv-template4 .cv-language-item-classic {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    border-bottom: 0px dotted #888787;
        color: #FFF;

}

.cv-template4 .cv-language-item-classic span:first-child {
    font-weight: 100;
}

/* النمط الأساسي للقوائم في الشريط الجانبي */
.cv-template4 .cv-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
}

.cv-template4 .cv-sidebar li {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    line-height: 1.6;
    position: relative;
    color: #444;
}

.cv-template4 .cv-sidebar li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

@media (max-width: 768px) {
  .cv-template4{
    flex-direction: row !important;   /* ne jamais passer en colonne */
    flex-wrap: nowrap !important;     /* empêcher le retour à la ligne */
    align-items: stretch;
  }

  .cv-template4 .cv-sidebar{
    width: 38% !important;
    flex: 0 0 38% !important;         /* largeur fixe */
    padding: 16px !important;         /* padding plus petit pour mobile */
  }

  .cv-template4 .cv-main{
    width: 62% !important;
    flex: 1 1 62% !important;
    padding: 16px !important;
  }

  /* Optionnel: éviter un débordement horizontal si un texte est trop long */
  .cv-template4 .cv-sidebar,
  .cv-template4 .cv-main{
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}
.cv-template4 .cv-namef {
    font-size: 40px !important;
    margin-bottom: 0 !important; /* إزالة الهامش السفلي */
    color: inherit;
    line-height: 1; /* تقليل تباعد الأسطر */
    letter-spacing: 2px;
}

.cv-template4 .cv-namel {
    font-size: 60px !important;
    margin-top: -10px !important; /* سحب العنصر للأعلى */
    margin-bottom: 10px;
    font-weight: bold;
    color: inherit;
    line-height: 1;
}
/* =========================================================
   TEMPLATE 2: Sidebar background full height (multi-pages)
   Solution: background on .cv-template4 via ::before, not on .cv-sidebar
   ========================================================= */

.cv-template4{
  position: relative;
}

/* Couche de fond qui couvre toute la hauteur du CV */
.cv-template4::before{
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;              /* couvre toute la hauteur */
  left: 0;
  width: 38%;
  z-index: 0;
  opacity: 0.12;                 /* نفس تأثير color-mix تقريبًا */
  z-index: 0;
}

/* Le contenu doit passer au-dessus de la couche ::before */
.cv-template4 .cv-sidebar,
.cv-template4 .cv-main{
  position: relative;
  z-index: 1;
}

.cv-template4 .cv-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cv-template4 .cv-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cv-template5:has(.cv-photo.no-photo) .cv-sidebar {
    padding-top: 15px !important;
}

.cv-template5:has(.cv-photo.no-photo) .cv-sidebar > :first-child {
    margin-top: 0 !important;
}

/* Adjust layout when no photo - Template 2 */
.cv-template4:has(.cv-photo.no-photo) .cv-sidebar {
    padding-top: 15px !important;
}

.cv-template4:has(.cv-photo.no-photo) .cv-sidebar > :first-child {
    margin-top: 0 !important;
}

/* تعديلات تلقائية للمحتوى عند اختفاء الصورة */
.cv-template:has(.cv-photo:not(:has(img))) .cv-header {
    margin-top: 0;
}

.cv-template1:has(.cv-photo:not(:has(img))) .cv-header {
    margin-top: 0;
}

.cv-template4:has(.cv-sidebar .cv-photo:not(:has(img))) .cv-sidebar {
    padding-top: 20px;
}

.cv-template4:has(.cv-sidebar .cv-photo:not(:has(img))) .cv-sidebar > :first-child:not(.cv-photo) {
    margin-top: 0;
}

.cv-template4 .cv-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.cv-template4 .cv-skill {
    background: #fff;
    padding: 6px 15px;
    border-radius: 20px;
    color: #000;
}

/* تحسين الاستجابة */
@media (max-width: 768px) {
    .cv-template4 {
        flex-direction: column;
    }
    
    .cv-template4 .cv-sidebar,
    .cv-template4 .cv-main {
        width: 100%;
    }
    
    .cv-name {
        font-size: 28px;
    }
    
    .fo-row {
        grid-template-columns: 1fr;
    }
    
    .date-row {
        grid-template-columns: 1fr;
    }
    
    .fo-container {
        gap: 20px;
    }
    
    .control-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .templates-grid {
        grid-template-columns:  repeat(2, minmax(0, 1fr));
    }
}

.cv-template4 .cv-contact-item {
    display: flex;
    width: 100%;
}

/* داخل صفحات المعاينة multi-pages */
.preview-page .cv-template4{
  min-height: 297mm !important;  /* hauteur d'une page A4 */
}

/* داخل المعاينة العادية (a4-page) وداخل المودال كذلك */
.a4-page .cv-template4{
  min-height: 297mm !important;
}

/* =========================================================
   OVERRIDE: على الهاتف (داخل المعاينة A4) نبقى 2 colonnes
   لأن عندك Rule أخرى فآخر الملف كتدير column وكتكسر التصميم
   ========================================================= */
@media (max-width: 768px){
  /* مهم: نقيّدوها داخل صفحات المعاينة فقط */
  .a4-page .cv-template4,
  .preview-page .cv-template4{
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    min-height: 297mm !important;
  }

  .a4-page .cv-template4::before,
  .preview-page .cv-template4::before{
    width: 38% !important;
  }

  .a4-page .cv-template4 .cv-sidebar,
  .preview-page .cv-template4 .cv-sidebar{
    width: 38% !important;
    flex: 0 0 38% !important;
    padding: 16px !important;
  }

  .a4-page .cv-template4 .cv-main,
  .preview-page .cv-template4 .cv-main{
    width: 62% !important;
    flex: 1 1 62% !important;
    padding: 16px !important;
  }
}

/* =========================
   Template 5 - Traditionnel Word
   ========================= */
.cv-template5{
  width: 210mm;
  min-height: 297mm;
  background: #f6f6f6;
  box-sizing: border-box;
  color: #111;
}

/* لضمان A4 داخل multi-pages */
.preview-page .cv-template5{ min-height: 297mm !important; }

.cv-template5 .t5-header{
  background: var(--primary-color);
  padding: 25px 35px;
}

.cv-template5 .t5-header-inner{
  display: flex;
  gap: 12mm;
  align-items: flex-start;
}

.cv-template5 .t5-photo{
    width: 160px;
    height: 180px;
  border: 0px solid rgba(0,0,0,.35);
  overflow: hidden;
  box-sizing: border-box;
}
.cv-template5 .t5-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cv-template5 .t5-photo-placeholder{
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.06);
}

.t5-photo .no-photo {
  display: none !important;
}

.t5-photo.is-empty {
  display: none !important;
}

/* وإذا كان t5-photo لا يحتوي إلا على no-photo → لا يأخذ مساحة */
.t5-photo:has(.no-photo) {
  display: none !important;
}

/* Template5: إذا لا توجد صورة أخفِ العمود/الحاوية كاملة */
.t5-photo:has(.cv-photo.no-photo) {
  display: none !important;
}

.cv-template5 .t5-name{
  font-size: 35px !important;
  font-weight: 900;
  letter-spacing: .4px;
}
.cv-template5 .t5-job{
  margin-top: 2mm;
  font-size: 16px !important;
  font-weight: 700;
  opacity: .9;
}
.cv-template5 .t5-contact{
  margin-top: 4mm;
  font-size: 11px;
  line-height: 1.5;
}

.t6-contact-row {
  display: flex;
  flex-direction: column; /* يجعل العناصر تحت بعض */
  gap: 8px; /* مسافة بين العناصر */
}

.cv-template5 .t5-body{
  padding: 8mm 10mm 10mm;
}

.cv-template5 .t5-row{
  display: grid;
  grid-template-columns: 44mm 1fr;
  gap: 8mm;
  padding: 4mm 0;
  border-top: 2px solid rgba(0,0,0,.25);
}

.cv-template5 .t5-section-title{
  width: 100%;
  padding: 2mm 3mm;
  font-weight: 900;
  font-size: 16px !important;
  letter-spacing: .3px;
  margin-top: -17px;
  border-top: 5px solid var(--primary-color);
  text-transform: uppercase;
}

.cv-template5 .t5-right{
  font-size: 11.5px;
  line-height: 1.55;
}

.cv-template5 .t5-blc{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin-top: 10px;}

.cv-template5 .t5-block{
  margin-bottom: 5mm;
}
.cv-template5 .t5-block:last-child{
  margin-bottom: 0;
}
.cv-template5 .t5-block-title{
  font-weight: 900;
  margin-bottom: 1mm;
}
.cv-template5 .t5-block-sub{
  font-weight: 700;
  font-size: 11px;
  opacity: .9;
  margin-bottom: 1.5mm;
}
.cv-template5 .t5-sep{
  margin: 0 6px;
  opacity: .6;
}
.cv-template5 .t5-paragraph{
  margin-top: 1mm;
}

.cv-template5 .t5-inline{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cv-template5 .t5-pill{
  display: inline-block;
  padding: 4px 8px;
  background: rgba(0,0,0,.07);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 999px;
  font-size: 11px;
}


.cv-template5 .skill-progress-item {
    margin-bottom: 0px;
}

.cv-template5 .progress-bar {
    height: 10px;
    background: #fff !important;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

/* Small screens */
@media (max-width: 900px){
  .cv-template5 .t5-row{
    grid-template-columns: 1fr;
    gap: 3mm;
  }
}



/* =========================
   Template 6 (cv-template6)
   Sidebar + Photo large + Contact card
   ========================= */

.cv-template6{
  width: 210mm;
  height: auto;
  min-height: 297mm;
  overflow: visible;
  background: #fff;
  display: flex;
  box-sizing: border-box;
}

/* لضمان A4 داخل multi-pages */
.preview-page .cv-template6{ min-height: 297mm !important; }

/* Sidebar */
.cv-template6 .t6-sidebar{
  width: 35%;
  background: #1d2730;
  color: #fff;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Photo */
.cv-template6 .t6-photo-wrap{
  width: 100%;
  height: 80mm;         /* كبير مثل الصورة */
  /* overflow: hidden;*/
  background: #cfd6dc;
}
.cv-template6 .t6-photo-wrap img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Contact card */
.cv-template6 .t6-contact-card{
  background: var(--primary-color);
  padding: 25px 25px;
  box-sizing: border-box;
}
.cv-template6 .t6-contact-row{
  display: flex;
  gap: 6px;
  margin-bottom: 3.5mm;
  font-size: 11px;
  line-height: 1.35;
}
.cv-template6 .t6-contact-label{
  min-width: 22mm;
  font-weight: 900;
}

/* Side sections */
.cv-template6 .t6-side-section{
  padding: 15px 25px;
  box-sizing: border-box;
}
.cv-template6 .t6-side-title{
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6mm;
}
.cv-template6 .t6-dot{
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: var(--primary-color);
  flex: 0 0 auto;
}
.cv-template6 .t6-title-text{
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 18px !important;
  text-transform: uppercase;
  white-space: nowrap;
}
.cv-template6 .t6-line{
  height: 5px;
  background: var(--primary-color);
  flex: 1;
}

/* Sidebar lists */
.cv-template6 .t6-side-list-wrap{ margin-top: 2mm; }
.cv-template6 .t6-side-list{
  margin: 0;
  padding-left: 18px;
}
.cv-template6 .t6-side-list li{
  margin-bottom: 3mm;
  font-size: 11.5px;
}

/* Progress (modern mode) */
.cv-template6 .t6-progress-list{
  display: grid;
  gap: 4mm;
}
.cv-template6 .t6-progress-name{
  font-size: 11.5px;
  margin-bottom: 2mm;
}
.cv-template6 .t6-level{
  opacity: .85;
  font-weight: 700;
}
.cv-template6 .t6-progress-bar{
  height: 6px;
  background: rgba(255,255,255,.25);
  border-radius: 999px;
  overflow: hidden;
}
.cv-template6 .t6-progress-fill{
  height: 100%;
  background: #fff;
  border-radius: 999px;
}

/* Main */
.cv-template6 .t6-main{
  width: 65%;
  padding: 25px 25px;
  box-sizing: border-box;
  color: #111;
}

/* Header name */
.cv-template6 .t6-header{ margin-bottom: 6mm; }
.cv-template6 .t6-name-line{
  font-size: 36px !important;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: .5px;
}
.cv-template6 .t6-first{
  font-size: 36px !important;
  color: var(--primary-color);
  margin-right: 6px;
}
.cv-template6 .t6-last{
font-size: 36px !important;
  color: #111;
}
.cv-template6 .t6-job{
  margin-top: 3mm;
  font-size: 18px !important;
  font-weight: 700;
  opacity: .9;
}

/* Profile */
.cv-template6 .t6-profile{
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 10mm;
  color: #222;
}

/* Main section title (same style) */
.cv-template6 .t6-section-title{
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10mm 0 5mm;
}

.cv-template6 .t6-references{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin-top: 10px;}

/* Items */
.cv-template6 .t6-item{
  margin-bottom: 7mm;
}
.cv-template6 .t6-item-title{
  font-weight: 900;
  font-size: 12.5px;
  margin-bottom: 1mm;
  color: var(--primary-color);
}
.cv-template6 .t6-meta{
  font-size: 11px;
  opacity: .75;
  margin-bottom: 1mm;
}
.cv-template6 .cv-item-date {
  color: #64748b;
  white-space: nowrap;
  margin-bottom: 1mm;
}

.cv-template6 .cv-item-date-education {
  color: #64748b;
  white-space: nowrap;
  margin: 1mm 0mm;
}


.cv-template6 .t6-text{
  font-size: 12px;
  line-height: 1.55;
}

/* Experience bullets */
.cv-template6 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template6 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
}

.cv-template5 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template5 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
}

.cv-template4 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template4 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
}

.cv-template3 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template3 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
}

.cv-template2 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template2 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
}

.cv-template1 .t6-bullets{
  margin: 0;
  padding-left: 18px;
}
.cv-template1 .t6-bullets li{
 /* margin-bottom: 2.5mm;*/
  font-size: 12px;
  line-height: 1.55;
  color: #000;
}
.cv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 5px;
  line-height: 1; /* يجعل أسطر النص متساوية */
}

.cv-title{ 
    font-size: 16px;
    font-weight:700;
margin: 0; /* إزالة هوامش النص */
  padding: 0;
}

.cv-lang-wrap{
  display:flex;
  align-items:center;
  gap:10px;
}

.cv-lang-label{
    width: 150px;
    font-weight: 500;
    margin: 0; /* إزالة هوامش النص */
  padding: 0;
}

.cv-lang-select{
  border:1px solid #d6d6d6;
  background:#fff;
  padding:7px 12px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
   height: fit-content;
  line-height: normal;
  width: 160px;
}
.cont,.cont-fluid{width:100%;padding-right:var(--bs-gutter-x,.75rem);padding-left:var(--bs-gutter-x,.75rem);margin-right:auto;margin-left:auto}@media (min-width: 576px) {
    .cont { max-width: 600px; }
}
@media (min-width: 768px) {
    .cont { max-width: 900px; }
}
@media (min-width: 992px) {
    .cont { max-width: 980px; }
}
@media (min-width: 1200px) {
    .cont { max-width: 1200px; }
}
@media (min-width: 1400px) {
    .cont { max-width: 1400px; }
}
.rows{--bs-gutter-y:0}
.rows{--bs-gutter-x:1.5rem;display:flex;flex-wrap:wrap;margin-top:calc(var(--bs-gutter-y)*-1);margin-right:calc(var(--bs-gutter-x)*-.5);margin-left:calc(var(--bs-gutter-x)*-.5)}.rows>*{flex-shrink:0;width:100%;max-width:100%;padding-right:calc(var(--bs-gutter-x)*.5);padding-left:calc(var(--bs-gutter-x)*.5);margin-top:var(--bs-gutter-y)}
@media(min-width:576px){.col-sm-12{flex:0 0 auto;width:100%}.d-sm-block{display:block!important}.d-sm-none{display:none!important}.p-sm-2{padding:.5rem!important}.text-sm-center{text-align:center!important}}@media (min-width: 768px) {
  .col-md-1 {
    flex: 0 0 auto;
    width: 8.33333333%;
  }
  .col-md-2 {
    flex: 0 0 auto;
    width: 16.66666667%;
  }
  .col-md-3 {
    flex: 0 0 auto;
    width: 25%;
  }
  .col-md-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }
  .col-md-5 {
    flex: 0 0 auto;
    width: 41.66666667%;
  }
  .col-md-6 {
    flex: 0 0 auto;
    width: 50%;
  }
  .col-md-7 {
    flex: 0 0 auto;
    width: 58.33333333%;
  }
  .col-md-8 {
    flex: 0 0 auto;
    width: 66.66666667%;
  }
  .col-md-9 {
    flex: 0 0 auto;
    width: 75%;
  }
  .col-md-10 {
    flex: 0 0 auto;
    width: 83.33333333%;
  }
  .col-md-12 {
    flex: 0 0 auto;
    width: 100%;
  }

  .d-md-block {
    display: block !important;
  }
  .d-md-none {
    display: none !important;
  }
  .mb-md-0 {
    margin-bottom: 0 !important;
  }
}
@media(min-width:992px){.col-lg-3{flex:0 0 auto;width:25%}.col-lg-4{flex:0 0 auto;width:33.33333333%}.col-lg-5{flex:0 0 auto;width:41.66666667%}.col-lg-6{flex:0 0 auto;width:50%}.col-lg-7{flex:0 0 auto;width:58.33333333%}.col-lg-8{flex:0 0 auto;width:66.66666667%}.col-lg-9{flex:0 0 auto;width:75%}.col-lg-10{flex:0 0 auto;width:83.33333333%}.col-lg-12{flex:0 0 auto;width:100%}.d-lg-block{display:block!important}.p-lg-5{padding:3rem!important}}@media(min-width:1400px){.cont{max-width:1320px}}