:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #06b6d4;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-2: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Inter', sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --cv-font-family-ar: 'Cairo', sans-serif;
    --cv-font-family-en: 'Inter', sans-serif;
    --cv-font-size: 10pt;
    --cv-line-height: 1.5;
}

/* === Easy CV Icon Tweaks === */
.logo-icon {
    width: 44px;
    height: 44px;
    /* كان سابقًا خلفية متدرجة — الآن نعرض SVG نفسه */
    background: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .logo-icon .easycv-logo { width: 100%; height: 100%; display: block; }
  
  /* ألوان إضافية قابلة للتخصيص عبر المتغيرات */
  :root {
    --icon-stroke: #cbd5e1;   /* سطور الورقة */
    --icon-accent: #22d3ee;   /* علامة الصح */
    --icon-pen: #0ea5e9;      /* ريشة القلم */
  }
  
  /* تحسين التباين في الوضع الداكن */
  [data-theme="dark"] {
    --icon-stroke: #9ca3af;
    --icon-accent: #60a5fa; /* أزرق أفتح على الخلفيات الداكنة */
    --icon-pen: #38bdf8;
  }
 
  
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-2: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --border-light: #475569;
    --primary-light: #312e81;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ar);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
    position: relative;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: linear-gradient(135deg, var(--primary-light) 0%, transparent 30%),
        linear-gradient(225deg, var(--secondary-color) 0%, transparent 30%);
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

html[lang="en"] body {
    font-family: var(--font-en);
}

.header {
    background: var(--background);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-light);
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: var(--transition);
    padding: 1rem 0;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between; /* Keeps logo and actions apart */
    align-items: center;
}

/* === تمت إزالة القاعدة السابقة flex-direction: row-reverse; === */


.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: var(--transition);
    order: 1; /* Make logo appear first (left) in LTR */
}
html[dir="rtl"] .logo {
    order: 1; /* Keep logo first (right) in RTL */
}


.logo:hover {
    transform: translateY(-2px);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-md);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-title-mobile {
    display: none;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    order: 2; /* Make actions appear second (right) in LTR */
}
html[dir="rtl"] .header-actions {
    order: 2; /* Keep actions second (left) in RTL */
}


.header-nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* ==== تم التعديل ==== تقليل المسافة من 0.75rem */
}

/* --- الإضافة هنا --- */
/* تقليل المسافة بين الأزرار في النسخة الإنجليزية (LTR) لتبدو مضغوطة أكثر */
html[dir="ltr"] .header-nav-links {
    gap: 0.5rem;
}

/* ==== إضافة لتعديل حشو الأزرار وتقليل الازدحام ==== */
.header-nav-links .btn-secondary {
    padding-left: 0.75rem;   /* تقليل الحشو الأفقي من 1rem */
    padding-right: 0.75rem;  /* تقليل الحشو الأفقي من 1rem */
}

/* === تعديل إضافي للنسخة الإنجليزية (LTR) === */
html[dir="ltr"] .header-nav-links .btn-secondary {
    padding-left: 0.5rem;   /* تقليل إضافي للحشو */
    padding-right: 0.5rem;  /* تقليل إضافي للحشو */
    font-size: 0.75rem;     /* تصغير الخط قليلاً */
}
/* === نهاية الإضافة === */
/* --- نهاية الإضافة --- */


#mobileMenuToggle {
    display: none;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none; /* Remove underline from anchor tags styled as buttons */
    height: 38px;
}

.btn-primary {
    padding: 0.5rem 1.25rem;
}


.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-md);
}

.lang-switcher {
    display: flex;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    box-shadow: var(--shadow-sm);
    height: 38px; /* Match button height */
    align-items: center;
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.875rem;
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .lang-btn.active {
    background: var(--surface-2);
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem 0;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.form-container {
    background: var(--background);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.form-container::-webkit-scrollbar {
    width: 8px;
}

.form-container::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 10px;
}

.form-container::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--primary-color), var(--secondary-color));
    border-radius: 10px;
}

.controls-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.controls-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.controls-title i {
    color: var(--primary-color);
    font-size: 1rem;
}

.template-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.template-card {
    background: var(--background);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: var(--transition);
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.template-card.active {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

[data-theme="dark"] .template-card.active {
     background: var(--surface-2);
}

[data-theme="dark"] .template-card.active .template-name {
    color: var(--text-primary);
}

.template-icon-wrapper {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    position: relative;
    z-index: 1;
}

.template-card[data-template="modern"] .template-icon-wrapper {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.template-card[data-template="classic"] .template-icon-wrapper {
    background: linear-gradient(135deg, #10b981, #06b6d4);
}

.template-card[data-template="creative"] .template-icon-wrapper {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.template-card[data-template="corporate"] .template-icon-wrapper {
    background: linear-gradient(135deg, #64748b, #475569);
}

.template-name {
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

.color-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.color-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--background);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
}

.color-dot:hover {
    transform: scale(1.15);
}

.color-dot.active {
    box-shadow: 0 0 0 3px var(--background), 0 0 0 5px var(--primary-color);
}

.color-dot.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
}

.accordion-item {
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: var(--transition);
}

.accordion-header {
    padding: 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    position: relative;
}

.accordion-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: var(--transition);
    border-radius: 0 4px 4px 0;
}

html[dir="ltr"] .accordion-header::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
}

.accordion-header.active::before {
    height: 60%;
}

.accordion-header:hover {
    background: var(--surface-2);
}

.accordion-header i:first-child {
    margin-inline-end: 0.75rem;
    color: var(--primary-color);
}

.accordion-icon {
    transition: transform 0.3s;
    color: var(--text-tertiary);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 1.25rem;
}

.accordion-content.active {
    max-height: 2000px;
    padding: 0 1.25rem 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.875rem;
    background: var(--background);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.dynamic-item {
    background: var(--background);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.remove-btn {
    position: absolute;
    top: -8px;
    inset-inline-end: -8px;
    width: 32px;
    height: 32px;
    background: var(--danger-color);
    color: white;
    border: 2px solid var(--background);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.remove-btn:hover {
    transform: rotate(90deg) scale(1.1);
}

.btn-add {
    width: 100%;
    background: transparent;
    color: var(--primary-color);
    border: 2px dashed var(--primary-color);
    opacity: 0.7;
    transition: var(--transition);
}

.btn-add:hover {
    opacity: 1;
    background: var(--primary-light);
}

.btn-group {
    display: flex;
    width: 100%;
    background: var(--background);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.btn-group-item {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-group-item:not(:last-child) {
    border-inline-end: 2px solid var(--border-light);
}
.btn-group-item.active {
    background: var(--primary-color);
    color: white;
}
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition);
    border-radius: 34px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}
input:checked + .toggle-slider {
    background-color: var(--primary-color);
}
input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--primary-color);
}
input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.form-group-relative {
    position: relative;
}
.assistant-btn {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary-color);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    opacity: 0.7;
}
.assistant-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}
.assistant-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
}
.assistant-tab-btn {
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.assistant-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.assistant-content {
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 1rem;
}
.assistant-content::-webkit-scrollbar {
    width: 6px;
}
.assistant-content::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 10px;
}
.assistant-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.suggestion-category {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-light);
}
.suggestion-list {
    list-style: none;
    padding: 0;
}
.suggestion-item {
    padding: 0.875rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.suggestion-item:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary-color);
    transform: translateX(4px);
}
html[dir="ltr"] .suggestion-item:hover {
    transform: translateX(-4px);
}

.preview-container {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    position: sticky;
    top: 2rem;
    height: calc(100vh - 4rem);
}

.cv-preview-wrapper {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    height: 100%;
    overflow-y: auto;
}

.cv-preview-wrapper::-webkit-scrollbar {
    width: 8px;
}
.cv-preview-wrapper::-webkit-scrollbar-track {
    background: var(--surface-2);
    border-radius: 10px;
}
.cv-preview-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#cvPreview {
    background: white;
    width: 210mm;
    min-height: 297mm;
    box-shadow: var(--shadow-xl);
    color: #1e293b;
    font-size: var(--cv-font-size);
    line-height: var(--cv-line-height);
    transition: var(--transition);
    border-radius: var(--radius-md);
    transform-origin: top center;
}

html[lang="ar"] #cvPreview {
    font-family: var(--cv-font-family-ar);
}

html[lang="en"] #cvPreview {
    font-family: var(--cv-font-family-en);
}

.font-size-small { --cv-font-size: 9pt; }
.font-size-medium { --cv-font-size: 10pt; }
.font-size-large { --cv-font-size: 11pt; }

.line-spacing-compact { --cv-line-height: 1.4; }
.line-spacing-normal { --cv-line-height: 1.6; }
.line-spacing-relaxed { --cv-line-height: 1.8; }

.icons-hidden .cv-section-title i,
.icons-hidden .cv-contact-list i,
.icons-hidden .cv-contact i {
    display: none;
}

/* --- Privacy Mode Styles --- */

/* --- End Privacy Mode Styles --- */

#cvPreview .cv-entry-subtitle,
#cvPreview .cv-title {
    color: #64748b;
}

.cv-name {
    color: var(--primary-color);
    font-weight: 800;
}

.cv-section-title {
    color: var(--primary-color);
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.cv-entry {
    margin-bottom: 1.5rem;
}

.cv-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.cv-entry-description {
    margin-top: 0.5rem;
    padding-right: 1rem;
    border-right: 3px solid #e2e8f0;
}

html[dir="ltr"] .cv-entry-description {
    padding-right: 0;
    padding-left: 1rem;
    border-right: none;
    border-left: 3px solid #e2e8f0;
}

.cv-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--primary-color);
    object-fit: cover;
}

.cv-skill-badge,
.cv-language-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    margin: 0.25rem;
    background: var(--surface-2);
    color: var(--text-primary);
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.85em;
}

#cvPreview.modern {
    display: flex;
    overflow: hidden;
}

.modern .cv-sidebar {
    width: 35%;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    padding: 2cm;
    color: #cbd5e1;
}

.modern .cv-sidebar * {
     color: inherit;
}

.modern .cv-sidebar h1,
.modern .cv-sidebar h2,
.modern .cv-sidebar h3,
.modern .cv-sidebar .cv-name,
.modern .cv-sidebar .cv-sidebar-title {
     color: white;
}

.modern .cv-sidebar .cv-title {
    color: #94a3b8;
}

.modern .cv-main-content {
    width: 65%;
    padding: 2cm;
}

.modern .cv-photo {
    margin: 0 auto 1.5rem auto;
    display: block;
}

.modern .cv-name {
    text-align: center;
}

.modern .cv-title {
    text-align: center;
}

.modern .cv-sidebar-title {
    border-bottom-color: #475569;
}

.modern .cv-contact-list {
    list-style: none;
    padding: 0;
}

.modern .cv-contact-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.modern .cv-contact-list i {
    color: var(--secondary-color);
    width: 16px;
    text-align: center;
}

.modern .cv-skill-badge,
.modern .cv-language-badge {
    background: #334155;
    color: #f1f5f9;
}

#cvPreview.classic {
    padding: 2cm;
}

.classic .cv-header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: 2rem;
}

.classic .cv-name {
    font-size: 2.5em;
}

.classic .cv-title {
    font-size: 1.3em;
    margin-top: 0.5rem;
}

.classic .cv-contact {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 2rem;
    font-size: 0.9em;
}

.classic .cv-contact span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#cvPreview.creative {
    padding: 0;
}

.creative .cv-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    padding: 2cm;
    text-align: right;
    position: relative;
    overflow: hidden;
    color: white;
}

.creative .cv-header * {
    color: inherit;
}

.creative .cv-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 50%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
}

html[dir="ltr"] .creative .cv-header {
    text-align: left;
}

.creative .cv-name {
    font-size: 2.8em;
    position: relative;
    z-index: 1;
}

.creative .cv-title {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.4em;
    position: relative;
    z-index: 1;
}

.creative .cv-main-content {
    padding: 2cm;
}

#cvPreview.corporate {
    padding: 2cm;
}

.corporate .cv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 4px solid var(--primary-color);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.corporate .cv-name {
    font-size: 2.5em;
    margin-bottom: 0.25rem;
}

.corporate .cv-title {
    font-size: 1.3em;
}

.corporate .cv-contact {
    text-align: left;
    font-size: 0.9em;
}

html[dir="ltr"] .corporate .cv-contact {
    text-align: right;
}

.corporate .cv-contact div {
    margin-bottom: 0.5rem;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    color: var(--text-secondary);
    line-height: 1.7;
}

.features-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
}

.features-list li {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.features-list i {
    color: var(--success-color);
    font-size: 1.2rem;
    margin-top: 4px;
}

.modal-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.quality-score-container {
    text-align: center;
    margin-bottom: 2rem;
}

.quality-score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: conic-gradient(var(--success-color) 85%, var(--border-light) 85%);
    position: relative;
    transition: background 0.5s;
}

.quality-score-circle::before {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--background);
    border-radius: 50%;
}

#qualityScore {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
}

.quality-score-container p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 350px;
    margin: 0 auto;
}

.quality-suggestions-list {
    list-style: none;
    padding: 0;
}

.quality-suggestions-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.quality-suggestions-list .suggestion-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.suggestion-good {
    background-color: #ecfdf5;
    color: #059669;
}
.suggestion-good .suggestion-icon { color: #10b981; }

.suggestion-warning {
    background-color: #fffbeb;
    color: #b45309;
}
.suggestion-warning .suggestion-icon { color: #f59e0b; }

.suggestion-critical {
    background-color: #fef2f2;
    color: #b91c1c;
}
.suggestion-critical .suggestion-icon { color: #ef4444; }

[data-theme="dark"] .suggestion-good { background-color: #064e3b; color: #a7f3d0; }
[data-theme="dark"] .suggestion-warning { background-color: #78350f; color: #fde68a; }
[data-theme="dark"] .suggestion-critical { background-color: #7f1d1d; color: #fecaca; }


.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    font-size: 3rem;
    color: white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.site-footer {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    margin-top: 4rem;
    position: relative;
    overflow: hidden;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
}

.footer-text {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.footer-text a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.footer-text a:hover {
    color: var(--primary-dark);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-link {
    width: 42px;
    height: 42px;
    background: var(--background);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.footer-legal-text {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    max-width: 800px;
    margin: 1rem auto 1.5rem;
    line-height: 1.6;
}

.footer-disclaimer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    border-left: 4px solid var(--primary-color);
    border-right: 4px solid var(--primary-color);
    text-align: center;
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .form-container, .preview-container {
        position: static;
        max-height: none;
        height: auto;
    }
}


/* ==== إخفاء زر التحميل للجوال في سطح المكتب ==== */
.btn-mobile-download {
    display: none !important;
}

@media (max-width: 768px) {
    .header-container,
    .main-container {
        padding: 0 1rem;
    }
    .main-container {
        padding-top: 1.5rem;
        gap: 1rem;
    }
    .header {
        padding: 0.75rem 0;
    }
    .logo-text {
        display: none;
    }

    .header-title-mobile {
        display: block;
    }

    .header-actions {
        gap: 0.25rem;
    }

    #mobileMenuToggle {
        display: inline-flex;
        z-index: 101;
    }
    .header-nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--background);
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        box-shadow: var(--shadow-lg);
        border-top: 1px solid var(--border-light);
        animation: slideDown 0.3s ease-in-out;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .header-nav-links.active {
        display: flex;
    }
    .header-nav-links .btn span:not(.sr-only) {
        display: inline-block;
    }
    .header-nav-links .btn,
    .header-nav-links .btn-icon,
    .header-nav-links .lang-switcher {
        width: 100%;
        padding-left: 1rem;
        padding-right: 1rem;
        justify-content: flex-start;
    }
    /* ==== إضافة إصلاحات الجوال ==== */
    /* إصلاح تنسيق الأزرار داخل القائمة المنسدلة للجوال */
    .header-nav-links .btn-secondary {
        background: var(--surface);
        color: var(--text-primary);
        border: 1px solid var(--border-color);
    }
    
    /* إظهار زر التحميل المخصص للجوال */
    .btn-mobile-download {
        display: inline-flex !important;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        margin-inline-start: 0.5rem; /* لإضافة مسافة بينه وبين زر القائمة */
    }

    /* إخفاء زر التحميل الأصلي من داخل القائمة المنسدلة */
    .header-nav-links #downloadBtn {
        display: none;
    }
    /* ==== نهاية إصلاحات الجوال ==== */

    .header-nav-links .lang-switcher {
        justify-content: space-around;
    }

    .template-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    .form-container, .preview-container {
        padding: 0.75rem;
    }
    #cvPreview {
        width: 100% !important;
        min-height: auto !important;
        font-size: 8.5pt;
        padding: 1rem !important;
        box-shadow: none;
    }
    
    #cvPreview.modern {
        flex-direction: column;
    }

    .modern .cv-sidebar,
    .modern .cv-main-content {
        width: 100%;
        padding: 1.5rem;
    }
    
    .cv-entry {
        margin-bottom: 1rem;
    }
    .cv-section-title {
        margin-bottom: 0.75rem;
        padding-bottom: 0.4rem;
    }
    .cv-skill-badge, .cv-language-badge {
        padding: 0.3rem 0.8rem;
        font-size: 0.8em;
    }
    .cv-photo {
        width: 90px;
        height: 90px;
    }
    .classic .cv-name, .corporate .cv-name {
        font-size: 1.8em;
    }
    .creative .cv-name {
        font-size: 2em;
    }
    .classic .cv-title, .corporate .cv-title, .creative .cv-title {
        font-size: 1.1em;
    }
    .classic .cv-contact {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    .corporate .cv-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .modal-content {
        padding: 2rem 1.25rem;
        max-height: 85vh;
        overflow-y: auto;
    }

    .features-list li span {
        flex: 1;
    }
}

/* ==== إخفاء زر تحميل الجوال من سطح المكتب ==== */
.btn-mobile-download {
    display: none;
}

.loading {
    pointer-events: none;
    opacity: 0.6;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-light);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media print {
    body > *:not(.main-container) { display: none; }
    .main-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        grid-template-columns: 1fr !important;
    }
    .form-container { display: none !important; }
    .preview-container {
        display: block !important;
        position: static !important;
        height: auto !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }
    .cv-preview-wrapper {
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
        border-radius: 0 !important;
    }
    #cvPreview {
        box-shadow: none !important;
        margin: 0 auto !important;
        width: 100% !important;
        min-height: 0 !important;
        height: auto !important;
        transform: scale(1) !important;
        border-radius: 0 !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.page-content {
    opacity: 0;
    animation: pageLoad 0.5s ease forwards;
    animation-delay: 0.2s;
}

@keyframes pageLoad {
    to {
        opacity: 1;
    }
}



/* === Fix: منع خروج الورقة خارج الإطار مع تمرير طبيعي === */

/* قصّ المحتوى عند حواف بطاقة المعاينة */
.preview-container{
    overflow: hidden !important;                    /* يمنع أي جزء يخرج خارج نصف القطر */
    border-radius: var(--radius-xl) !important;     /* تأكيد الحواف */
    -webkit-mask-image: -webkit-radial-gradient(white, black); /* قصّ ظل الورقة في WebKit */
  }
  
  /* التمرير يكون داخل الغلاف الداخلي فقط */
  .cv-preview-wrapper{
    height: 100%;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    display: flex;                 /* إبقاء الورقة في المنتصف */
    justify-content: center;
    align-items: flex-start;
    padding-bottom: 24px;          /* يمنع التصاق الذيل بأسفل الإطار عند آخر التمرير */
  }
  
  /* الورقة: لا تمرير داخلي ولا حجم ثابت يسبب التسرب */
  #cvPreview{
    height: auto !important;       /* تلائم طول المحتوى */
    min-height: 297mm !important;  /* حد أدنى بحجم A4 فقط */
    max-width: 100%;               /* في الشاشات الضيقة لا تتجاوز الغلاف */
    margin: 0;                     /* يمنع أي فراغ يدفع الورقة خارج الإطار */
    overflow: visible !important;  /* لا سكرول داخل الورقة */
    box-sizing: border-box;
  }
  
  /* شبكات/أعمدة داخل الورقة لا تجبرها على التمدد */
  #cvPreview .cv-main-content,
  #cvPreview .cv-sidebar{
    min-width: 0;                  /* مهم جدًا مع grid/flex */
  }
  
  /* في الشاشات الصغيرة: ألغِ sticky حتى يبقى التمرير طبيعي */
  @media (max-width: 1024px){
    .preview-container{
      position: static !important;
      height: auto !important;
    }
  }

/* ==== إصلاح أزرار الوضع الداكن ==== */
[data-theme="dark"] .btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary:hover {
    background: var(--surface);
}

/* === ADD THIS CODE BELOW === */

.footer-disclaimer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    border-left: 4px solid var(--primary-color);
    border-right: 4px solid var(--primary-color);
    text-align: center;
}

/* ==== Signature Generator Styles ==== */
.signature-preview {
    background: var(--surface-2);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1rem 0 2rem 0;
    font-family: Arial, sans-serif; /* Use a common email font */
    color: #333; /* Darker text for email context */
    line-height: 1.5;
}

[data-theme="dark"] .signature-preview {
     background: var(--surface);
     color: var(--text-primary);
}
/* ==== End Signature Generator Styles ==== */

/* === MODAL SCROLL & DISCLAIMER STYLES === */
.modal-body.scrollable {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1rem; /* لإظهار شريط التمرير بشكل جيد */
    line-height: 1.7;
    color: var(--text-secondary);
}

html[dir="ltr"] .modal-body.scrollable {
     padding-right: 0;
     padding-left: 1rem;
}

.modal-body.scrollable::-webkit-scrollbar {
    width: 8px;
}
.modal-body.scrollable::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 10px;
}
.modal-body.scrollable::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
.modal-body.scrollable:hover::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
}

.modal-body.scrollable h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}
.modal-body.scrollable h3:first-of-type {
    margin-top: 0;
}

.modal-body.scrollable p {
    margin-bottom: 1rem;
}

.modal-body.scrollable p:last-of-type {
    margin-bottom: 0;
}

.modal-body.scrollable code {
    background: var(--surface-2);
    color: var(--primary-dark);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.9em;
}

[data-theme="dark"] .modal-body.scrollable code {
    background: var(--surface);
    color: var(--primary-light);
}

/* === END MODAL SCROLL & DISCLAIMER STYLES === */

/* وضع تصدير: نجبر عرض الـCV ليطابق A4 على أي جهاز */
.exporting #cvPreview,
#printExportWrapper {
  width: 794px;            /* ~ 210mm عند 96dpi */
  min-width: 794px;
  max-width: 794px;
  margin: 0 auto;
  transform: none !important;
  zoom: 1 !important;
}

/* اختياري: نمط للطباعة أيضاً */
@media print {
  #cvPreview { width: 210mm; }
}


/* ============================================
   Terms & Disclaimer Modal Styling
   ============================================ */

.terms-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.terms-section:last-child {
    border-bottom: none;
}

.terms-section h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.terms-section h4 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.terms-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.terms-section ul {
    margin: 0.5rem 0;
    padding-right: 1.5rem;
    color: var(--text-secondary);
}

.terms-section ul li {
    margin-bottom: 0.4rem;
    line-height: 1.7;
}

.modal-body.scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--surface);
}

.modal-body.scrollable::-webkit-scrollbar {
    width: 8px;
}

.modal-body.scrollable::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 4px;
}

.modal-body.scrollable::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-body.scrollable::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Footer Link Styling */
.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.footer-separator {
    margin: 0 0.5rem;
    color: var(--text-tertiary);
}