/* ===== Performance Optimizations ===== */
/* Reduce paint on scroll */
* {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* Optimize animations */
.hero-profile-image,
.project-card,
.skill-card {
    will-change: transform;
}

/* Disable animations on reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Global Styles ===== */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: 'Cairo', sans-serif;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    /* ensure body is positioned so absolutely positioned elements scroll with page */
}

/* ===== Navigation ===== */
.navbar {
    background: rgba(26, 26, 46, 0.95) !important;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);


}

.navbar.scrolled {
    background: rgba(26, 26, 46, 0.98) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    display: flex       ;
}

.navbar-brand {
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

.nav-link {
    color: #fff !important;
    font-weight: 500;
    margin: 0 0.5rem;
    transition: all 0.3s ease;
    position: relative;
}

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

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

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

/* Mobile Menu Button */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1000;
    padding: 5px;
    display: flex;
}

.bar {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #fff;
    border-radius: 3px;
    transition: var(--transition);
}

.navbar-toggler[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
}

.navbar-toggler[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Mobile Menu */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(44, 62, 80, 0.98);
        padding: 1rem;
        border-radius: 8px;
        margin-top: 1rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        display: flex   ;
    }

    .nav-item {
        margin: 0.5rem 0;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        border-radius: 4px;
        transition: var(--transition);
    }

    .nav-link:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ===== Mobile-First Responsive Design ===== */
/* Base mobile styles */
html {
    font-size: 14px;
    scroll-behavior: smooth;
}

@media (min-width: 576px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

/* Touch-friendly targets */
@media (max-width: 768px) {

    .btn,
    .nav-link,
    .social-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .hero-buttons .btn {
        margin-bottom: 0.75rem;
        width: 100%;
        max-width: 280px;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

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

    /* Ensure hero text is visible on mobile */
    .hero-content {
        text-align: center;
        padding: 2rem 1rem;
        position: relative;
        z-index: 10;
    }

    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
        font-weight: 700;
    }

    .hero-content .lead {
        font-size: 1rem;
        color: #ffffff !important;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
        margin-bottom: 1.5rem;
        font-weight: 400;
    }
}

/* Improved mobile navigation */
@media (max-width: 991.98px) {
    .navbar-collapse {
        position: fixed;
        top: var(--navbar-height);
        right: 0;
        left: 0;
        background: rgba(26, 26, 46, 0.98);
        backdrop-filter: blur(10px);
        padding: 2rem 1rem;
        max-height: calc(100vh - var(--navbar-height));
        overflow-y: auto;
        z-index: 999;
        border-radius: 0 0 20px 20px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    .navbar-nav {
        text-align: center;
    }

    .nav-item {
        margin: 0.5rem 0;
    }

    .nav-link {
        padding: 1rem;
        border-radius: 10px;
        transition: all 0.3s ease;
        font-size: 1.1rem;
    }

    .nav-link:hover {
        background: rgba(74, 144, 226, 0.2);
        transform: translateX(-5px);
    }
}

/* Responsive Typography */
html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .navbar-brand {
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    html {
        font-size: 14px;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Better Touch Targets */
a,
button,
.btn,
.nav-link {
    -webkit-tap-highlight-color: transparent;
}

/* Optimize Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Improve Form Elements on Mobile */
input,
textarea,
button,
select {
    font-size: 16px !important;
    /* Prevents zoom on focus in iOS */
}

/* Better Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== Hero Section ===== */
.hero-section {
    position: relative;
    background: var(--gradient-1);
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

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

.text-gradient {
    background: linear-gradient(135deg, #fff 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-buttons .btn {
    padding: 0.75rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.hero-buttons .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-link {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.social-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    color: #fff;
}

/* ===== Hero Image & Code Window ===== */
.hero-image {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* ===== Hero Profile Image ===== */
.hero-profile-image {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto 2rem;
    z-index: 3;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(74, 144, 226, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: profileFloat 3s ease-in-out infinite;
    filter: brightness(1.05) contrast(1.1) saturate(1.1) drop-shadow(0 0 10px rgba(74, 144, 226, 0.2));
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform, filter;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.profile-img:hover {
    transform: scale(1.08) translateY(-5px);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(74, 144, 226, 0.5),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    filter: brightness(1.1) contrast(1.15) saturate(1.2) drop-shadow(0 0 20px rgba(74, 144, 226, 0.4));
}

.profile-border {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border-radius: 50%;
    background: var(--gradient-1);
    z-index: -1;
    opacity: 0.6;
    animation: rotate 10s linear infinite;
    filter: blur(2px);
}

.profile-glow {
    position: absolute;
    top: -25px;
    left: -25px;
    right: -25px;
    bottom: -25px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 144, 226, 0.4) 0%, transparent 70%);
    z-index: -2;
    animation: pulse 2s ease-in-out infinite;
    opacity: 0.8;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.5;
    }
}

@keyframes profileFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 100px;
    height: 100px;
    top: 20%;
    right: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 80px;
    height: 80px;
    top: 50%;
    right: 30%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

.code-window {
    background: rgba(26, 26, 46, 0.9);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.code-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot-red {
    background: #ff5f56;
}

.dot-yellow {
    background: #ffbd2e;
}

.dot-green {
    background: #27c93f;
}

.code-content {
    padding: 2rem;
    color: #fff;
    font-family: 'Courier New', monospace;
}

.code-content pre {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.8;
}

.code-keyword {
    color: #c792ea;
}

.code-variable {
    color: #82aaff;
}

.code-property {
    color: #7fdbca;
}

.code-string {
    color: #c3e88d;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-indicator a {
    color: #fff;
    font-size: 2rem;
    animation: bounce 2s infinite;
    display: block;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== Section Styles ===== */
section {
    padding: 5rem 0;
}

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

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 0;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

/* ===== About Section ===== */
.about-image {
    position: relative;
    padding: 25px;
}

.about-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-1);
    border-radius: 25px;
    z-index: -1;
    opacity: 0.25;
    transform: rotate(-4deg);
    transition: all 0.4s ease;
    filter: blur(10px);
}

.about-image::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 30px;
    z-index: -2;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.about-image:hover::before {
    transform: rotate(0deg) scale(1.02);
    opacity: 0.3;
}

.about-image:hover::after {
    opacity: 1;
}

.about-profile-img {
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
    border: 6px solid #fff;
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(74, 144, 226, 0.2);
    filter: brightness(1.05) contrast(1.1) saturate(1.05) drop-shadow(0 0 15px rgba(74, 144, 226, 0.15));
    object-fit: cover;
    object-position: center;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: transform, filter;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.about-image:hover .about-profile-img {
    transform: scale(1.06) rotate(1deg);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.3),
        0 0 50px rgba(74, 144, 226, 0.4);
    filter: brightness(1.1) contrast(1.15) saturate(1.1) drop-shadow(0 0 25px rgba(74, 144, 226, 0.3));
    border-color: rgba(255, 255, 255, 0.9);
}

.experience-badge {
    position: absolute;
    bottom: -20px;
    left: -20px;
    background: var(--gradient-1);
    color: #fff;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.feature-box {
    padding: 1.5rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.feature-box i {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-box h5 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

/* ===== Skills Section ===== */
.skill-card {
    background: #fff;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
    height: 100%;
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.skill-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--gradient-1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
}

.skill-card h4 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.skill-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.skill-items .badge {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.skill-bars {
    max-width: 800px;
    margin: 0 auto;
}

.skill-bar-item {
    margin-bottom: 2rem;
}

.skill-bar-item span {
    font-weight: 600;
    color: var(--dark-color);
}

.progress {
    border-radius: 10px;
    overflow: hidden;
    background: #e9ecef;
}

.progress-bar {
    background: var(--gradient-1);
    border-radius: 10px;
    transition: width 1s ease;
}

/* ===== Projects Section ===== */
.project-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.4s ease;
    z-index: 1;
}

.project-card:hover::before {
    transform: scaleX(1);
}

.project-card:hover {
    transform: translateY(-15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    border-color: rgba(74, 144, 226, 0.3);
}

.project-image {
    position: relative;
    overflow: hidden;
    height: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: brightness(0.9) contrast(1.1);
    image-rendering: -webkit-optimize-contrast;
}

.project-card:hover .project-image img {
    transform: scale(1.15) rotate(2deg);
    filter: brightness(1) contrast(1.15) saturate(1.1);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(74, 144, 226, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(5px);
}

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

.project-overlay .btn {
    border-radius: 50px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    transform: translateY(20px);
}

.project-card:hover .project-overlay .btn {
    transform: translateY(0);
    animation: fadeInUp 0.5s ease forwards;
}

.project-card:hover .project-overlay .btn:nth-child(2) {
    animation-delay: 0.1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.project-overlay .btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.project-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.project-content h4 {
    margin-bottom: 0.75rem;
    color: var(--dark-color);
    font-weight: 700;
    font-size: 1.25rem;
    transition: color 0.3s ease;
}

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

.project-content p {
    margin-bottom: 1rem;
    flex-grow: 1;
    line-height: 1.7;
    color: #6c757d;
    font-size: 0.95rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.project-tags .badge {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.project-card:hover .project-tags .badge {
    transform: scale(1.05);
}

/* ===== Contact Section ===== */
.contact-card {
    background: #fff;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.form-floating label {
    color: var(--dark-color);
}

.form-control {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
}

.contact-info {
    padding: 2rem;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.contact-info:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.contact-info i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.contact-info h5 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

/* ===== Footer ===== */
footer {
    background: var(--dark-color) !important;
}

footer a {
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

footer a:hover {
    color: var(--primary-color) !important;
    transform: translateY(-3px);
}

/* ===== Back to Top Button ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Force navbar to be fixed at top (explicit override) */
.navbar {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    /* allow natural height so contents are visible */
    height: auto;
}

/* Ensure the collapsed mobile menu doesn't overlap content when open */
.navbar-collapse {
    max-height: calc(100vh - var(--navbar-height));
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .hero-profile-image {
        width: 280px;
        height: 280px;
    }
}

@media (max-width: 992px) {
    .hero-section {
        text-align: center;
        padding: 2rem 0;
    }

    .hero-content h1 {
        font-size: 2.5rem;
        margin-bottom: 1.5rem;
    }

    .hero-image {
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        text-align: center;
        padding: 1rem 0;
    }

    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }

    .hero-content .lead {
        font-size: 1rem;
    }

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

    .hero-profile-image {
        width: 220px;
        height: 220px;
        margin-bottom: 1rem;
    }

    .profile-img {
        border-width: 3px;
    }

    .profile-border {
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
    }

    .profile-glow {
        top: -15px;
        left: -15px;
        right: -15px;
        bottom: -15px;
    }

    .hero-image {
        flex-direction: column;
        gap: 1rem;
    }

    .code-window {
        margin-top: 1rem;
        transform: scale(0.9);
    }

    .experience-badge {
        position: relative;
        bottom: auto;
        left: auto;
        margin-top: 1rem;
        text-align: center;
    }

    .about-image {
        padding: 10px;
        margin-bottom: 1.5rem;
    }

    .about-profile-img {
        border-width: 3px;
    }

    .project-image {
        height: 200px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-content h4 {
        font-size: 1rem;
    }

    .project-content p {
        font-size: 0.85rem;
    }

    .project-overlay {
        flex-direction: column;
        gap: 0.5rem;
    }

    .project-overlay .btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: 100%;
        max-width: 200px;
    }

    .contact-card {
        padding: 1.5rem 1rem;
    }

    .back-to-top {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }

    .skill-card {
        padding: 1.5rem;
    }

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

    .contact-info {
        padding: 1.5rem;
    }

    .contact-info i {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-content .lead {
        font-size: 0.9rem;
    }

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

    .hero-profile-image {
        width: 180px;
        height: 180px;
    }

    .code-window {
        transform: scale(0.8);
        margin: 0.5rem;
    }

    .code-content {
        padding: 1rem;
    }

    .code-content pre {
        font-size: 0.7rem;
    }

    .project-image {
        height: 160px;
    }

    .project-content {
        padding: 0.75rem;
    }

    .project-tags .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .contact-card {
        padding: 1rem;
    }

    .form-floating {
        margin-bottom: 1rem;
    }

    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;

    }
}

/* WhatsApp button - Always visible with animation */
.whatsapp-float {
    position: fixed !important;
    width: 60px;
    height: 60px;
    bottom: 30px;
    right: 30px;
    background-color: #25d366;
    color: #fff;
    border-radius: 50%;
    text-align: center;
    font-size: 30px;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.3);
    z-index: 1000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 1 !important;
    visibility: visible !important;
    animation: pulse 2s infinite;
}

.whatsapp-float:hover {
    background-color: #128c7e;
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);

}

.whatsapp-float i {
    margin-top: 2px;
    width: 100%;
    height: 100%;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);

    }

    .whatsapp-float {
        animation: fadeInUp 1s ease-in-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive WhatsApp Button */
@media (max-width: 768px) {
    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 25px;
        bottom: 20px;
        right: 20px;

    }
}

/* ===== FIX RESPONSIVE ISSUES ===== */
html,
body {
    overflow-x: hidden;
    width: 100%;
    scroll-behavior: smooth;
    font-family: 'Cairo', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Images optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: auto;
}

/* Hero section fixes */
.hero-section {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Hero content visibility fixes */
.hero-content {
    position: relative;
    z-index: 10;
    padding: 2rem 1rem;
}

.hero-content h1 {
    color: #ffffff !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
    margin-bottom: 1rem;
    display: block !important;
    visibility: visible !important;
}

.hero-content .lead {
    color: #ffffff !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 400;
    margin-bottom: 1.5rem;
    display: block !important;
    visibility: visible !important;
}

.hero-content .text-gradient {
    background: linear-gradient(45deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #ffd700 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Prevent horizontal scroll */
.row,
.container,
.container-fluid {
    margin-right: 0;
    margin-left: 0;
    padding-right: 15px;
    padding-left: 15px;
}

@media (max-width: 576px) {
    .container {
        padding-right: 10px;
        padding-left: 10px;
    }
}

/* Disable heavy animations on mobile */
@media (max-width: 768px) {
    .floating-shapes {
        display: none;
    }

    .profile-glow,
    .profile-border {
        display: none;
    }

    .hero-section {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .display-3 {
        font-size: 2.2rem;
    }

    /* Reduce motion for better performance */
    .project-card:hover {
        transform: translateY(-5px);
    }

    .skill-card:hover {
        transform: translateY(-5px);
    }

    /* Fix hero text visibility on mobile */
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
        color: #ffffff !important;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    }

    .hero-content .lead {
        font-size: 1rem;
        color: #ffffff !important;
        text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        margin-top: 1.5rem;
    }

    .hero-buttons .btn {
        margin-bottom: 0.75rem;
        width: 100%;
        max-width: 280px;
    }

    /* Ensure WhatsApp button is visible on mobile */
    .whatsapp-float {
        opacity: 1 !important;
        visibility: visible !important;
        display: flex !important;
        bottom: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
        z-index: 1000 !important;
    }
}

/* Back to top button - Always visible */
.back-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make WhatsApp button part of the page flow (not fixed) and add floating animation */
.whatsapp-float {
    position: absolute !important;
    animation: floatMove 4s ease-in-out infinite;
}

@keyframes floatMove {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }

    100% {
        transform: translateY(0);
    }
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* WhatsApp button positioning - Always visible */
.whatsapp-float {
    bottom: 30px;
    right: 30px;
    z-index: 998;
}

@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }

    .back-to-top {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ===== Small fixes to ensure full content is visible on phones ===== */
:root {
    --navbar-height: 70px;
}

/* reserve space for fixed navbar to prevent it covering content */
body {
    padding-top: calc(var(--navbar-height) + env(safe-area-inset-top, 0px));
}

/* adjust hero height to account for navbar on small screens */
.hero-section {
    min-height: calc(100vh - var(--navbar-height));
}

@media (max-width: 576px) {
    :root {
        --navbar-height: 64px;
    }

    .hero-section {
        min-height: calc(100vh - var(--navbar-height));
        padding-top: 1rem;
        padding-bottom: 1rem;
    }

    /* make sure large decorative elements don't push content off-screen */
    .shape-1,
    .shape-2,
    .shape-3 {
        display: none;
    }
}