/* =========== CSS Variables & Reset =========== */
:root {
    --bg-dark: #050B14;
    --bg-darker: #02050A;
    --primary: #00B4D8;
    --primary-dark: #0077B6;
    --accent: #F77F00;
    --accent-hover: #ff9933;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);

    /* Code Editor Specific Variables */
    --code-bg: var(--bg-darker);
    --code-border: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
    --bg-dark: #f0f4f8;
    --bg-darker: #ffffff;
    --primary: #0077B6;
    /* Darker primary for light bg */
    --primary-dark: #023e8a;
    --accent: #e85d04;
    --text-main: #1d3557;
    --text-muted: #457b9d;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);

    /* Code Editor Specific Variables */
    --code-bg: #282c34;
    --code-border: transparent;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.section {
    padding: 100px 0;
    position: relative;
    z-index: 2;
}

/* =========== Typography & Highlights =========== */
.highlight-text {
    color: var(--primary);
    position: relative;
}

.highlight-text::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to left, var(--primary), transparent);
}

.text-primary {
    color: var(--primary);
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.title-line {
    width: 60px;
    height: 4px;
    background: var(--primary);
    margin: 0 auto 50px;
    border-radius: 2px;
}

/* =========== Glassmorphism System =========== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 180, 216, 0.3);
    background: var(--glass-bg);
    /* Use base var to keep readability */
    box-shadow: 0 10px 40px rgba(0, 180, 216, 0.15);
}

/* =========== Buttons =========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-sm {
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--primary);
    color: #fff;
}

.btn-sm:hover {
    background: var(--primary-dark);
}

.btn-lg {
    padding: 15px 35px;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 180, 216, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.6);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--glass-border);
    backdrop-filter: blur(5px);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 180, 216, 0.05);
}

/* =========== Header & Navigation =========== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    transition: var(--transition);
}

header.scrolled {
    padding: 10px 0;
    background: var(--bg-darker);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 100px;
    /* Increased height significantly */
    max-width: 280px;
    transition: var(--transition);
    mix-blend-mode: screen;
    /* Removes the black background */
    object-fit: contain;
    transform-origin: right center;
    /* useful for RTL if rotated/scaled */
    transform: scale(1.2);
    /* Slight scale to make it pop inside its container */
}

/* Light Theme overrides for Logo */
[data-theme="light"] .logo img,
[data-theme="light"] .footer-logo {
    mix-blend-mode: multiply;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.1));
}

/* Theme Switcher Button */
.theme-switch-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 20px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-switch-btn:hover {
    color: var(--primary);
    transform: rotate(30deg);
}

.main-nav ul {
    display: flex;
    gap: 30px;
    align-items: center;
}

.main-nav ul li a {
    font-weight: 500;
    position: relative;
}

.main-nav ul li a:not(.btn-sm)::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition);
}

.main-nav ul li a:not(.btn-sm):hover::after,
.main-nav ul li a.active:not(.btn-sm)::after {
    width: 100%;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary);
}

/* =========== Hero Section =========== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 100px;
    position: relative;
    overflow: hidden;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.hero-content {
    max-width: 600px;
}

.badge {
    display: inline-block;
    padding: 5px 15px;
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 20px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.hero-title {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 20px;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Floating Code Editor */
.hero-illustration {
    padding: 2px;
    background: linear-gradient(135deg, var(--glass-border) 0%, rgba(0, 180, 216, 0.3) 100%);
    border-radius: 16px;
    animation: float 6s ease-in-out infinite;
}

.code-editor {
    background: var(--code-bg);
    border-radius: 15px;
    overflow: hidden;
}

.editor-header {
    background: var(--code-border);
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.red {
    background: #ff5f56;
}

.yellow {
    background: #ffbd2e;
}

.green {
    background: #27c93f;
}

.editor-body {
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    direction: ltr;
    text-align: left;
}

.editor-body .keyword {
    color: #c678dd;
}

.editor-body .variable {
    color: #e06c75;
}

.editor-body .string {
    color: #98c379;
}

.editor-body .function {
    color: #61afef;
}

.editor-body .operator {
    color: #56b6c2;
}


/* =========== About Section =========== */
.about .about-content {
    padding: 50px;
    text-align: center;
    font-size: 1.2rem;
    line-height: 1.8;
}

/* =========== Services Section =========== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.service-card:hover::before {
    transform: translateX(100%);
}

.service-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 20px;
    display: inline-block;
    padding: 15px;
    background: rgba(0, 180, 216, 0.1);
    border-radius: 50%;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.5);
}

.service-card h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* =========== Why Us Section =========== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: var(--transition);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 180, 216, 0.3);
    transform: translateX(-5px);
    /* Right to left shift */
}

.feature-item i {
    font-size: 1.5rem;
}

.feature-item span {
    font-size: 1.1rem;
    font-weight: 600;
}

/* =========== CTA Section =========== */
.cta-content {
    padding: 60px 40px;
    text-align: center;
    background: linear-gradient(135deg, rgba(0, 119, 182, 0.1) 0%, rgba(247, 127, 0, 0.05) 100%);
    border: 1px solid rgba(0, 180, 216, 0.2);
}

.cta-content h2 {
    font-size: 2.2rem;
    margin-bottom: 30px;
}

/* =========== Footer =========== */
.footer {
    background: var(--bg-darker);
    padding: 80px 0 20px;
    border-top: 1px solid var(--glass-border);
    position: relative;
    z-index: 2;
}

.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 60px;
}

.footer-logo {
    height: 60px;
    margin-bottom: 20px;
    mix-blend-mode: screen;
    /* Removes the black background */
    object-fit: contain;
}

.footer-about p {
    color: var(--text-muted);
    max-width: 300px;
}

.footer-links h4,
.footer-contact h4 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.footer-links h4::after,
.footer-contact h4::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 30px;
    height: 2px;
    background: var(--primary);
}

.footer-links ul li {
    margin-bottom: 15px;
}

.footer-links ul li a {
    color: var(--text-muted);
}

.footer-links ul li a:hover {
    color: var(--primary);
    padding-right: 5px;
}

.footer-contact p {
    color: var(--text-muted);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-contact i {
    color: var(--primary);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-main);
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 180, 216, 0.4);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========== Animations & Tech Effects =========== */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.tech-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-dark);
    top: -100px;
    right: -100px;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: #481e14;
    /* hint of orange warmth */
    bottom: -50px;
    left: -100px;
    opacity: 0.3;
}

.code-symbols {
    position: absolute;
    color: var(--primary);
    /* Shifted to primary color */
    opacity: 0.05;
    /* Manage opacity explicitly */
    font-family: monospace;
    font-weight: bold;
    user-select: none;
}

.symbol-1 {
    font-size: 15rem;
    top: 10%;
    left: 5%;
    transform: rotate(-15deg);
}

.symbol-2 {
    font-size: 10rem;
    bottom: 20%;
    right: 10%;
    transform: rotate(10deg);
}

.symbol-3 {
    font-size: 8rem;
    top: 50%;
    left: 40%;
    transform: rotate(5deg);
}


/* =========== Responsive Mobile =========== */
@media (max-width: 991px) {
    .hero-title {
        font-size: 2.8rem;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content {
        margin: 0 auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-illustration {
        margin-top: 40px;
        max-width: 500px;
        margin-inline: auto;
    }

    .footer-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .section-title {
        font-size: 2rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .logo img {
        height: 50px;
        /* Much smaller on mobile so it doesn't break header */
        max-width: 150px;
        transform: scale(1);
        /* Remove the zoom scale */
    }

    .theme-switch-btn {
        margin-right: 0;
        margin-bottom: 10px;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        width: 100%;
        left: 0;
        background: var(--bg-darker);
        backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--glass-border);
        padding: 20px 0;
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
        transition: clip-path 0.4s ease-in-out;
    }

    .main-nav.active {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    .main-nav ul {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .about .about-content {
        padding: 30px 20px;
        font-size: 1.1rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
    }

    .footer-links h4::after,
    .footer-contact h4::after {
        left: 50%;
        transform: translateX(-50%);
        right: auto;
    }

    .footer-about p,
    .footer-about img {
        margin: 0 auto 15px;
    }

    .footer-contact p {
        justify-content: center;
    }

    .social-links {
        justify-content: center;
    }
}

/* Visibility classes for JS animations */
.aos-init {
    opacity: 0;
    transition-property: opacity, transform;
    transition-duration: 0.8s;
    transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
}

.aos-animate {
    opacity: 1;
}

[data-aos="fade-up"] {
    transform: translateY(40px);
}

[data-aos="fade-up"].aos-animate {
    transform: translateY(0);
}

[data-aos="fade-right"] {
    transform: translateX(40px);
}

/* RTL mapping */
[data-aos="fade-right"].aos-animate {
    transform: translateX(0);
}

[data-aos="zoom-in"] {
    transform: scale(0.9);
}

[data-aos="zoom-in"].aos-animate {
    transform: scale(1);
}