@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Outfit:wght@300;400;500;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --nav-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Cairo', 'Outfit', sans-serif;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 25%);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Component Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Header */
header {
    height: var(--nav-height);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    backdrop-filter: blur(20px);
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

header .container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-main);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--nav-height);
    position: relative;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
}

.hero-text {
    flex: 1;
    animation: fadeInUp 1s ease-out;
}

.hero-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.hero-text h1 {
    font-size: 4rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-text p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.8;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
    animation: fadeInUp 1s ease-out 0.3s backwards;
}

.avatar-container {
    position: relative;
    z-index: 2;
    animation: float 6s ease-in-out infinite;
}

.avatar-container img {
    width: 400px;
    height: 400px;
    border-radius: 40px;
    object-fit: cover;
    box-shadow: 20px 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

.code-badge {
    position: absolute;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

.badge-1 {
    top: 40px;
    right: -20px;
    animation: float 5s ease-in-out infinite reverse;
}

.badge-2 {
    bottom: 60px;
    left: -40px;
    animation: float 7s ease-in-out infinite 1s;
}

/* About Section */
.section {
    padding: 8rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 4rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    group: hover;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.project-thumb {
    height: 220px;
    background: #1e293b;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-thumb span {
    font-size: 4rem;
    transition: transform 0.5s;
}

.project-card:hover .project-thumb span {
    transform: scale(1.2) rotate(10deg);
}

.project-content {
    padding: 2rem;
}

.project-cat {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: white;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Modal */
.modal-overlay {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: fadeInUp 0.4s ease-out;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.3s;
}

.close:hover {
    color: #ef4444;
}

.form-label {
    display: block;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-select,
.form-input {
    background: #0f172a;
    border: 1px solid var(--border);
    color: white;
    padding: 1rem;
    border-radius: 12px;
    width: 100%;
    transition: border-color 0.3s;
}

.form-select:focus,
.form-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    background: #0B1120;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
}

.footer-brand h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.social-icon:hover {
    background: var(--primary);
}
/* ============================================================
    Responsive & Mobile Menu Final Fix
============================================================ */

/* تنسيق زر القائمة (Hamburger) - يظهر فقط في الشاشات الصغيرة */
#hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 2001;
    flex-direction: column;
    gap: 5px;
}

#hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 3px;
    transition: 0.3s;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 1024px) {
    /* إظهار الزر */
    #hamburger-btn {
        display: flex;
    }

    /* تحويل القائمة العلوية إلى قائمة جانبية (Sidebar) */
    .nav-links {
        display: flex !important; /* إجبار العرض */
        position: fixed;
        top: 0;
        right: -100%; /* مخفية افتراضياً */
        width: 280px;
        height: 100vh;
        background: #0f172a;
        border-left: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px;
        gap: 1.5rem;
        transition: 0.4s ease-in-out;
        z-index: 2000;
        overflow-y: auto;
    }

    /* كلاس الفتح الخاص بالجافاسكربت */
    .nav-links.open {
        right: 0;
    }

    /* جعل القوائم المنسدلة مناسبة للموبايل */
    .dropdown {
        width: 100%;
    }
    
    .nav-link-btn {
        width: 100%;
        justify-content: space-between;
        padding: 10px 0;
    }

    .dropdown-content {
        position: static; /* بدلاً من absolute */
        width: 100%;
        display: none; /* تفتح عند الضغط فقط في الموبايل أو تبقى مخفية */
        background: rgba(255,255,255,0.02);
        box-shadow: none;
    }

    .dropdown:hover .dropdown-content {
        display: block;
    }

    /* تعديل الهيرو سيكشن للموبايل */
    .hero-content {
        flex-direction: column-reverse;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .btn-add-project {
        display: none; /* إخفاء زر الإضافة في الهيدر لتوفير مساحة */
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------
    Feature Chips & UI Elements (تنسيقات ثابتة)
------------------------------------------------------------ */
.features-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feature-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.feature-chip:hover, .feature-chip.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

.dropdown {
    position: relative;
    display: inline-block;
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    font-family: inherit;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: #1e293b;
    min-width: 180px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 12px;
    z-index: 2000;
}

.dropdown-content a {
    color: #cbd5e1;
    padding: 12px 20px;
    text-decoration: none;
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.badge {
    background: #ef4444;
    color: white;
    padding: 2px 6px;
    border-radius: 50%;
    font-size: 0.7rem;
}
/* --- إصلاح التمركز الشامل --- */
.container {
    width: 100% !important;
    max-width: 1200px;
    margin-right: auto !important;
    margin-left: auto !important;
    padding-right: 20px;
    padding-left: 20px;
    float: none !important; /* تأكيد عدم وجود انزياح */
}

/* --- إصلاح الأقسام التي تستخدم Inline Styles --- */
@media (max-width: 992px) {
    /* قسم About - تحويله من عمودين إلى عمود واحد */
    #about > .container {
        grid-template-columns: 1fr !important; /* إجبار عمود واحد */
        gap: 2rem !important;
        text-align: center;
    }

    /* قسم Contact - تحويله من Flex (بينهم مسافة) إلى Column (تحت بعض) */
    #contact > div {
        flex-direction: column !important;
        padding: 2rem !important;
        text-align: center;
    }

    #contact div div {
        justify-content: center !important; /* توسيط الأزرار */
    }

    #contact i {
        display: none; /* إخفاء الأيقونة الضخمة لتوفير مساحة */
    }
}

@media (max-width: 768px) {
    /* قسم الهيرو */
    .hero-content {
        flex-direction: column-reverse !important;
        text-align: center;
    }

    .hero-text {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-text h1 {
        font-size: 2.2rem !important;
    }

    /* توسيط أزرار الهيرو */
    .hero-text div {
        justify-content: center;
        width: 100%;
    }

    /* تصغير صورة الهيرو لمنعها من دفع الصفحة يميناً */
    .avatar-container img {
        max-width: 250px !important;
        height: auto;
    }
	footer .container[style*="display: grid"] {
        grid-template-columns: 1fr !important; /* تحويل لعمود واحد */
        gap: 2rem !important;
        text-align: center; /* توسيط النصوص */
    }

    footer div[style*="flex-direction: column"] {
        align-items: center !important; /* توسيط الروابط والأيقونات */
    }

    footer div div[style*="display: flex"] {
        justify-content: center !important; /* توسيط أيقونات السوشيال ميديا */
    }
    }
}
