/* ======== General Styles & Variables ======== */
:root {
    --primary-color: #0056b3; /* A slightly brighter, more modern blue */
    --primary-color-light: #007bff;
    --text-color: #333;
    --background-color: #f4f4f4;
    --surface-color: #fff;
    --border-color: #ddd;
    --icon-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-mode {
    --primary-color: #42a5f5; /* A pleasant blue for dark mode */
    --primary-color-light: #90caf9;
    --text-color: #e0e0e0;
    --background-color: #121212; /* True dark for better contrast */
    --surface-color: #2d3748; /* A slightly lighter surface */
    --border-color: #444;
    --icon-color: #fff;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    background-color: var(--background-color); /* Updated */
    color: var(--text-color);
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.cv-container {
    width: 100%;
    max-width: 900px;
    background: var(--surface-color); /* Updated */
    box-shadow: 0 8px 32px var(--shadow-color); /* Softer, more modern shadow */
    border-radius: 8px;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

/* ======== Header Section ======== */
.cv-header {
    position: relative;
    background: url('2.jpg') center/cover no-repeat; /* Use 2.jpg */
    padding: 4rem 1rem;
    text-align: center;
    color: white;
}

.cv-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(13, 71, 161, 0.7), rgba(0, 102, 255, 0.5)); /* Softer gradient */
    backdrop-filter: blur(4px); /* Slightly less blur */
}

.header-content {
    position: relative;
    z-index: 2;
}

.profile-photo {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9); /* Thinner, slightly transparent border */
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.cv-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.cv-header .title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 1px;
}

/* ======== Main Content ======== */
.cv-main {
    padding: 2rem;
}

.contact-info {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--background-color); /* Updated */
    border-radius: 8px;
    margin-bottom: 2rem;
}

.contact-info span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-info i {
    color: var(--primary-color);
}

.contact-info a {
    text-decoration: none;
    color: var(--text-color); /* استخدام متغير لتوحيد اللون مع الوضع الفاتح/المظلم */
}

.social-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-inline-start: 2px solid var(--border-color);
    padding-inline-start: 1.5rem;
}

.social-links a {
    color: var(--text-color);
    font-size: 1.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-2px) scale(1.05); /* Lift-up effect */
}

.main-content {
    display: flex;
    gap: 2rem;
}

.column {
    flex: 1;
}

section {
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.4rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color); /* Use primary color for emphasis */
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

/* Icon spacing for section titles */
h2 > i {
    font-size: 1.2rem;
}
/* استخدام خصائص منطقية تعمل تلقائيًا مع اتجاه النص */
html:not([dir="rtl"]) h2 > i { margin-right: 0.5rem; } /* LTR */
html[dir="rtl"] h2 > i { margin-left: 0.5rem; } /* RTL */

.item {
    margin-bottom: 1rem;
}

.item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-bar {
    width: 100%;
    background-color: var(--background-color);
    border-radius: 5px;
    margin-top: 8px;
    height: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
    transition: background-color 0.3s ease;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

.item p {
    color: var(--text-color);
    opacity: 0.8;
}

/* ======== Accordion Cards (for Research, Articles, etc.) ======== */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-card {
    background-color: var(--background-color);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.accordion-title {
    font-size: 1.1rem;
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 !important; /* Override default h3 margin */
    transition: background-color 0.3s ease;
}

.accordion-title:hover {
    background-color: var(--background-color);
}

body.dark-mode .accordion-title:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.accordion-title::after {
    content: '▼';
    color: var(--primary-color);
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.accordion-card.active .accordion-title::after {
    transform: rotate(180deg);
}

.accordion-summary {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}

ul {
    list-style: none;
}

/* Styling for skills list */
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0 !important; /* Override bullet padding */
}

.skills-list li {
    width: 100%; /* Make each skill item take full width */
}


ul li {
    position: relative;
    margin-bottom: 0.5rem;
}
/* RTL list bullets */
/* Hide bullets for skills list */
.skills-list li::before {
    content: none !important;
}

html[dir="rtl"] ul { padding-right: 1rem; }
html[dir="rtl"] ul li::before {
    content: '•';
    position: absolute;
    right: -1rem;
    color: var(--primary-color);
}

/* LTR list bullets */
html[dir="ltr"] ul { padding-left: 1rem; }
html[dir="ltr"] ul li::before {
    content: '•';
    position: absolute;
    left: -1rem;
    color: var(--primary-color);
}

/* ======== Page Controls (Theme/Lang) ======== */
.page-controls {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}
.control-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface-color);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.theme-icon {
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--icon-color);
    transition: color 0.3s ease;
}

.theme-icon:hover {
    color: var(--primary-color);
}

/* Hide the inactive theme icon */
.dark-mode #sun-icon,
body:not(.dark-mode) #moon-icon {
    display: none;
}

.lang-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: bold;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.download-btn {
    background: none;
    border: none;
    color: var(--icon-color);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lang-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* ======== Responsive Design ======== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    .cv-container {
        border-radius: 0;
    }
    .main-content {
        flex-direction: column;
    }
    .contact-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .social-links {
        border-left: none;
        padding-left: 0;
        width: 100%;
        border-inline-start: none;
        padding-inline-start: 0;
    }
    .accordion-title {
        font-size: 1rem;
    }
    .page-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* ======== Utility & PDF Generation Styles ======== */

/* For visually hiding text but keeping it for screen readers */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Styles for PDF Generation - to prevent layout issues */
.pdf-generating .page-controls {
    display: none; /* Hide controls in PDF */
}
.pdf-generating .cv-container {
    box-shadow: none; /* Remove shadow for cleaner PDF */
    margin: 0;
    max-width: 100%;
    border-radius: 0;
}
.pdf-generating .main-content {
    display: block; /* Stack columns vertically */
}
.pdf-generating .column {
    width: 100%;
    float: none;
}
.pdf-generating .item,
.pdf-generating .accordion-card {
    page-break-inside: avoid;
}
