/* ==========================================================================
   CSS Variables & Theme
   ========================================================================== */
:root {
    --bg-main: #111111;
    --text-primary: #ffffff;
    --text-secondary: #aaaaab;

    --accent-1: #faa81c;
    /* Suntech Yellow */
    --accent-2: #e2971a;
    /* Darker Yellow */
    --accent-3: #ffc14d;
    /* Light Yellow */

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);

    --transition-fast: 0.2s ease;
    --transition-med: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 0.8s cubic-bezier(0.16, 1, 0.3, 1);

    --section-padding: 8rem 5%;
}

[data-theme="light"] {
    --bg-main: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;

    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-highlight: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Global Reset & Base Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background animated shapes */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    animation: float 20s infinite alternate ease-in-out;
}

.bg-shape-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-1), transparent 70%);
    top: -100px;
    left: -200px;
}

.bg-shape-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-3), transparent 70%);
    bottom: 20%;
    right: -100px;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(50px, 50px) scale(1.1);
    }

    100% {
        transform: translate(-30px, 100px) scale(0.9);
    }
}

/* ==========================================================================
   Typography & Typography Utilities
   ========================================================================== */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: inherit;
    text-decoration: none;
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-med);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    color: #000;
    border: none;
    box-shadow: 0 4px 15px rgba(250, 168, 28, 0.4);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--accent-2), var(--accent-1));
    z-index: -1;
    transition: opacity var(--transition-med);
    opacity: 0;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(250, 168, 28, 0.6);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
}

.btn-secondary:hover {
    background: var(--glass-bg);
    border-color: var(--glass-highlight);
    transform: translateY(-3px);
}

.btn-large {
    padding: 1rem 3rem;
    font-size: 1.1rem;
}

/* ==========================================================================
   Glassmorphism Utilities
   ========================================================================== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: var(--transition-med);
}

.glass-card:hover {
    border-color: var(--glass-highlight);
    transform: translateY(-5px);
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 5%;
    transition: var(--transition-med);
}

.navbar.scrolled {
    background: rgba(10, 10, 14, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 5%;
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="light"] .navbar.scrolled {
    background: rgba(248, 249, 250, 0.8);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo .dot {
    color: var(--accent-1);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    position: relative;
}

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

.nav-link:not(.nav-btn)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--accent-1);
    transition: var(--transition-fast);
}

.nav-link:not(.nav-btn):hover::after {
    width: 100%;
}

.nav-btn {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}

.nav-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-1);
}

/* Hamburger (Mobile) */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
}

.hamburger .line {
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-fast);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: var(--section-padding);
    padding-top: 120px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.greeting {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--accent-3);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.hero-title {
    font-size: clamp(3rem, 5vw, 4.5rem);
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 500px;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

/* Code Card */
.hero-card {
    width: 100%;
    max-width: 450px;
    transform: rotateY(-10deg) rotateX(5deg);
    animation: floating-card 6s ease-in-out infinite;
    transform-style: preserve-3d;
}

@keyframes floating-card {
    0% {
        transform: rotateY(-10deg) rotateX(5deg) translateY(0);
    }

    50% {
        transform: rotateY(-5deg) rotateX(8deg) translateY(-20px);
    }

    100% {
        transform: rotateY(-10deg) rotateX(5deg) translateY(0);
    }
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px 20px 0 0;
}

[data-theme="light"] .card-header {
    background: rgba(0, 0, 0, 0.05);
}

.circles {
    display: flex;
    gap: 8px;
}

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

.red {
    background: #ff5f56;
}

.yellow {
    background: #ffbd2e;
}

.green {
    background: #27c93f;
}

.code-content {
    padding: 2rem;
    font-family: 'Fira Code', monospace, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-x: auto;
}

.keyword {
    color: #ff79c6;
}

.variable {
    color: #50fa7b;
}

.operator {
    color: #ff79c6;
}

.property {
    color: #8be9fd;
}

.string {
    color: #f1fa8c;
}

.method {
    color: #50fa7b;
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.projects {
    padding: var(--section-padding);
    max-width: 1400px;
    margin: 0 auto;
}

.section-heading {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.heading-line {
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-3));
    border-radius: 2px;
}

.projects-grid {
    display: flex;
    flex-direction: column;
    gap: 6rem;
}

.project-card {
    display: flex;
    gap: 3rem;
    padding: 3rem;
    align-items: center;
}

.project-reverse {
    flex-direction: row-reverse;
}

.project-content {
    flex: 1;
}

.project-meta {
    margin-bottom: 1.5rem;
}

.project-category {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-3);
    font-weight: 600;
}

.project-title {
    font-size: 2rem;
    margin-top: 0.5rem;
}

.project-desc {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.tech-tag {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.project-role {
    font-weight: 600;
    color: var(--text-primary);
    position: relative;
    padding-left: 20px;
}

.project-role::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-1);
}

.project-visual {
    flex: 1;
    display: flex;
    justify-content: center;
}

.visual-placeholder {
    width: 100%;
    aspect-ratio: 16/10;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

/* UI Mockups inside visual */
.v-islam {
    background: linear-gradient(135deg, rgba(250, 168, 28, 0.1), rgba(255, 193, 77, 0.1));
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-mockup {
    width: 80%;
    height: 70%;
    background: var(--bg-main);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.mockup-header {
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="light"] .mockup-header {
    background: rgba(0, 0, 0, 0.05);
}

.mockup-body {
    display: flex;
    flex: 1;
}

.mockup-sidebar {
    width: 20%;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--glass-border);
}

[data-theme="light"] .mockup-sidebar {
    background: rgba(0, 0, 0, 0.02);
}

.mockup-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.mockup-card {
    height: 40px;
    background: var(--glass-bg);
    border-radius: 4px;
    flex: 1;
    min-width: 40%;
}

.v-waste {
    background: linear-gradient(135deg, rgba(226, 151, 26, 0.1), rgba(250, 168, 28, 0.1));
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-mockup {
    width: 40%;
    height: 80%;
    border-radius: 20px;
}

.mobile-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.mobile-header {
    height: 15%;
    background: var(--glass-bg);
    border-radius: 8px;
    margin-bottom: 10px;
}

.mobile-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.other-works {
    margin-top: 5rem;
    text-align: center;
    padding: 2rem;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px dashed var(--glass-border);
}

.highlight {
    color: var(--accent-3);
    font-weight: 600;
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact {
    padding: var(--section-padding);
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.contact-box {
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.contact-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(250, 168, 28, 0.15) 0%, transparent 60%);
    z-index: -1;
}

.contact-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 1.5rem auto 3rem;
    max-width: 600px;
}

.social-links {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-link {
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
}

.social-link:hover {
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    padding: 2rem 5%;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==========================================================================
   Animations & Reveals
   ========================================================================== */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

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

.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Media Queries
   ========================================================================== */
@media (max-width: 992px) {

    .project-card,
    .project-reverse {
        flex-direction: column;
        gap: 3rem;
    }

    .hero {
        flex-direction: column;
        text-align: center;
        gap: 4rem;
        padding-top: 150px;
    }

    .hero-subtitle {
        margin: 1.5rem auto 2.5rem;
    }

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

@media (max-width: 768px) {
    .nav-links {
        display: none;
        /* simple hidden for mobile, can be toggled by JS */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(10, 10, 14, 0.95);
        backdrop-filter: blur(10px);
        padding: 2rem 0;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-links.active {
        display: flex;
    }

    .hamburger {
        display: flex;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

/* ==========================================================================
   Language Switcher & RTL Styling
   ========================================================================== */
.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.lang-btn:hover {
    background: var(--glass-bg);
    border-color: var(--accent-1);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    min-width: 150px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Theme Toggle Button */
.theme-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 1rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.theme-btn:hover {
    background: var(--glass-bg);
}

[data-theme="light"] .icon-moon {
    display: block;
}

[data-theme="light"] .icon-sun {
    display: none;
}

:root:not([data-theme="light"]) .icon-moon {
    display: none;
}

:root:not([data-theme="light"]) .icon-sun {
    display: block;
}

[data-theme="light"] .lang-dropdown {
    background: rgba(248, 249, 250, 0.95);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

.lang-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.lang-dropdown a {
    color: var(--text-primary);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.lang-dropdown a:hover {
    background: var(--glass-highlight);
    color: var(--accent-3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* RTL Specific Styles (Arabic) */
html[dir="rtl"] {
    text-align: right;
}

html[dir="rtl"] .arabic-font {
    font-family: 'Cairo', sans-serif;
}

html[dir="rtl"] .nav-links {
    margin-right: auto;
    margin-left: 0;
}

html[dir="rtl"] .project-card {
    flex-direction: row-reverse;
}

html[dir="rtl"] .project-reverse {
    flex-direction: row;
}

html[dir="rtl"] .project-role {
    padding-left: 0;
    padding-right: 20px;
}

html[dir="rtl"] .project-role::before {
    left: auto;
    right: 0;
}

html[dir="rtl"] .lang-dropdown {
    right: auto;
    left: 0;
}