:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --dark: #0f172a;
    --dark-light: #1e293b;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --light: #f8fafc;
    --white: #ffffff;
    --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--dark);
    color: var(--light);
    line-height: 1.6;
    overflow-x: hidden;
}

body[dir="rtl"] {
    font-family: 'Vazirmatn', 'Inter', sans-serif;
}

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

.highlight {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(15, 23, 42, 0.95);
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Fira Code', monospace;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
}

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

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient);
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--white);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Language Toggle Button */
.lang-toggle {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.lang-toggle:hover {
    background: var(--primary);
    color: var(--white);
}

/* Resume Button */
.btn-resume {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-text {
    display: inline-block;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at center, var(--dark-light) 0%, var(--dark) 70%);
}

.hero-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 0.3; }
    90% { opacity: 0.3; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

.hero-content {
    text-align: center;
    z-index: 1;
    padding: 2rem;
}

.hero-greeting {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.hero-greeting-fa {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 500;
}

.hero-name {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title {
    font-size: 1.5rem;
    color: var(--gray-light);
    margin-bottom: 1.5rem;
    font-family: 'Fira Code', monospace;
}

.cursor {
    animation: blink 1s infinite;
}

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

.hero-description {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: var(--gray);
    font-size: 1.1rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.btn {
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--gradient);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

.btn-secondary:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

.hero-social {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.social-link {
    color: var(--gray);
    transition: all 0.3s ease;
}

.social-link:hover {
    color: var(--primary);
    transform: translateY(-3px);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--gray);
    font-size: 0.875rem;
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid var(--gray);
    border-radius: 13px;
    margin: 0 auto 0.5rem;
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--primary);
    border-radius: 2px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 1.5s infinite;
}

@keyframes scroll {
    0% { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(12px); opacity: 0; }
}

/* Sections */
.section {
    padding: 6rem 0;
}

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

.section-subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 3rem;
}

/* About Section */
.about {
    background: var(--dark-light);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    align-items: center;
}

.about-image {
    display: flex;
    justify-content: center;
}

.image-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.about-avatar {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    position: relative;
    z-index: 1;
}

.image-decoration {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 320px;
    height: 320px;
    border: 3px dashed var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--gray-light);
}

.about-intro {
    font-size: 1.2rem;
    color: var(--light) !important;
}

.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    display: block;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.skill-category {
    background: var(--dark-light);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.skill-category:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-xl);
}

.skill-category h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.skill-subcategory {
    margin-bottom: 1.25rem;
}

.skill-subcategory:last-child {
    margin-bottom: 0;
}

.skill-subcategory h4 {
    font-size: 0.95rem;
    color: var(--gray-light);
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tag {
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--light);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
}

.skill-tag:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Projects Section */
.projects {
    background: var(--dark-light);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.project-card {
    background: var(--dark);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.project-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

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

.project-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.8);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
}

.project-card:hover .project-link {
    transform: translateY(0);
    opacity: 1;
}

.project-link:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--white);
}

.project-content p {
    color: var(--gray);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tags span {
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Contact Section */
.contact-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.contact-icon {
    width: 50px;
    height: 50px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.contact-item h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--white);
}

.contact-item p {
    color: var(--gray);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    position: relative;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--dark-light);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--white);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--gray);
    transition: all 0.3s ease;
    pointer-events: none;
}

body[dir="rtl"] .form-group label {
    left: auto;
    right: 1rem;
}

.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:focus ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
    top: -0.75rem;
    font-size: 0.85rem;
    background: var(--dark);
    padding: 0 0.25rem;
    color: var(--primary);
}

body[dir="rtl"] .form-group input:focus ~ label,
body[dir="rtl"] .form-group input:not(:placeholder-shown) ~ label,
body[dir="rtl"] .form-group textarea:focus ~ label,
body[dir="rtl"] .form-group textarea:not(:placeholder-shown) ~ label {
    left: auto;
    right: 0.75rem;
}

body:not([dir="rtl"]) .form-group input:focus ~ label,
body:not([dir="rtl"]) .form-group input:not(:placeholder-shown) ~ label,
body:not([dir="rtl"]) .form-group textarea:focus ~ label,
body:not([dir="rtl"]) .form-group textarea:not(:placeholder-shown) ~ label {
    left: 0.75rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.btn-submit {
    align-self: flex-start;
}

body[dir="rtl"] .btn-submit {
    align-self: flex-end;
}

/* Footer */
.footer {
    background: var(--dark-light);
    padding: 2rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.footer p {
    color: var(--gray);
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    color: var(--gray);
    transition: color 0.3s ease;
}

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

/* Animations */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

[data-animate].animated {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .about-stats {
        justify-content: center;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body, html {
        overflow-x: hidden;
    }

    .nav-container {
        padding: 0.5rem 0.5rem;
        gap: 0.25rem;
    }

    .nav-menu {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        background: none;
        padding: 0;
        gap: 0.15rem;
        transform: none;
        opacity: 1;
        visibility: visible;
        overflow: hidden;
    }

    .nav-link {
        font-size: 0.7rem;
        padding: 0.2rem 0.35rem;
        white-space: nowrap;
    }

    .nav-toggle {
        display: none;
    }

    .lang-toggle {
        padding: 0.2rem 0.4rem;
        font-size: 0.7rem;
        flex-shrink: 0;
    }

    html[dir="rtl"] .nav-menu {
        justify-content: center;
    }

    .hero-name {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .hero-social {
        margin-bottom: 1rem;
    }

    .scroll-indicator {
        display: none;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .about-stats {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .section {
        padding: 4rem 0;
    }

    .section-title {
        font-size: 2rem;
    }

    .container {
        padding: 0 1rem;
    }
    
    .footer .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* RTL Mobile Fixes */
@media (max-width: 768px) {
    html[dir="rtl"] .nav-menu {
        gap: 0.15rem;
    }

    html[dir="rtl"] .hero-content {
        padding: 1rem;
    }

    html[dir="rtl"] .hero-greeting,
    html[dir="rtl"] .hero-greeting-fa {
        font-size: 0.9rem;
        padding: 0 0.5rem;
    }

    html[dir="rtl"] .hero-name {
        font-size: 2rem;
        padding: 0 0.5rem;
        word-wrap: break-word;
    }

    html[dir="rtl"] .hero-title {
        font-size: 1.1rem;
        padding: 0 0.5rem;
    }

    html[dir="rtl"] .hero-description {
        text-align: center;
        font-size: 0.85rem;
        padding: 0 0.5rem;
        line-height: 1.5;
    }

    html[dir="rtl"] .hero-buttons {
        gap: 0.75rem;
        padding: 0 0.5rem;
    }

    html[dir="rtl"] .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }

    html[dir="rtl"] .about-content {
        padding: 0 0.5rem;
    }

    html[dir="rtl"] .about-text {
        text-align: center;
        padding: 0;
    }

    html[dir="rtl"] .about-text p {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    html[dir="rtl"] .about-intro {
        font-size: 1rem;
    }

    html[dir="rtl"] .skill-category {
        padding: 1rem;
    }

    html[dir="rtl"] .skill-tag {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }

    html[dir="rtl"] .project-content {
        padding: 1rem;
    }

    html[dir="rtl"] .project-content h3 {
        font-size: 1rem;
    }

    html[dir="rtl"] .project-content p {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    html[dir="rtl"] .contact-item {
        gap: 0.75rem;
    }

    html[dir="rtl"] .contact-item p {
        font-size: 0.85rem;
    }

    html[dir="rtl"] .form-group input,
    html[dir="rtl"] .form-group textarea {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    html[dir="rtl"] .section-title {
        font-size: 1.5rem;
    }

    html[dir="rtl"] .section-subtitle {
        font-size: 0.85rem;
    }
}