:root {
    --gradient-1: linear-gradient(45deg, #2b5876, #4e4376);
    --gradient-2: linear-gradient(45deg, #1a2980, #26d0ce);
    --primary: #2b5876;
    --secondary: #1a2980;
    --dark: #1a1a1a;
    --light: #f0f2f5;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --gradient-1: linear-gradient(45deg, #3a7bd5, #3a6073);
    --gradient-2: linear-gradient(45deg, #243B55, #141E30);
    --primary: #3a7bd5;
    --secondary: #243B55;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --border-color: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem 5%;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .navbar {
    background: rgba(45, 45, 45, 0.95);
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradient 5s ease infinite;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

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

@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--light);
        padding: 1rem;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    }

    [data-theme="dark"] .nav-menu {
        background: var(--bg-secondary);
    }

    .nav-menu.active {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .menu-toggle {
        display: block;
        cursor: pointer;
    }

    .bar {
        width: 25px;
        height: 3px;
        background: var(--dark);
        margin: 5px 0;
        transition: 0.3s;
    }

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

    .hero-animation {
        opacity: 0.05;
    }
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 8rem 5% 5rem;
    position: relative;
    overflow: hidden;
}

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

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

.hero-description {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.hero-animation {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: var(--gradient-2);
    clip-path: circle(60% at 70% 50%);
    opacity: 0.1;
    animation: pulse 4s ease-in-out infinite;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin: 0.5rem;
}

.btn-primary {
    background: var(--gradient-1);
    color: var(--light);
}

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

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Cards */
.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease;
    box-shadow: 0 5px 15px rgba(43, 88, 118, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Sections */
.section {
    padding: 5rem 5%;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
}

.gradient-bg {
    background: var(--gradient-1);
    color: var(--light);
}

/* Code Section */
.code-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.code-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(43, 88, 118, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.code-header {
    background: var(--dark);
    color: var(--light);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.code-content {
    padding: 1.5rem;
}

/* Footer */
footer {
    background: var(--dark);
    color: var(--light);
    padding: 3rem 5% 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

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

.social-links a {
    color: var(--light);
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Theme Toggle Button */
.theme-toggle {
    margin-right: 1rem;
}

#theme-switch {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.2rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

#theme-switch:hover {
    background-color: var(--border-color);
}

/* Animations */
@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Utility Classes */
.light {
    color: var(--light);
}
