/* ==========================================================================
   CSS Variables & Theming
   ========================================================================== */
:root {
    /* Dark Theme (Default Gaming/Tech Vibe) */
    --bg-main: #0a0a0c;
    --bg-alt: #121216;
    --bg-card: rgba(26, 26, 36, 0.6);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    
    /* RGB & Neon Accents */
    --primary: #00f3ff;
    --secondary: #bc13fe;
    --accent: #ff007f;
    --gradient-1: linear-gradient(45deg, var(--primary), var(--secondary));
    --gradient-2: linear-gradient(45deg, var(--secondary), var(--accent));
    --gradient-rgb: linear-gradient(90deg, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
    
    /* UI Elements */
    --glass-bg: rgba(10, 10, 12, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow-neon: 0 0 15px rgba(0, 243, 255, 0.3);
    
    --transition-fast: 0.3s ease;
    --transition-slow: 0.5s ease;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-alt: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-main: #0f172a;
    --text-muted: #475569;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.05);
    --primary: #0284c7;
    --secondary: #7e22ce;
    --shadow-neon: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

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

.section-title span {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section {
    padding: 100px 0;
}

.bg-alt {
    background-color: var(--bg-alt);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background: var(--gradient-1);
    color: #fff !important;
    box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 25px rgba(0, 243, 255, 0.6);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--primary);
    color: #000;
    box-shadow: var(--shadow-neon);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-icon {
    padding: 8px;
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
}
.btn-icon:hover {
    color: var(--primary);
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    padding: 20px 0;
    transition: var(--transition-fast);
}

.navbar.scrolled {
    padding: 12px 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    color: var(--primary);
}

.logo span {
    color: var(--secondary);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links li a {
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-fast);
    position: relative;
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--primary);
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-1);
    transition: var(--transition-fast);
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.theme-btn:hover {
    color: var(--primary);
}

.hamburger {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--text-main);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 80px;
    overflow: hidden;
}

.hero-bg-anim {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(188, 19, 254, 0.1) 0%, rgba(0, 243, 255, 0.05) 30%, transparent 70%);
    animation: rotateBg 20s linear infinite;
    z-index: -1;
}

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

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

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

.hero-content h1 {
    font-size: 3.2rem; /* الحجم معدل */
    margin-bottom: 10px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 243, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center; /* التوسيط */
    gap: 15px;
}

.typing-container {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
}

.typing-text {
    color: var(--secondary);
}

.cursor {
    display: inline-block;
    width: 3px;
    background-color: var(--primary);
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.hero-content p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.hero-btns {
    display: flex;
    gap: 15px;
}

.hero-img {
    flex: 1;
    display: flex;
    justify-content: center;
}

.img-wrapper {
    width: 350px;
    height: 350px;
    border-radius: 50%;
    padding: 5px;
    background: var(--gradient-1);
    position: relative;
    animation: float 6s ease-in-out infinite;
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.2);
}

.img-wrapper::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: var(--gradient-1);
    filter: blur(20px);
    opacity: 0.5;
    z-index: -1;
}

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid var(--bg-main);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-text p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.about-text strong {
    color: var(--primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 30px 20px;
    text-align: center;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    transition: var(--transition-fast);
}

.stat-box:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-neon);
}

.stat-box i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.stat-box h3 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.stat-box span {
    color: var(--text-muted);
    font-size: 1rem;
}

/* ==========================================================================
   Skills Section
   ========================================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
}

.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    transition: var(--transition-fast);
}

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

.skill-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
}

.skill-name i {
    margin-left: 8px;
    font-size: 1.2rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress {
    height: 100%;
    width: 0; /* Animated by JS */
    background: var(--gradient-1);
    border-radius: 10px;
    transition: width 1.5s cubic-bezier(0.1, 0.5, 0.2, 1);
    position: relative;
}

.progress::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    overflow: hidden;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border-color: var(--primary);
}

.project-img {
    position: relative;
    overflow: hidden;
    height: 220px;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-img img {
    transform: scale(1.1);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 12, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transition: var(--transition-fast);
}

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

.project-content {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-content h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--primary);
}

.project-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex: 1;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.project-tech span {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--secondary);
    border: 1px solid rgba(188, 19, 254, 0.2);
}

/* ==========================================================================
   Services Section
   ========================================================================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 40px 30px;
    border-radius: 15px;
    text-align: center;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-fast);
}

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

.service-card:hover {
    background: rgba(255,255,255,0.02);
    transform: translateY(-5px);
}

.service-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: rgba(0, 243, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
    transition: var(--transition-fast);
}

.service-card:hover .service-icon {
    background: var(--primary);
    color: #000;
    box-shadow: var(--shadow-neon);
}

.service-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 50px;
}

.contact-info h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    background: var(--gradient-2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.contact-info p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-main);
    border: 1px solid var(--glass-border);
    transition: var(--transition-fast);
}

.social-icon:hover {
    transform: translateY(-5px);
    color: #fff;
}

.social-icon.whatsapp:hover { background: #25D366; border-color: #25D366; box-shadow: 0 0 15px #25D366; }
.social-icon.telegram:hover { background: #0088cc; border-color: #0088cc; box-shadow: 0 0 15px #0088cc; }
.social-icon.facebook:hover { background: #1877F2; border-color: #1877F2; box-shadow: 0 0 15px #1877F2; }
.social-icon.instagram:hover { background: #E4405F; border-color: #E4405F; box-shadow: 0 0 15px #E4405F; }
.social-icon.github:hover { background: #333; border-color: #333; box-shadow: 0 0 15px #333; }
.social-icon.bot:hover { background: #00f3ff; border-color: #00f3ff; box-shadow: 0 0 15px #00f3ff; color: #000; }

.contact-form {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-fast);
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea {
    background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.1);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
    text-align: center;
    padding: 30px 0;
    background: var(--bg-alt);
    border-top: 1px solid var(--glass-border);
}

footer p {
    color: var(--text-muted);
}

footer span {
    color: var(--primary);
    font-weight: bold;
}

/* ==========================================================================
   Floating Elements & Toast
   ========================================================================== */
.floating-whatsapp {
    position: fixed;
    bottom: 30px;
    left: 30px; /* RTL so it's on left */
    width: 60px;
    height: 60px;
    background: #25D366;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    z-index: 99;
    transition: var(--transition-fast);
    animation: pulse 2s infinite;
}

.floating-whatsapp:hover {
    transform: scale(1.1);
}

@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); }
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px; /* RTL so it's on right */
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-neon);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--primary);
    color: #000;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    box-shadow: var(--shadow-neon);
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Animations Classes (Scroll Reveal)
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

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

/* ==========================================================================
   Verified Badge Style (Fixed White Circle Bug)
   ========================================================================== */
.verified-badge {
    color: #1da1f2;
    font-size: 0.6em; /* الحجم معدل */
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(29, 161, 242, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* حل مشكلة اختفاء الأيقونة وظهور الدائرة البيضاء بسبب تدرج الألوان */
    -webkit-text-fill-color: #1da1f2; 
    -webkit-background-clip: border-box;
}

.logo .verified-badge {
    font-size: 1rem;
    margin-right: 5px;
    box-shadow: none;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 992px) {
    .hero-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 50px;
    }
    
    .hero-btns {
        justify-content: center;
    }
    
    .about-content, .contact-container {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    .nav-links {
        position: fixed;
        right: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--bg-alt);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 20px 0;
        gap: 20px;
    }

    .nav-links.active {
        right: 0;
    }
    
    /* تأكيد تصغير وتوسيط الاسم في الهاتف */
    .hero-content h1 {
        font-size: 2.5rem; 
        justify-content: center; 
    }
    
    .typing-container {
        font-size: 1.5rem;
    }
    
    .img-wrapper {
        width: 250px;
        height: 250px;
    }
}