/* Global Variables */
:root {
    --primary-color: #007BFF; /* A vibrant blue */
    --secondary-color: #6C757D; /* Darker gray for secondary text */
    --background-light: #F8F9FA; /* Light gray for sections */
    --background-dark: #FFFFFF; /* White for primary backgrounds */
    --text-color-light: #343A40; /* Dark text for light mode */
    --text-color-dark: #FFFFFF; /* Light text for dark mode */
    --card-background-light: #FFFFFF;
    --card-background-dark: #2C2C2C; /* Darker background for dark mode cards */
    --border-color-light: #DEE2E6; /* Light border */
    --border-color-dark: #444; /* Darker border */
    --shadow-color-light: rgba(0, 0, 0, 0.1);
    --shadow-color-dark: rgba(0, 0, 0, 0.3);
    --link-hover-color: #0056b3; /* Darker blue for link hover */
    --button-hover-bg: #0056b3;
    --footer-bg-light: #E9ECEF;
    --footer-bg-dark: #222;
    --error-color: #dc3545; /* Red for errors */
    --success-color: #28a745; /* Green for success */


    /* Dark Mode specific variables (overridden by .dark-mode) */
    --current-background: var(--background-dark);
    --current-text-color: var(--text-color-light);
    --current-section-bg: var(--background-light);
    --current-card-bg: var(--card-background-light);
    --current-border-color: var(--border-color-light);
    --current-shadow-color: var(--shadow-color-light);
    --current-footer-bg: var(--footer-bg-light);
    --current-hamburger-color: var(--text-color-light); /* Hamburger icon color */
     --current-input-bg: var(--background-dark); /* Input background */
    --current-input-border: var(--border-color-light);
}

/* Dark Mode Overrides */
body.dark-mode {
    --current-background: #1A1A1A; /* Very dark background */
    --current-text-color: var(--text-color-dark);
    --current-section-bg: #222; /* Slightly lighter dark for sections */
    --current-card-bg: var(--card-background-dark);
    --current-border-color: var(--border-color-dark);
    --current-shadow-color: var(--shadow-color-dark);
    --current-footer-bg: #222; /* Consistent dark footer */
    --current-hamburger-color: var(--text-color-dark); /* Hamburger icon color */
    --current-input-bg: #333; /* Darker input background */
    --current-input-border: #555;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--current-text-color);
    background-color: var(--current-background);
    transition: background-color 0.3s ease, color 0.3s ease;
    scroll-behavior: smooth; /* Smooth scrolling for nav links */
}

body.rtl {
    direction: rtl;
    text-align: right;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.8em;
    color: var(--current-text-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-padding {
    padding: 80px 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    border-radius: 50px; /* Fully rounded */
    font-weight: 600;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    box-shadow: 0 4px 8px var(--current-shadow-color);
}

.btn-primary:hover {
    background-color: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px var(--current-shadow-color);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
    border-radius: 20px;
    display: inline-flex; /* Use flex to align icon and text */
    align-items: center;
    gap: 5px; /* Space between text and icon */
}

.btn-details {
     background-color: transparent;
     color: var(--secondary-color);
     border: 1px solid var(--secondary-color);
     transition: background-color 0.3s ease, color 0.3s ease;
}

.btn-details:hover {
    background-color: var(--secondary-color);
    color: var(--text-color-dark);
    transform: translateY(-2px);
}


.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--secondary-color);
    color: var(--text-color-dark);
    box-shadow: none;
    border: none;
}

.btn-disabled:hover {
    transform: none;
    background-color: var(--secondary-color);
    box-shadow: none;
}


/* Header & Navigation */
.header {
    background-color: var(--current-background);
    color: var(--current-text-color);
    padding: 15px 0;
    box-shadow: 0 2px 10px var(--current-shadow-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.8em;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links li a {
    color: var(--current-text-color);
    font-weight: 600;
    position: relative;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    left: 0;
    bottom: -5px;
    transition: width 0.3s ease;
}

body.rtl .nav-links li a::after {
    left: auto;
    right: 0;
}


.nav-links li a:hover::after {
    width: 100%;
}

.icon-button {
    background: none;
    border: none;
    font-size: 1.3em;
    color: var(--current-text-color);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.icon-button:hover {
    color: var(--primary-color);
}

.hamburger-menu {
    display: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--current-hamburger-color);
    transition: color 0.3s ease;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 15px; /* Space from Dark Mode toggle */
}

body.rtl .language-switcher {
    margin-left: 15px;
    margin-right: 0;
}


.lang-button {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.lang-button:hover {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
}

.lang-button.active {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
}

/* Home Section (Hero) */
.hero-section {
    min-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: var(--current-background);
    transition: background-color 0.3s ease;
}

.hero-content {
    max-width: 800px;
    padding: 20px;
}

.profile-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary-color);
    margin-bottom: 20px;
    box-shadow: 0 8px 16px var(--current-shadow-color);
}

.hero-section h1 {
    font-size: 3.5em;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero-section p {
    font-size: 1.5em;
    color: var(--secondary-color);
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* General Section Styles */
section:nth-child(even) {
    background-color: var(--current-section-bg);
}

section h2 {
    font-size: 2.5em;
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    padding-bottom: 10px;
}

section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* About Me Section */
.about-section p {
    font-size: 1.1em;
    max-width: 800px;
    margin: 0 auto 20px auto;
    text-align: center;
}

.about-section p:last-of-type {
    margin-bottom: 0;
}

/* Education Section Grid Layout */
.education-grid {
    display: grid;
    /* On larger screens, try to fit items in 3 columns */
    grid-auto-flow: column; /* Arrange items in a row */
    grid-auto-columns: calc(100% / 3); /* Show 3 items at a time (adjust as needed) */
    gap: 30px; /* Space between the education items */
    transition: transform 0.5s ease-in-out; /* Smooth slide transition */
}

/* Education Section Slider Specific Styles */
.education-slider-container {
    position: relative; /* For absolute positioning of arrows */
    max-width: 1200px; /* Match container width */
    margin: 0 auto; /* Center the slider */
    overflow: hidden; /* HIDE OVERFLOWING SLIDES */
    padding: 0 40px; /* Space for arrows to sit inside or near edges */
}

/* Adjustments for education-item within the slider */
.education-grid .education-item {
    background-color: var(--current-card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    scroll-snap-align: start; /* Optional: for smooth snap when scrolling */
    flex-shrink: 0; /* Prevent items from shrinking */
    width: 100%; /* Ensure each item takes up its defined column width */
    display: flex; /* Use flex to make content fill height */
    flex-direction: column; /* Stack content vertically inside the item */
    justify-content: space-between; /* Distribute space if content heights vary */
}

.education-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px var(--current-shadow-color);
}

.education-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.8em;
}

.education-item p {
    margin-bottom: 5px;
    font-size: 1.05em;
}

.education-item p strong {
    font-weight: 600;
}

/* Slider Navigation Arrows */
.education-slider-container .slider-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 2em;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.3s ease, background-color 0.3s ease;
    border-radius: 5px;
}

.education-slider-container .slider-control:hover {
    opacity: 1;
    background-color: var(--primary-color);
}

.education-slider-container .slider-control.prev-edu {
    left: 0;
}

body.rtl .education-slider-container .slider-control.prev-edu {
    left: auto;
    right: 0;
}

.education-slider-container .slider-control.next-edu {
    right: 0;
}

body.rtl .education-slider-container .slider-control.next-edu {
    right: auto;
    left: 0;
}

/* Slider Dots */
.education-slider-dots {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 8px;
}

.education-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: 1px solid var(--secondary-color); /* Add border for better visibility in light/dark mode */
}

.education-slider-dot.active {
    background-color: var(--primary-color);
    transform: scale(1.2);
    border-color: var(--primary-color);
}


/* Skills Section */
.skills-intro {
    text-align: center;
    max-width: 800px;
    margin: -30px auto 50px auto; /* Adjust margin to place it below h2 */
    font-size: 1.1em;
    color: var(--secondary-color);
}

/* Skills Chart */
.skills-chart-container {
    max-width: 800px; /* Adjust width as needed */
    margin: 20px auto 50px auto;
    padding: 20px;
    background-color: var(--current-card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    text-align: center;
}

.skills-chart-container h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 20px;
}


.skills-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjust min-width as needed */
    gap: 30px;
    max-width: 1200px; /* Wider grid for more categories */
    margin: 0 auto;
}

.skill-category-card {
    background-color: var(--current-card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center; /* ALIGN CHILDREN HORIZONTALLY IN CENTER */
    text-align: center; /* Center text within this card (header, description) */
}

.skill-category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px var(--current-shadow-color);
}

.category-header {
    display: flex;
    align-items: center; /* Vertically center icon and title */
    justify-content: center; /* Horizontally center icon and title */
    margin-bottom: 15px;
    /* text-align: center; - REMOVE THIS if you previously added it here, as it's now on parent */
}

/* Adjustments for RTL category header */
body.rtl .category-header {
    flex-direction: row-reverse; /* Flip order of icon and title for RTL */
}
body.rtl .category-icon {
    margin-left: 15px; /* Add margin to the left for RTL */
    margin-right: 0; /* Remove right margin for RTL */
}

.category-icon {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-right: 15px; /* Space between icon and category title */
}


.skill-category-card h3 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin: 0; /* Override default h3 margin to integrate with flexbox */
}

.category-description {
    font-size: 0.95em;
    color: var(--secondary-color);
    margin-bottom: 20px;
    flex-grow: 1; /* Pushes skill list to bottom if descriptions vary in length */
    text-align: center; /* Center the description text below the header */
}

/* NEW: Styles for the individual skill items (Python, C++, etc.) */
.individual-skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjusted min-width for 2 columns */
    gap: 15px; /* Space between individual skill cards */
    margin-top: 20px;
}

.skill-item-card {
    background-color: var(--current-background); /* Lighter background for the inner card */
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    text-align: center; /* Center text within the card */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center content vertically */
    align-items: center; /* Center content horizontally */
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    /* Removed min-height: 140px; */
}

.skill-item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px var(--current-shadow-color);
}

.skill-item-icon {
    font-size: 2.5em; /* Larger icon for individual skill */
    color: var(--primary-color);
    margin-bottom: 10px;
}

.skill-item-card h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--current-text-color);
    margin-bottom: 10px; /* Adjusted from 5px for better spacing */
    line-height: 1.2; /* Adjust line height for longer titles */
}

.skill-item-card p {
    font-size: 0.85em;
    color: var(--secondary-color);
    line-height: 1.3;
    flex-grow: 1; /* Allow description to take available space */
    word-break: break-word; /* Allows long words to break and wrap */
}


/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
}

.project-card {
    background-color: var(--current-card-bg);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px var(--current-shadow-color);
}

.project-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.6em;
}

.project-description {
    margin-bottom: 15px;
    font-size: 1em;
    flex-grow: 1; /* Allows description to take up available space */
}

.technologies-used {
    font-size: 0.9em;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.project-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px; /* Ensure space above buttons */
}

/* Projects Filtering and Sorting */
.project-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    margin-bottom: 40px;
    gap: 15px; /* Space between filter buttons and sort dropdown */
    background-color: var(--current-card-bg);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.rtl .project-controls {
    flex-direction: row-reverse; /* Flip order for RTL */
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    background-color: var(--current-background);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    transform: translateY(-2px);
    box-shadow: 0 2px 5px var(--current-shadow-color);
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: var(--text-color-dark);
    border-color: var(--primary-color);
    box-shadow: 0 2px 5px var(--current-shadow-color);
}

.sort-dropdown label {
    margin-right: 10px;
    color: var(--current-text-color);
    font-weight: 600;
    display: none; /* Hide label, rely on select styling */
}

.sort-dropdown select {
    padding: 8px 15px;
    border: 1px solid var(--current-border-color);
    border-radius: 20px;
    background-color: var(--current-input-bg);
    color: var(--current-text-color);
    font-size: 1em;
    cursor: pointer;
    appearance: none; /* Remove default dropdown arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236C757D'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

body.dark-mode .sort-dropdown select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23FFFFFF'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

body.rtl .sort-dropdown select {
    background-position: left 10px center;
}

.sort-dropdown select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Photo Gallery Section */
.gallery-intro {
    text-align: center;
    max-width: 800px;
    margin: -30px auto 50px auto;
    font-size: 1.1em;
    color: var(--secondary-color);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    background-color: var(--current-card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px var(--current-shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-item:hover {
     transform: scale(1.03);
     box-shadow: 0 8px 15px var(--current-shadow-color);
}

.gallery-item img {
    display: block;
    width: 100%;
    height: 200px; /* Fixed height, adjust as needed */
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Contact Section */
.contact-section p {
    text-align: center;
    max-width: 600px;
    margin: 0 auto 40px auto;
    font-size: 1.1em;
}

/* New Contact Section intro styles */
.contact-intro-sub {
    text-align: center;
    max-width: 600px;
    margin: -30px auto 40px auto; /* Adjust margin to place it below main intro */
    font-size: 1em;
    color: var(--secondary-color);
}

/* Map Container */
.map-container {
    max-width: 800px; /* Adjust max width for the map */
    margin: 0 auto 50px auto;
    background-color: var(--current-card-bg); /* Match card background */
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    overflow: hidden; /* Ensures border-radius applies to iframe corners */
}

.map-container iframe {
    width: 100%;
    height: 450px; /* Fixed height for the map, adjust as needed */
    display: block; /* Remove extra space below iframe */
}


.contact-form {
    max-width: 600px;
    margin: 0 auto 50px auto;
    background-color: var(--current-card-bg);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--current-shadow-color);
    border: 1px solid var(--current-border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group {
    margin-bottom: 20px;
    position: relative; /* Needed for copy button positioning */
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--current-text-color);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--current-input-border);
    border-radius: 5px;
    font-size: 1em;
    background-color: var(--current-input-bg); /* Use overall background for inputs */
    color: var(--current-text-color);
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.form-group input.error,
.form-group textarea.error {
    border-color: var(--error-color);
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-group .error-message {
    color: var(--error-color);
    font-size: 0.9em;
    display: block; /* Ensure message appears on new line */
    margin-top: 5px;
    height: 1em; /* Reserve space to prevent layout shifts */
}

/* Copy to Clipboard Button */
.copy-email-btn {
    position: absolute;
    top: 38px; /* Adjust based on label/input height */
    right: 10px; /* Position inside the input field */
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
    border-radius: 3px;
    transition: color 0.2s ease, background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    z-index: 1; /* Ensure it's above the input */
}

body.rtl .copy-email-btn {
     left: 10px;
     right: auto;
}


.copy-email-btn:hover {
    color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.1); /* Use primary color RGB if defined */
}

.copy-email-btn:active {
    transform: scale(0.95);
}

.contact-form .btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
}

.form-status-message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: 600;
    display: none; /* Hidden by default */
}

.form-status-message.success {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.form-status-message.error {
     background-color: rgba(220, 53, 69, 0.2);
     color: var(--error-color);
     border: 1px solid var(--error-color);
}


.social-links {
    text-align: center;
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 25px;
}

.social-links a {
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.social-links a:hover {
    transform: translateY(-5px);
    color: var(--link-hover-color);
}


/* Footer */
.footer {
    background-color: var(--current-footer-bg);
    color: var(--secondary-color);
    text-align: center;
    padding: 30px 0;
    font-size: 0.9em;
    border-top: 1px solid var(--current-border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Scroll Reveal Animations */
/* Note: Original reveal fade-in is kept, but AOS is added for new elements */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Indicator */
#loading-indicator {
    padding: 30px 0;
    font-size: 1.5em;
    color: var(--primary-color);
}

/* Back to Top Button */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

body.rtl #back-to-top {
    left: 20px;
    right: auto;
}


/* Project Modal */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.8); /* Black w/ opacity */
    backdrop-filter: blur(5px); /* Optional blur effect */
     -webkit-backdrop-filter: blur(5px); /* Safari support */
    padding-top: 60px; /* Location of the box */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.show {
    display: block; /* Show the modal */
    opacity: 1;
    visibility: visible;
}


.modal-content {
    background-color: var(--current-card-bg);
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border-radius: 10px;
    max-width: 800px; /* Could be responsive */
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: background-color 0.3s ease;
}

.modal-content h3 {
     color: var(--primary-color);
     margin-top: 0;
     margin-bottom: 15px;
}

.modal-content p {
     margin-bottom: 15px;
}

.modal-content .technologies-used {
    font-size: 0.95em;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.modal-links {
     display: flex;
     gap: 15px;
     margin-top: 20px;
     flex-wrap: wrap;
}

/* Close button */
.close-button {
    color: var(--secondary-color);
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    transition: color 0.3s ease;
}

body.rtl .close-button {
     left: 20px;
     right: auto;
}

.close-button:hover,
.close-button:focus {
    color: #aaa;
    text-decoration: none;
    cursor: pointer;
}

/* Image Carousel inside Modal */
.modal-image-carousel {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #eee; /* Placeholder background */
}

.carousel-images {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.carousel-images img {
    width: 100%;
    display: block;
    flex-shrink: 0; /* Prevent images from shrinking */
    object-fit: cover; /* or 'contain' depending on desired look */
    height: 300px; /* Adjust height as needed */
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 2em;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.3s ease, background-color 0.3s ease;
}

.carousel-control:hover {
    opacity: 1;
    background-color: var(--primary-color);
}

.carousel-control.prev {
    left: 10px;
    border-radius: 5px;
}

body.rtl .carousel-control.prev {
    left: auto;
    right: 10px;
}

.carousel-control.next {
    right: 10px;
    border-radius: 5px;
}

body.rtl .carousel-control.next {
    right: auto;
    left: 10px;
}


.carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: 1px solid var(--secondary-color); /* Add border for better visibility in light/dark mode */
}

.carousel-dot.active {
    background-color: var(--primary-color);
    transform: scale(1.2);
    border-color: var(--primary-color);
}


/* Responsive Design */
@media (max-width: 900px) {
    .nav-links {
        gap: 20px;
    }
    .language-switcher {
        margin-right: 10px;
    }
    body.rtl .language-switcher {
        margin-left: 10px;
        margin-right: 0;
    }
    .lang-button {
        padding: 4px 8px;
        font-size: 0.8em;
    }

    .hero-section h1 {
        font-size: 2.8em;
    }

    .hero-section p {
        font-size: 1.3em;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

     .modal-content {
         margin: 10% auto;
         max-width: 90%;
     }

    /* Responsive adjustments for Education Grid */
    .education-grid {
        grid-auto-columns: calc(100% / 2); /* Show 2 items on medium screens */
        /* padding: 0;  Handled by slider container */
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--current-background);
        position: absolute;
        top: 60px; /* Adjust based on header height */
        left: 0;
        padding: 20px 0;
        box-shadow: 0 5px 10px var(--current-shadow-color);
        border-top: 1px solid var(--current-border-color);
    }

    body.rtl .nav-links {
        left: auto;
        right: 0;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        text-align: center;
        margin: 10px 0;
    }

    .language-switcher {
        margin-top: 10px;
        margin-right: 0;
        justify-content: center;
        width: 100%;
    }

    body.rtl .language-switcher {
         margin-left: 0;
         margin-right: 0;
    }

    .hamburger-menu {
        display: block;
    }

    .hero-section {
        min-height: 70vh;
    }

    .hero-section h1 {
        font-size: 2.2em;
    }

    .hero-section p {
        font-size: 1.1em;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    .section-padding {
        padding: 60px 0;
    }

    section h2 {
        font-size: 2em;
        margin-bottom: 40px;
    }

    /* Skills Section Responsive */
    .skills-intro {
        margin: -20px auto 40px auto;
        font-size: 1em;
    }

    .skills-categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 20px;
        margin: 0 20px; /* Add horizontal margin */
    }

    .skill-category-card {
        padding: 25px;
    }

    .category-icon {
        font-size: 2.2em;
        margin-right: 12px;
    }
     body.rtl .category-icon {
        margin-left: 12px;
        margin-right: 0;
     }


    .skill-category-card h3 {
        font-size: 1.6em;
    }

    .category-description {
        font-size: 0.9em;
    }

    /* Individual Skills Grid adjustments */
    .individual-skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); /* Adjust for smaller screens */
        gap: 10px;
    }

    .skill-item-card {
        min-height: 120px; /* Smaller minimum height */
        padding: 10px;
    }

    .skill-item-icon {
        font-size: 2em;
        margin-bottom: 8px;
    }

    .skill-item-card h4 {
        font-size: 1em;
    }

    .skill-item-card p {
        font-size: 0.8em;
    }

    /* End Skills Section Responsive */

    .projects-grid,
    .contact-form,
    /* .education-item, This rule is removed as education-item now handles its own margin via grid gap */
    .gallery-grid,
    .skills-chart-container {
        margin: 0 20px; /* Add horizontal margin on smaller screens */
    }

    .project-card, .education-item, .gallery-item {
        padding: 25px;
    }

    .contact-form {
        padding: 30px;
    }

    .copy-email-btn {
        top: 40px; /* Adjust position */
        right: 10px;
    }
    body.rtl .copy-email-btn {
        left: 10px;
        right: auto;
    }
    /* Responsive adjustments for Education Grid */
    .education-grid {
        grid-auto-columns: 100%; /* Show 1 item per slide on small screens */
        padding: 0; /* Ensure no extra padding on mobile */
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.5em;
    }

    .hero-section h1 {
        font-size: 1.8em;
    }

    .hero-section p {
        font-size: 1em;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        max-width: 250px;
    }

    .section-padding {
        padding: 40px 0;
    }

    section h2 {
        font-size: 1.8em;
        margin-bottom: 30px;
    }

    /* Skills Section Responsive */
    .skills-intro {
        margin: -20px auto 30px auto; /* Further adjust margin on very small screens */
    }

    .skills-categories-grid {
        grid-template-columns: 1fr; /* Single column on very small screens */
        margin: 0 15px;
    }

    .skill-category-card {
        padding: 20px;
    }

    .category-icon {
        font-size: 2em;
        margin-right: 10px;
    }
    body.rtl .category-icon {
        margin-left: 10px;
        margin-right: 0;
    }
    .skill-category-card h3 {
        font-size: 1.4em;
    }

    .category-description {
        font-size: 0.85em;
    }

    /* Individual Skills Grid adjustments */
    .individual-skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Even smaller for tiny screens */
        gap: 8px;
    }

    .skill-item-card {
        min-height: 100px;
        padding: 8px;
    }

    .skill-item-icon {
        font-size: 1.8em;
        margin-bottom: 5px;
    }

    .skill-item-card h4 {
        font-size: 0.9em;
    }

    .skill-item-card p {
        font-size: 0.75em;
    }

    /* End Skills Section Responsive */

    .project-card {
        padding: 20px;
    }

    .form-group input, .form-group textarea {
        padding: 10px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        margin: 0 15px;
    }

    .modal-content {
        padding: 20px;
        margin: 15% auto;
    }

     .carousel-images img {
         height: 250px; /* Adjust height for smaller screens */
     }

     .carousel-control {
         padding: 5px 10px;
         font-size: 1.5em;
     }
}