:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-main: #ffffff;
    --bg-secondary: #f8fafc;
    --text-main: #0f172a;
    --text-secondary: #475569;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --card-bg: #1e293b;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Tajawal', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: var(--transition);
    overflow-x: hidden;
}

html {
    scroll-behavior: smooth;
}

/* RTL Support */
[dir="rtl"] {
    font-family: 'Tajawal', sans-serif;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 2rem 4rem;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: -10%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.1) 0%, transparent 70%);
    z-index: -1;
    filter: blur(50px);
}

.hero-content {
    max-width: 800px;
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.profile-img-container {
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
    position: relative;
    border-radius: 50%;
    padding: 8px;
    background: linear-gradient(135deg, var(--primary), #ec4899);
    box-shadow: 0 20px 40px rgba(79, 70, 229, 0.3);
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-main);
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 900;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary), #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.hero-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

/* Sections */
section {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-head {
    text-align: center;
    margin-bottom: 4rem;
}

.section-head h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.card-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-secondary);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: 1.5rem;
}

.project-card {
    padding: 0;
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-info {
    padding: 1.5rem;
}

.toggle-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.toggle-btn:hover {
    background: var(--border);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 1rem;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.video-download-btn,
.video-fullscreen-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    transition: var(--transition);
}

.video-download-btn:hover,
.video-fullscreen-btn:hover {
    transform: scale(1.1);
    background: var(--primary);
    color: white;
}

.image-download-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    z-index: 5;
}

.project-card:hover .image-download-overlay {
    opacity: 1;
}

.website-preview {
    position: relative;
    height: 250px;
    border-radius: 15px;
    overflow: hidden;
}

.website-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.website-preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
    color: white;
}

.website-preview:hover .website-preview-overlay {
    opacity: 1;
}

.website-preview:hover img {
    transform: scale(1.1);
}

/* Social Icons */
.social-icon {
    transition: var(--transition);
    color: var(--text-main);
    background: var(--bg-secondary);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    text-decoration: none;
    font-size: 1.8rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.social-icon:hover {
    transform: translateY(-10px) scale(1.1);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.2);
    color: white;
}

.social-icon.facebook:hover {
    background: #1877f2;
    border-color: #1877f2;
    text-shadow: 0 0 15px rgba(24, 119, 242, 0.5);
}

.social-icon.instagram:hover {
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
    border-color: transparent;
    text-shadow: 0 0 15px rgba(214, 36, 159, 0.5);
}

.social-icon.linkedin:hover {
    background: #0077b5;
    border-color: #0077b5;
    text-shadow: 0 0 15px rgba(0, 119, 181, 0.5);
}

.social-icon.telegram:hover {
    background: #0088cc;
    border-color: #0088cc;
    text-shadow: 0 0 15px rgba(0, 136, 204, 0.5);
}

.social-icon.youtube:hover {
    background: #ff0000;
    border-color: #ff0000;
    text-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

/* Contact Section Enhancements */
#contact .grid {
    grid-template-columns: 1fr 1.5fr;
    gap: 3rem;
    align-items: stretch;
}

.contact-card-info {
    padding: 3rem !important;
    background: linear-gradient(145deg, var(--card-bg), var(--bg-secondary));
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.contact-method {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: 15px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.contact-method:hover {
    border-color: var(--primary);
    transform: translateX(10px);
}

.contact-method i {
    font-size: 2rem;
    color: var(--primary);
}

.contact-method div h4 {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 0.2rem;
}

.contact-method div p {
    font-weight: 700;
    font-size: 1.1rem;
    word-break: break-all;
}

@media (max-width: 992px) {
    #contact .grid {
        grid-template-columns: 1fr;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.8s ease-out forwards;
}

.card {
    opacity: 0;
}

.animate-fadeInUp.card {
    opacity: 1;
}

.glass {
    backdrop-filter: blur(12px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

@media (max-width: 768px) {
    .animate-fadeInUp {
        animation-duration: 0.5s;
    }
}

.mobile-toggle {
    display: none;
}

.hide-mobile {
    display: inline;
}

.nav-action-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }

    .hide-mobile {
        display: none;
    }

    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-main);
        flex-direction: column;
        justify-content: center;
        transition: 0.3s ease-all;
        z-index: 999;
        padding: 2rem;
        gap: 2.5rem;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-links a {
        font-size: 1.5rem;
        font-weight: 700;
    }

    h1 {
        font-size: 2.4rem;
        word-wrap: break-word;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-btns {
        flex-direction: column;
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    section {
        padding: 4rem 1.5rem;
    }

    #contact .grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1.5rem;
    }

    .contact-method {
        padding: 1rem;
        gap: 1rem;
    }

    .contact-method i {
        font-size: 1.5rem;
    }

    .contact-method div p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }

    .nav-container {
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.glass {
    backdrop-filter: blur(12px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.tooltip {
    position: relative;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 0.5rem 1rem;
    background: var(--text-main);
    color: var(--bg-main);
    border-radius: 8px;
    font-size: 0.75rem;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    white-space: nowrap;
}

.tooltip:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}