/* ===== VARIABLES ===== */
:root {
    /* Colors - Modern Professional Palette */
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #475569;
    --dark-color: #0f172a;
    --light-color: #f8fafc;
    --background-color: #ffffff;
    --section-bg: #f1f5f9;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --accent-color: #8b5cf6;
    --accent-dark: #6d28d9;
    --accent-light: #a78bfa;
    --gradient-1: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-2: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --gradient-3: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --gradient-4: linear-gradient(to right, #3b82f6, #8b5cf6, #3b82f6);
    --gradient-bg: linear-gradient(135deg, rgba(241, 245, 249, 0.8) 0%, rgba(248, 250, 252, 0.8) 100%);

    /* Typography */
    --body-font: 'Poppins', sans-serif;
    --arabic-font: 'Cairo', 'Tajawal', sans-serif;

    /* Spacing */
    --section-padding: 100px 0;
    --container-padding: 0 15px;

    /* Transitions */
    --transition: all 0.3s ease;
    --transition-slow: all 0.5s ease;
    --transition-bounce: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);

    /* Border Radius */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 20px;

    /* Box Shadow */
    --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --box-shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.12);
    --box-shadow-btn: 0 5px 15px rgba(59, 130, 246, 0.3);
    --box-shadow-intense: 0 20px 40px rgba(0, 0, 0, 0.15);
    --box-shadow-inset: inset 0 2px 5px rgba(0, 0, 0, 0.05);

    /* Animation Durations */
    --animation-slow: 1.5s;
    --animation-medium: 1s;
    --animation-fast: 0.5s;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--background-color);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

button, input, textarea {
    font-family: inherit;
    font-size: inherit;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--container-padding);
}

section {
    padding: var(--section-padding);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--primary-color);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-align: center;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.5s ease;
    z-index: -1;
}

.btn:hover::before {
    width: 100%;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: var(--box-shadow-btn);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--box-shadow-btn);
}

/* ===== HEADER & NAVIGATION ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--background-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    height: auto;
    will-change: transform; /* Optimize for animations */
}

/* Add class for header when scrolling down to hide it */
header.header-hidden {
    transform: translateY(-100%);
    box-shadow: none;
}

/* Add class for header when scrolling up to show it again */
header.header-visible {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Add backdrop blur effect for a more modern look */
@supports (backdrop-filter: blur(10px)) {
    header {
        background-color: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
    }

    body.rtl header {
        background-color: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
    }
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    height: 70px; /* Fixed height for consistency */
}

.logo {
    display: flex;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
}

.logo span {
    color: var(--primary-color);
}

.header-right {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-links {
    display: flex;
    gap: 30px;
    height: 100%;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
    padding: 5px 0;
    display: inline-block;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header-controls {
    display: flex;
    align-items: center;
    margin-left: 30px;
    height: 100%;
}

.btn-language {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 90px; /* Prevent size changes when switching languages */
    text-align: center;
}

.btn-language:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.mobile-language {
    display: none;
}

.hamburger {
    display: none;
    cursor: pointer;
    margin-left: 15px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: transparent;
    transition: background-color 0.3s ease, transform 0.3s ease;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    z-index: 1001;
}

.hamburger:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.hamburger:active {
    transform: scale(0.95);
}

.bar {
    width: 24px;
    height: 2px;
    background-color: var(--dark-color);
    margin: 3px 0;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
    border-radius: 4px;
    transform-origin: center;
}

/* Improved hamburger animation */
.hamburger.active {
    background-color: rgba(59, 130, 246, 0.15);
}

.hamburger.active .bar {
    background-color: var(--primary-color);
}

.hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
    width: 22px;
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
    width: 22px;
}

/* RTL support for hamburger */
body.rtl .hamburger {
    margin-left: 0;
    margin-right: 15px;
}

/* ===== HERO SECTION ===== */
.hero {
    padding-top: 150px;
    padding-bottom: 100px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/images/me11.JPG');
    background-size: cover;
    background-position: center;
    opacity: 0.03;
    z-index: 0;
}

.hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0) 70%);
    z-index: 0;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1;
}

.hero-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-light);
}

.hero-name {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--dark-color);
    position: relative;
}

.hero-name::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.typed-text {
    color: var(--primary-color);
    font-weight: 600;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 30px;
    max-width: 600px;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 15px;
}

.hero-decoration {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-decoration-content {
    width: 350px;
    height: 350px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    animation: float 6s infinite ease-in-out;
}

.hero-decoration-content i {
    font-size: 7rem;
    color: var(--primary-color);
    opacity: 0.8;
    text-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
    animation: colorShift 8s infinite alternate;
}

.hero-decoration-content::before {
    content: '';
    position: absolute;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0) 70%);
    animation: pulse 4s infinite ease-in-out;
}

.hero-decoration-content::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        transparent,
        transparent,
        transparent,
        var(--primary-color)
    );
    opacity: 0.1;
    animation: rotate 15s linear infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes colorShift {
    0% {
        color: var(--primary-color);
    }
    50% {
        color: var(--accent-color);
    }
    100% {
        color: var(--primary-color);
    }
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ===== ABOUT SECTION ===== */
.about {
    background-color: var(--section-bg);
}

.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-image {
    flex: 1;
}

.image-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.about-profile-img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
}

.about-profile-img:hover {
    transform: scale(1.02);
    box-shadow: var(--box-shadow-hover);
}

.about-text {
    flex: 1;
}

.about-text h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.about-text p {
    margin-bottom: 25px;
    color: var(--text-light);
}

.about-info {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;
}

.info-item h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
    color: var(--dark-color);
}

.info-item p {
    color: var(--text-light);
    margin-bottom: 0;
}

.skills h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.skill-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.skill-category h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--dark-color);
}

.skill-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.skill-progress {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

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

/* ===== PROJECTS SECTION ===== */
.projects {
    background-color: var(--background-color);
}

.projects-grid {
    display: grid;
    gap: 25px;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Responsive grid for different screen sizes */
@media (min-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

.project-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #eaeaea;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    height: 100%;
    opacity: 1 !important; /* Ensure visibility regardless of AOS */
    transform: none !important; /* Ensure no transform is applied by AOS */
}

/* Apply AOS animations only on desktop */
@media (min-width: 768px) {
    .project-card[data-aos] {
        opacity: 0;
        transform: translateY(20px) !important;
    }

    .project-card[data-aos].aos-animate {
        opacity: 1;
        transform: translateY(0) !important;
    }
}

/* Square aspect ratio for desktop */
@media (min-width: 768px) {
    .project-card {
        min-height: 380px;
    }
}

/* Square aspect ratio for mobile */
@media (max-width: 767px) {
    .project-card {
        aspect-ratio: 1 / 1.2;
        max-height: 400px;
    }
}

/* Hover effect for project cards */
.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
}

.project-card:hover::before {
    opacity: 1;
}

.project-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: var(--gradient-4);
    background-size: 200% auto;
    transition: width 0.5s ease, background-position 1s ease;
}

.project-card:hover::after {
    width: 100%;
    background-position: right center;
}

.project-image {
    width: 100%;
    overflow: hidden;
    position: relative;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Taller images for desktop */
@media (min-width: 768px) {
    .project-image {
        height: 220px;
    }
}

/* Square images for mobile */
@media (max-width: 767px) {
    .project-image {
        height: 50%;
    }
}

.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.7));
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
    pointer-events: none;
}

.project-card:hover .project-image::before {
    opacity: 1;
}

.project-image::after {
    content: attr(data-view-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    color: white;
    background-color: rgba(59, 130, 246, 0.9);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    opacity: 0;
    z-index: 2;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Project badge */
.project-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.project-badge.mobile-app {
    background-color: rgba(59, 130, 246, 0.9);
    color: white;
}

/* RTL support for badge */
body.rtl .project-badge {
    right: auto;
    left: 15px;
}

.project-card:hover .project-image::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.project-image img {
    transition: transform 0.5s ease;
}

/* Desktop image sizing */
@media (min-width: 768px) {
    .project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Mobile image sizing */
@media (max-width: 767px) {
    .project-image img {
        width: 90%;
        height: 90%;
        object-fit: contain;
        max-height: 100%;
    }
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-content {
    position: relative;
    background-color: white;
    transition: transform 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop content padding */
@media (min-width: 768px) {
    .project-content {
        padding: 20px;
    }
}

/* Mobile content padding */
@media (max-width: 767px) {
    .project-content {
        padding: 15px;
        min-height: 40%;
    }
}

.project-card:hover .project-content {
    transform: translateY(0);
}

.project-title {
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--dark-color);
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
}

/* Desktop title size */
@media (min-width: 768px) {
    .project-title {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }
}

/* Mobile title size */
@media (max-width: 767px) {
    .project-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
        line-height: 1.3;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        max-height: 2.6rem;
    }
}

.project-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.5s ease;
}

.project-card:hover .project-title {
    color: var(--primary-color);
}

.project-card:hover .project-title::after {
    width: 100%;
}

.project-description {
    color: var(--text-light);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    font-size: 0.85rem;
    max-height: 2.8rem;
}

/* Mobile description size */
@media (max-width: 767px) {
    .project-description {
        font-size: 0.8rem;
        line-height: 1.3;
        margin-bottom: 8px;
        -webkit-line-clamp: 2;
        max-height: 2.6rem;
    }
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
    justify-content: flex-start;
    max-height: 50px;
    overflow: hidden;
}

/* Mobile tech tags container */
@media (max-width: 767px) {
    .project-tech {
        gap: 4px;
        margin-bottom: 8px;
        max-height: 40px;
    }
}

.tech-tag {
    background-color: #f0f4ff;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    color: var(--primary-color);
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    font-weight: 600;
    white-space: nowrap;
}

/* Mobile tech tags */
@media (max-width: 767px) {
    .tech-tag {
        padding: 2px 6px;
        border-radius: 6px;
        font-size: 0.65rem;
    }
}

.tech-tag::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tech-tag:hover {
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.tech-tag:hover::before {
    opacity: 1;
}

.project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    transition: var(--transition);
    padding: 6px 10px;
    position: relative;
    overflow: hidden;
    background-color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.8rem;
    margin-top: auto;
    text-align: center;
    width: 100%;
}

/* Mobile project link */
@media (max-width: 767px) {
    .project-link {
        padding: 5px 8px;
        font-size: 0.75rem;
        margin-top: 5px;
    }
}

.project-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.5s ease;
}

.project-link:hover {
    color: var(--primary-dark);
}

.project-link:hover::after {
    width: 100%;
}

.project-link::before {
    content: '\f061';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 8px;
    font-size: 0.8rem;
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    display: inline-block;
}

.project-link:hover::before {
    transform: translateX(8px);
}

/* ===== CERTIFICATES SECTION ===== */
.certificates {
    background-color: var(--section-bg);
}

.certificates-grid {
    display: grid;
    gap: 25px;
    width: 90%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Responsive grid for different screen sizes */
@media (min-width: 1200px) {
    .certificates-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .certificates-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .certificates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

.certificate-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #eaeaea;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    height: 100%;
    opacity: 1 !important; /* Ensure visibility regardless of AOS */
    transform: none !important; /* Ensure no transform is applied by AOS */
}

/* Apply AOS animations only on desktop */
@media (min-width: 768px) {
    .certificate-card[data-aos] {
        opacity: 0;
        transform: translateY(20px) !important;
    }

    .certificate-card[data-aos].aos-animate {
        opacity: 1;
        transform: translateY(0) !important;
    }
}

/* Square aspect ratio for desktop */
@media (min-width: 768px) {
    .certificate-card {
        min-height: 380px;
    }
}

/* Square aspect ratio for mobile */
@media (max-width: 767px) {
    .certificate-card {
        aspect-ratio: 1 / 1.2;
        max-height: 400px;
    }
}

/* Hover effect for certificate cards */
.certificate-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--accent-color);
}

.certificate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 0;
    background: var(--gradient-2);
    transition: height 0.5s ease;
    z-index: 1;
}

.certificate-card:hover::before {
    height: 100%;
}

.certificate-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-2);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.5s ease;
}

.certificate-card:hover::after {
    transform: scaleX(1);
}

.certificate-image {
    width: 100%;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    position: relative;
    transition: var(--transition);
    border-bottom: 1px solid #eaeaea;
}

/* Taller images for desktop */
@media (min-width: 768px) {
    .certificate-image {
        height: 220px;
    }
}

/* Square images for mobile */
@media (max-width: 767px) {
    .certificate-image {
        height: 50%;
    }
}

.certificate-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 1;
}

.certificate-card:hover .certificate-image::before {
    opacity: 1;
}

.certificate-image::after {
    content: attr(data-view-text);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    color: white;
    background-color: rgba(139, 92, 246, 0.9);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    opacity: 0;
    z-index: 2;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Certificate number badge */
.certificate-number {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 25px;
    height: 25px;
    background-color: rgba(139, 92, 246, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* RTL support for certificate number */
body.rtl .certificate-number {
    left: auto;
    right: 10px;
}

.certificate-card:hover .certificate-image::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.certificate-image img {
    transition: transform 0.5s ease;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.1));
    z-index: 0;
}

/* Desktop image sizing */
@media (min-width: 768px) {
    .certificate-image img {
        width: 90%;
        height: auto;
        max-height: 180px;
        object-fit: contain;
    }
}

/* Mobile image sizing */
@media (max-width: 767px) {
    .certificate-image img {
        width: 85%;
        height: auto;
        max-height: 150px;
        object-fit: contain;
    }
}

.certificate-card:hover .certificate-image img {
    transform: scale(1.08) translateY(-5px);
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.15));
}

.certificate-content {
    position: relative;
    background-color: white;
    transition: transform 0.3s ease;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop content padding */
@media (min-width: 768px) {
    .certificate-content {
        padding: 20px;
    }
}

/* Mobile content padding */
@media (max-width: 767px) {
    .certificate-content {
        padding: 15px;
        min-height: 40%;
    }
}

.certificate-card:hover .certificate-content {
    transform: translateY(0);
}

.certificate-title {
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop title size */
@media (min-width: 768px) {
    .certificate-title {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
}

/* Mobile title size */
@media (max-width: 767px) {
    .certificate-title {
        font-size: 1rem;
        margin-bottom: 8px;
        line-height: 1.3;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        max-height: 2.6rem;
    }
}

.certificate-issuer, .certificate-date {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile certificate info */
@media (max-width: 767px) {
    .certificate-issuer, .certificate-date {
        font-size: 0.75rem;
        gap: 4px;
        margin-bottom: 4px;
    }
}

.certificate-issuer i, .certificate-date i {
    color: var(--accent-color);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Mobile certificate icons */
@media (max-width: 767px) {
    .certificate-issuer i, .certificate-date i {
        font-size: 0.7rem;
    }
}

.certificate-title {
    color: var(--dark-color);
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
}

.certificate-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-2);
    transition: width 0.5s ease;
}

.certificate-card:hover .certificate-title {
    color: var(--accent-color);
}

.certificate-card:hover .certificate-title::after {
    width: 100%;
}

.certificate-issuer {
    color: var(--text-light);
    margin-bottom: 10px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.certificate-issuer::before {
    content: '\f19d';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 8px;
    color: var(--accent-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.certificate-card:hover .certificate-issuer::before {
    transform: scale(1.2);
}

.certificate-date {
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.certificate-date::before {
    content: '\f073';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-right: 8px;
    color: var(--accent-color);
    font-size: 0.9rem;
    transition: var(--transition);
}

.certificate-card:hover .certificate-date::before {
    transform: scale(1.2);
}

/* ===== CONTACT SECTION ===== */
.contact {
    background-color: var(--background-color);
}

.contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px;
    position: relative;
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1000px;
}

.contact-card {
    background-color: white;
    padding: 40px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    text-align: center;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.03) 0%, rgba(139, 92, 246, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.contact-card:hover::before {
    opacity: 1;
}

.contact-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.5s ease;
}

.contact-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--box-shadow-hover);
}

.contact-card:hover::after {
    transform: scaleX(1);
}

.contact-card-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
    transition: var(--transition);
    position: relative;
    z-index: 1;
}

.contact-card-icon::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: var(--gradient-1);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.3;
    transform: scale(0);
    transition: transform 0.5s ease;
}

.contact-card:hover .contact-card-icon {
    transform: scale(1.1);
}

.contact-card:hover .contact-card-icon::before {
    transform: scale(1);
}

.contact-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--dark-color);
    font-weight: 600;
    position: relative;
    display: inline-block;
}

.contact-card p {
    color: var(--text-color);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-top: 5px;
}

.contact-card p a {
    color: var(--primary-color);
    transition: var(--transition);
    position: relative;
    font-weight: 500;
}

.contact-card p a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: width 0.3s ease;
}

.contact-card p a:hover {
    color: var(--primary-dark);
}

.contact-card p a:hover::after {
    width: 100%;
}

.social-container {
    text-align: center;
    padding: 30px;
    width: 100%;
    max-width: 600px;
}

.social-title {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.social-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--gradient-1);
}

.social-links {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.social-link {
    width: 60px;
    height: 60px;
    background-color: white;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.4rem;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.social-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-1);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.social-link i {
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.social-link:hover {
    transform: translateY(-8px) scale(1.1);
    box-shadow: var(--box-shadow-hover);
}

.social-link:hover::before {
    opacity: 1;
}

.social-link:hover i {
    color: white;
}

/* ===== FOOTER ===== */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, #0f172a 100%);
    color: white;
    padding: 60px 0 40px;
    position: relative;
    overflow: hidden;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-1);
}

footer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='rgba(255,255,255,0.03)' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.1;
    z-index: 0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer-logo h2 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.footer-logo span {
    color: var(--primary-color);
}

.footer-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    z-index: 2000;
    overflow-y: auto;
    padding: 30px 0;
    backdrop-filter: blur(5px);
    -webkit-overflow-scrolling: touch; /* Improved scrolling on iOS */
}

.modal-content {
    background-color: white;
    width: 92%;
    max-width: 1000px;
    margin: 20px auto;
    border-radius: var(--border-radius-lg);
    position: relative;
    animation: modalFadeIn 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-light);
    transition: var(--transition);
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 40px;
    position: relative;
    overflow-y: auto; /* Ensure content is scrollable */
    -webkit-overflow-scrolling: touch; /* Improved scrolling on iOS */
    max-height: 80vh; /* Limit height on larger screens */
}

.modal-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: var(--gradient-1);
}

.project-modal-header {
    margin-bottom: 35px;
    position: relative;
}

.project-modal-title {
    font-size: 2.2rem;
    margin-bottom: 12px;
    color: var(--dark-color);
    font-weight: 700;
    position: relative;
    display: inline-block;
}

.project-modal-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--gradient-1);
}

.project-modal-subtitle {
    color: var(--text-light);
    font-size: 1.15rem;
}

.project-modal-image {
    width: 100%;
    height: 450px;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    margin-bottom: 35px;
    position: relative;
    box-shadow: var(--box-shadow);
    border: 5px solid white;
    cursor: pointer;
    background-color: var(--section-bg); /* Add background color while loading */
}

/* Add loading state for images */
.project-modal-image:not(.loaded)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.project-modal-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.2));
    z-index: 1;
    pointer-events: none;
}

.project-modal-image::after {
    content: '\f00e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.project-modal-image.loaded::after {
    opacity: 0.8; /* Make more visible on mobile */
}

.project-modal-image:hover::after {
    opacity: 1;
}

.project-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-modal-image:hover img {
    transform: scale(1.03);
}

/* Fullscreen image modal */
.fullscreen-image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none; /* Prevent browser handling of touch events */
}

.fullscreen-image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.fullscreen-image-container {
    position: relative;
    width: 90%;
    height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
    user-select: none; /* Prevent selection */
    -webkit-user-drag: none; /* Prevent dragging */
}

.fullscreen-image-modal.active .fullscreen-image {
    transform: scale(1);
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 3001;
}

.close-fullscreen:hover {
    background-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* Zoom instructions for mobile */
.fullscreen-image-modal::after {
    content: 'Double tap to zoom • Pinch to zoom in/out';
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    padding: 10px;
    z-index: 3001;
    pointer-events: none;
    opacity: 1;
    transition: opacity 1.5s ease;
}

.fullscreen-image-modal.active::after {
    opacity: 0;
}

.project-modal-description {
    margin-bottom: 35px;
    color: var(--text-color);
    line-height: 1.8;
    font-size: 1.05rem;
    padding: 0 5px;
}

.project-modal-features {
    margin-bottom: 35px;
    background-color: var(--section-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.project-modal-features h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.project-modal-features h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-color);
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    background-color: rgba(255, 255, 255, 0.7);
}

.feature-item:hover {
    background-color: white;
    box-shadow: var(--box-shadow);
    transform: translateY(-3px);
}

.feature-item i {
    color: var(--primary-color);
    margin-top: 3px;
    font-size: 1rem;
}

.project-modal-tech {
    margin-bottom: 35px;
}

.project-modal-tech h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.project-modal-tech h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-color);
}

.tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tech-list .tech-tag {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.tech-list .tech-tag:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.project-modal-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.project-modal-links .btn {
    min-width: 180px;
    text-align: center;
}

/* Certificate Modal Styles */
.certificate-modal-image {
    width: 100%;
    max-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 35px;
    background-color: var(--section-bg);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
    cursor: pointer;
    min-height: 200px; /* Ensure minimum height while loading */
}

/* Add loading state for certificate images */
.certificate-modal-image:not(.loaded)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid rgba(139, 92, 246, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
}

.certificate-modal-image::after {
    content: '\f00e';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.certificate-modal-image.loaded::after {
    opacity: 0.8; /* Make more visible on mobile */
}

.certificate-modal-image:hover::after {
    opacity: 1;
}

.certificate-modal-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 5px solid white;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    transition: transform 0.5s ease;
}

.certificate-modal-image:hover img {
    transform: scale(1.02);
}

.certificate-modal-content {
    padding: 0 5px;
}

.certificate-modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.certificate-modal-content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--primary-color);
}

.certificate-modal-content p {
    color: var(--text-color);
    margin-bottom: 15px;
    line-height: 1.7;
    font-size: 1.05rem;
}

/* Improve certificate modal on mobile */
@media (max-width: 576px) {
    .certificate-modal-image {
        padding: 15px;
        max-height: 300px;
    }

    .certificate-modal-image img {
        border-width: 3px;
    }

    .certificate-modal-content h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .certificate-modal-content p {
        font-size: 0.95rem;
        margin-bottom: 12px;
    }
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 992px) {
    .section-title {
        font-size: 2.2rem;
    }

    .hero-name {
        font-size: 3rem;
    }

    .about-content {
        flex-direction: column;
    }

    .image-container {
        margin-bottom: 30px;
    }

    /* Reduce animation intensity on tablets */
    .hero-decoration-content {
        animation: float 8s infinite ease-in-out; /* Slower animation */
    }

    .hero-decoration-content::before {
        animation: pulse 6s infinite ease-in-out; /* Slower pulse */
    }

    .hero-decoration-content::after {
        animation: rotate 20s linear infinite; /* Slower rotation */
    }
}

@media (max-width: 992px) {
    .hero .container {
        flex-direction: column;
    }

    .hero-content {
        text-align: center;
        margin-bottom: 40px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .about-content {
        flex-direction: column;
    }

    .image-container {
        margin-bottom: 30px;
    }

    .contact-cards {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* Improve project cards on tablets */
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 25px;
    }

    .project-card:hover {
        transform: translateY(-10px) rotateX(3deg); /* Less extreme transform */
    }
}

@media (max-width: 768px) {
    /* Improved header for mobile */
    header {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }

    header .container {
        padding: 10px 15px;
        height: 60px; /* Smaller height on mobile */
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .header-right {
        justify-content: flex-end;
    }

    /* Improved mobile navigation */
    .nav-links {
        position: fixed;
        top: 60px; /* Match header height */
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 25px;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Improved animation */
        z-index: 999;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        padding: 30px 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Improved scrolling on iOS */
        transform: translateX(-100%); /* Use transform instead of left */
        opacity: 0;
    }

    /* Add backdrop blur for modern look */
    @supports (backdrop-filter: blur(10px)) {
        .nav-links {
            background-color: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
        }
    }

    .nav-links.active {
        transform: translateX(0); /* Use transform instead of left */
        opacity: 1;
    }

    /* Stagger animation for nav items */
    .nav-links .nav-link {
        opacity: 0;
        transform: translateY(10px);
        transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
        transition-delay: calc(var(--item-index, 0) * 0.05s);
    }

    .nav-links.active .nav-link {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-link {
        font-size: 1.2rem;
        padding: 12px 0; /* Larger padding for better touch targets */
        width: 80%; /* Make links wider for better touch area */
        text-align: center;
    }

    /* Improve active state visibility */
    .nav-link.active {
        color: var(--primary-color);
        font-weight: 600;
    }

    /* Make the underline more visible */
    .nav-link::after {
        height: 3px;
        bottom: 0;
    }

    .mobile-language {
        display: block;
        margin-top: 20px;
    }

    .language-toggle {
        display: none;
    }

    .hamburger {
        display: flex; /* Changed to flex to center bars */
        width: 44px;
        height: 44px;
    }

    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .btn-language {
        padding: 10px 15px;
        font-size: 1rem;
        display: inline-block;
        min-width: 100px; /* Ensure consistent width */
    }
}

    /* Improved hero section for mobile */
    .hero-content {
        text-align: center;
        margin-bottom: 40px;
        padding: 0 15px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    .hero-name {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1.3rem;
        justify-content: center;
    }

    .hero-description {
        font-size: 1rem;
    }

    /* Reduced animation for mobile */
    .hero-decoration-content {
        width: 250px;
        height: 250px;
        animation: none; /* Disable float animation on mobile */
    }

    .hero-decoration-content i {
        font-size: 4rem;
        animation: colorShift 10s infinite alternate; /* Slower color shift */
    }

    .hero-decoration-content::before {
        animation: pulse 8s infinite ease-in-out; /* Slower pulse */
    }

    .hero-decoration-content::after {
        animation: rotate 30s linear infinite; /* Much slower rotation */
        opacity: 0.05; /* Reduced opacity */
    }

    .about-profile-img {
        height: 350px;
    }

    .about-text h3 {
        font-size: 1.8rem;
    }

    /* Improved project and certificate grids */
    .projects-grid,
    .certificates-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
        gap: 25px;
    }

    /* Improved project cards for mobile */
    .project-card {
        margin-bottom: 15px;
        transform-style: flat; /* Remove 3D effect on mobile */
        perspective: none;
    }

    .project-card:hover {
        transform: translateY(-8px); /* Simpler transform on mobile */
        box-shadow: var(--box-shadow-hover);
    }

    /* Improved certificate cards for mobile */
    .certificate-card {
        margin-bottom: 15px;
        transform-style: flat; /* Remove 3D effect on mobile */
    }

    .certificate-card:hover {
        transform: translateY(-8px); /* Simpler transform on mobile */
    }

    .contact-details {
        grid-template-columns: 1fr;
    }


@media (max-width: 576px) {
    header .container {
        padding: 12px 15px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .hero {
        padding-top: 120px;
        padding-bottom: 70px;
    }

    .section-padding {
        padding: 70px 0;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .section-subtitle {
        font-size: 0.9rem;
    }

    .hero-name {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .hero-description {
        font-size: 0.95rem;
    }

    /* Further reduced decoration for small mobile */
    .hero-decoration-content {
        width: 200px;
        height: 200px;
        box-shadow: 0 10px 30px rgba(59, 130, 246, 0.1); /* Reduced shadow */
    }

    .hero-decoration-content i {
        font-size: 3.5rem;
    }

    .about-profile-img {
        height: 300px;
        border: 3px solid white; /* Added border for better appearance */
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    }

    .about-text h3 {
        font-size: 1.6rem;
    }

    .about-info {
        flex-direction: column;
        gap: 20px;
    }

    .skill-categories {
        grid-template-columns: 1fr;
    }

    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .icon {
        margin-bottom: 5px;
    }

    .social-links {
        justify-content: center;
        margin-top: 30px;
    }

    /* Improved project and certificate cards */
    .project-card {
        margin-bottom: 25px;
        border: 2px solid var(--border-color); /* Enhanced border */
    }

    .project-image {
        height: 200px; /* Adjusted height for better proportions */
    }

    .certificate-card {
        margin-bottom: 25px;
        border: 2px solid var(--border-color); /* Enhanced border */
    }

    .contact-card {
        padding: 25px 15px;
    }

    .contact-card-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    /* Improved modal for mobile */
    .modal {
        padding: 0;
        -webkit-overflow-scrolling: touch; /* Better scrolling on iOS */
    }

    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        height: 100%;
        max-height: 100%;
        overflow-y: auto; /* Ensure content is scrollable */
    }

    .close-modal {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
        z-index: 2001;
        background-color: rgba(255, 255, 255, 0.9); /* More visible background */
    }

    .project-modal-image {
        height: auto; /* Auto height for better responsiveness */
        max-height: 300px; /* Maximum height */
    }

    .project-modal-image img {
        object-fit: contain; /* Ensure image is fully visible */
    }

    .project-modal-image::after {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    .certificate-modal-image::after {
        top: 10px;
        right: 10px;
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }

    /* Improved fullscreen image view */
    .fullscreen-image-container {
        width: 100%;
        height: 100%;
    }

    .fullscreen-image {
        max-width: 95%;
        max-height: 90%;
    }

    .close-fullscreen {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        background-color: rgba(255, 255, 255, 0.3); /* More visible */
    }

    /* Improved project modal content */
    .project-modal-description,
    .project-modal-features,
    .project-modal-tech {
        margin-bottom: 25px;
    }

    .features-list {
        grid-template-columns: 1fr; /* Single column on mobile */
    }

    .project-modal-links {
        flex-direction: column;
        gap: 15px;
    }

    .project-modal-links .btn {
        width: 100%;
    }
}

@media (max-width: 400px) {
    .contact-card {
        padding: 20px 15px;
    }

    .contact-card-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .contact-card h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }

    .contact-card p {
        font-size: 0.9rem;
    }

    .social-link {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }

    .hero-name {
        font-size: 1.8rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    /* Further reduced decoration for very small screens */
    .hero-decoration-content {
        width: 160px;
        height: 160px;
    }

    .hero-decoration-content i {
        font-size: 2.8rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .about-profile-img {
        height: 230px;
    }

    .about-text h3 {
        font-size: 1.5rem;
    }

    .skill-item {
        padding: 12px;
    }

    .skill-name {
        font-size: 0.9rem;
    }

    .project-title {
        font-size: 1.2rem;
    }

    .certificate-title {
        font-size: 1.1rem;
    }

    /* Improved modal for very small screens */
    .modal-body {
        padding: 20px 15px;
    }

    .project-modal-image {
        max-height: 200px;
        margin-bottom: 20px;
    }

    .project-modal-title {
        font-size: 1.4rem;
    }

    .project-modal-subtitle {
        font-size: 0.9rem;
    }

    .project-modal-description {
        font-size: 0.95rem;
    }

    .feature-item {
        padding: 8px;
    }
}


