* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10b981;
    --secondary-color: #3b82f6;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #0a0a0a;
    --card-bg: #111111;
    --text-light: #ffffff;
    --text-gray: #9ca3af;
    --gradient-1: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-2: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-3: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-4: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-5: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    --gradient-6: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--dark-bg);
    color: var(--text-light);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Language Switcher */
.language-switcher {
    position: relative;
    margin-left: 1rem;
}

.lang-btn {
    background: var(--gradient-1);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transform: scale(1);
}

.lang-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.lang-btn:hover::before {
    left: 100%;
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.lang-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.lang-btn i {
    font-size: 1.2rem;
}

/* Text Encryption Animation */
.text-encrypting {
    position: relative;
    overflow: hidden;
}

.text-encrypting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.1), transparent);
    animation: encrypt-scan 1s ease-in-out;
}

@keyframes encrypt-scan {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Glitch effect for encryption */
.text-glitch {
    animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {

    0%,
    100% {
        transform: translate(0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(-2px, -2px);
    }

    60% {
        transform: translate(2px, 2px);
    }

    80% {
        transform: translate(2px, -2px);
    }
}

/* Page encryption overlay */
.page-encrypting {
    position: relative;
}

.page-encrypting::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg,
            rgba(16, 185, 129, 0.02) 0%,
            rgba(59, 130, 246, 0.02) 25%,
            rgba(245, 158, 11, 0.02) 50%,
            rgba(16, 185, 129, 0.02) 75%,
            rgba(59, 130, 246, 0.02) 100%);
    pointer-events: none;
    z-index: 9999;
    animation: encrypt-overlay 2s ease-in-out;
}

@keyframes encrypt-overlay {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 1;
    }
}

/* Faster encryption animation */
.page-encrypting::before {
    animation: encrypt-overlay 1.2s ease-in-out;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(156, 163, 175, 0.1);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease, opacity 0.3s ease-in-out;
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    opacity: 1;
}

.nav-links a:hover {
    background: var(--gradient-1);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Smooth navigation transition */
.nav-links a.transitioning {
    pointer-events: none;
    transform: translateY(0);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 30% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(16,185,129,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
    z-index: -1;
}

.hero-content {
    text-align: center;
    max-width: 900px;
    padding: 0 2rem;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    background: var(--gradient-1);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #10b981, #3b82f6, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--text-gray);
    margin-bottom: 2rem;
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
    display: block;
}

.stat-label {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--gradient-1);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.cta-button.secondary {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(16, 185, 129, 0.4);
}

.cta-button.secondary:hover {
    background: var(--primary-color);
    color: white;
}

/* About Section */
.about {
    padding: 5rem 0;
    background: var(--card-bg);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
}

.about-text {
    text-align: center;
}

.about-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-description {
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.about-stat {
    text-align: center;
    padding: 1.5rem;
    background: var(--dark-bg);
    border-radius: 15px;
    border: 1px solid rgba(156, 163, 175, 0.1);
}

.about-stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--primary-color);
    display: block;
}

.about-stat-label {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    background: var(--gradient-1);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-left: 0;
    margin-right: 0;
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.social-link.linkedin {
    background: var(--gradient-2);
}

.social-link.github {
    background: var(--gradient-3);
}

/* Projects Section */
.projects {
    padding: 5rem 0;
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 3rem;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.project-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(156, 163, 175, 0.1);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.project-image {
    width: 100%;
    height: 200px;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.project-img {
    transition: transform 0.3s ease;
    backface-visibility: hidden;
}

.project-card:hover .project-img {
    transform: scale(1.05);
}

.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.project-card:hover .project-image::before {
    transform: translateX(100%);
}

.project-icon {
    font-size: 3rem;
    color: white;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
}

.project-card:hover .project-icon {
    transform: scale(1.1);
}

.project-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.project-description {
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--gradient-1);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: auto;
    align-self: flex-start;
}

.project-link:hover {
    gap: 0.8rem;
}

/* Contact Section */
.contact {
    padding: 5rem 0;
    background: var(--card-bg);
}

.contact-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.contact-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.contact-description {
    color: var(--text-gray);
    line-height: 1.8;
    margin-bottom: 3rem;
    font-size: 1.1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-form {
    max-width: 500px;
    margin: 0 auto;
    background: var(--dark-bg);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(156, 163, 175, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: right;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid rgba(156, 163, 175, 0.2);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-1);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

/* Floating Elements */
.floating-element {
    position: absolute;
    width: 100px;
    height: 100px;
    background: var(--gradient-1);
    border-radius: 50%;
    opacity: 0.1;
    animation: float 6s ease-in-out infinite;
}

.floating-element:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-element:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.floating-element:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Loading Animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(16, 185, 129, 0.3);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Scroll Animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-2);
}

/* Language Direction */
[dir="ltr"] {
    direction: ltr;
}

[dir="ltr"] .about-text {
    text-align: left;
}

[dir="ltr"] .form-group {
    text-align: left;
}

[dir="ltr"] .project-link i {
    transform: rotate(180deg);
}

/* Responsive Design */
@media (min-width: 1400px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
        max-width: 1600px;
    }
}

@media (max-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        max-width: 500px;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 0 1rem;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero-stats {
        gap: 1.5rem;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .floating-element {
        display: none;
    }

    .about-stats {
        grid-template-columns: 1fr;
    }

    .social-links {
        flex-direction: column;
        align-items: center;
    }

    .contact-form {
        margin: 0 1rem;
    }
}

.hidden {
    display: none !important;
}

.cert-slideup {
    display: block;
    width: 100%;
    min-height: 1.7em;
    text-align: center;
    white-space: normal;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1.3;
    font-size: 1.1rem;
    font-weight: 600;
    color: #10b981;
    margin: 0.3em auto 0 auto;
    transition: transform 0.7s cubic-bezier(.4, 2, .6, 1), opacity 0.7s;
    will-change: transform, opacity;
}