@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Outfit:wght@300;400;600;700&display=swap');

:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-accent: #1e293b;
    --primary: #3b82f6; /* Premium Blue */
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #ef4444; /* Keep a hint of the original red */
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    
    /* Shadows & Transitions */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(239, 68, 68, 0.05) 0px, transparent 50%);
    color: var(--text-white);
    font-family: 'Outfit', 'Amiri', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

[dir="rtl"] {
    font-family: 'Amiri', 'Outfit', sans-serif;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative; /* Anchoring for absolute items */
}

/* Navbar */
.navbar {
    position: absolute !important; /* Force static-like scroll away */
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 2000;
    padding: 0 1rem;
    margin-bottom: 2rem;
    pointer-events: none; /* Let clicks pass through empty parts */
}

.nav-content {
    display: flex;
    justify-content: flex-start; /* Right side in RTL */
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.nav-menu-wrapper {
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0.3rem; 
    border-radius: 50px;
    pointer-events: auto; /* Enable clicks here */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.nav-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px var(--primary-glow);
    flex-shrink: 0;
}

.nav-toggle-btn:hover {
    transform: rotate(15deg) scale(1.1);
}

.nav-horizontal-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    opacity: 0;
    max-width: 0;
    overflow: hidden; /* Added to enforce shrinking */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    padding: 0;
    margin: 0;
}

.nav-horizontal-links.active {
    opacity: 1;
    max-width: 1000px; /* Expand to show links */
    margin-right: 0.5rem; /* Space inside the glass pill */
    padding-right: 0.5rem;
}

.nav-horizontal-links a {
    color: var(--text-white);
    text-decoration: none;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    font-size: 1.15rem;
    font-weight: 600;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
}

.nav-horizontal-links a:hover {
    background: var(--primary);
    border-color: transparent;
    box-shadow: 0 5px 15px var(--primary-glow);
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    border-radius: 20px;
}

/* Animations */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition);
}

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

/* Header & Profile */
header {
    text-align: center;
    padding: 8rem 1rem 4rem;
    position: relative;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 4rem;
}

.profile-container {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

.profile-img {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--glass-border);
    box-shadow: 0 0 30px var(--primary-glow);
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.profile-img:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.profile-background {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 260px;
    height: 260px;
    background: var(--primary);
    filter: blur(60px);
    opacity: 0.2;
    z-index: 1;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    transition: transform 0.3s ease;
    margin-bottom: 0.5rem;
}

.section-title:hover {
    transform: scale(1.02);
}

header p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Social Icons */
.social-icons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-icons a {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    font-size: 1.4rem;
    transition: var(--transition);
    text-decoration: none;
}

.social-icons a:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Brand Colors on Hover */
.social-icons a:hover .fa-facebook-f { color: #1877F2; }
.social-icons a:hover .fa-facebook { color: #1877F2; }
.social-icons a:hover .fa-telegram-plane { color: #24A1DE; }
.social-icons a:hover .fa-telegram { color: #24A1DE; }
.social-icons a:hover .fa-youtube { color: #FF0000; }
.social-icons a:hover .fa-github { color: #333; }
.social-icons a:hover .fa-tiktok { color: #000; }
.social-icons a:hover .fa-x-twitter { color: #1DA1F2; }
.social-icons a:hover .fa-twitter { color: #1DA1F2; }
.social-icons a:hover .fa-instagram { color: #E4405F; }
.social-icons a:hover .fa-globe { color: #3b82f6; }
.social-icons a:hover .fa-android { color: #A4C639; }

/* Let's also add a nice glow effect based on brand color */
.social-icons a:hover:has(.fa-facebook-f), .social-icons a:hover:has(.fa-facebook) { box-shadow: 0 10px 25px rgba(24, 119, 242, 0.4); }
.social-icons a:hover:has(.fa-telegram-plane), .social-icons a:hover:has(.fa-telegram) { box-shadow: 0 10px 25px rgba(36, 161, 222, 0.4); }
.social-icons a:hover:has(.fa-youtube) { box-shadow: 0 10px 25px rgba(255, 0, 0, 0.4); }
.social-icons a:hover:has(.fa-github) { box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2); }
.social-icons a:hover:has(.fa-instagram) { box-shadow: 0 10px 25px rgba(228, 64, 95, 0.4); }

/* Sections */
.section-title-container {
    margin-top: 5rem;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    display: inline-block;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
}

[dir="rtl"] .section-title::after {
    left: auto;
    right: 0;
}

/* Grid & Cards */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.project {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.project:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-10px);
}

.project-img {
    width: 140px;
    height: 140px;
    border-radius: 24px;
    object-fit: cover;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
}

.project h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-white);
}

.project p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Buttons */
.download-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-block;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.download-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px var(--primary-glow);
    filter: brightness(1.1);
}

/* Q&A Accordion */
.qa-container {
    max-width: 800px;
    margin: 2rem auto;
}

.qa {
    margin-bottom: 1rem;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.question {
    width: 100%;
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: none;
    color: var(--text-white);
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    font-family: inherit;
}

.question:hover {
    background: rgba(255, 255, 255, 0.1);
}

.question::after {
    content: '\f107'; /* FontAwesome Chevron */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: var(--transition);
}

.question.active::after {
    transform: rotate(180deg);
}

.panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.5);
}

.panel .text {
    padding: 2rem;
    line-height: 1.8;
}

.panel p {
    margin-bottom: 1rem;
}

/* Contact Popup */
#floatingButton {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 65px;
    height: 65px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 10px 25px var(--primary-glow);
    transition: var(--transition);
    z-index: 1000;
}

#floatingButton:hover {
    transform: scale(1.1) rotate(15deg);
}

#popupForm {
    display: none;
    position: fixed;
    bottom: 110px;
    left: 30px;
    width: 350px;
    padding: 2rem;
    z-index: 1000;
    max-width: calc(100vw - 60px);
    transform-origin: bottom left;
}

#popupForm.active {
    display: block;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

#popupForm h4 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

#popupForm input, #popupForm textarea {
    width: 100%;
    padding: 0.8rem; /* More compact */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    margin-bottom: 0.8rem;
    font-family: inherit;
    transition: var(--transition);
}

#popupForm input:focus, #popupForm textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-buttons {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

#sendMessage, #closeButton {
    flex: 1;
    padding: 0.6rem 0.8rem; /* Even more compact */
    border: none;
    border-radius: 8px; /* Slightly smaller radius */
    font-size: 0.85rem; /* Slightly smaller font */
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

#sendMessage {
    flex: 2; /* Give more space to the primary action */
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

#sendMessage:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
    filter: brightness(1.1);
}

#closeButton {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

#closeButton:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
    filter: brightness(1.1);
}

/* Scroll To Top Button */
#scrollTop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05); /* Matching glass look */
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1000;
}

#scrollTop.active {
    opacity: 1;
    visibility: visible;
}

#scrollTop:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Footer Styling */
footer {
    padding: 5rem 1rem 3rem;
    margin-top: 6rem;
    border-top: 1px solid var(--glass-border);
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    text-align: right;
}

.footer-section h3, .footer-section h4 {
    margin-bottom: 1.5rem;
    color: var(--primary);
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after, .footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30px;
    height: 2px;
    background: var(--primary);
}

.about-section p {
    color: var(--text-muted);
    line-height: 1.8;
}

.links-section ul {
    list-style: none;
    padding: 0;
}

.links-section li {
    margin-bottom: 0.8rem;
}

.links-section a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.links-section a i {
    font-size: 0.8rem;
    color: var(--primary);
    transition: var(--transition);
}

.links-section a:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

.links-section a:hover i {
    transform: translateX(-3px);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .nav-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    .nav-horizontal-links a {
        font-size: 0.95rem;
        padding: 0.6rem 1rem;
    }
    .nav-menu-wrapper {
        padding: 0.2rem;
    }
    header { padding: 6rem 1rem 3.5rem; }
    header h1 { font-size: 2.2rem; }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    .footer-section h3::after, .footer-section h4::after {
        right: 50%;
        transform: translateX(50%);
    }
    .links-section a {
        justify-content: center;
    }
    .profile-img { width: 180px; height: 180px; }
    .section-title { font-size: 1.8rem; }
    .app-grid { grid-template-columns: 1fr; }
    #popupForm { width: calc(100vw - 60px); left: 30px; }
}

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