:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #1e293b;
    --accent: #06b6d4;
    --light: #f8fafc;
    --gray: #64748b;
    --dark: #1e293b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --card-bg: #ffffff;
    --body-bg: #f8fafc;
    --text-color: #1e293b;
    --header-bg: #ffffff;
    --footer-bg: #0f172a;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --secondary: #f1f5f9;
    --accent: #22d3ee;
    --light: #0f172a;
    --gray: #94a3b8;
    --dark: #f8fafc;
    --card-bg: #1e293b;
    --body-bg: #0f172a;
    --text-color: #f1f5f9;
    --header-bg: #1e293b;
    --footer-bg: #020617;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background-color: var(--body-bg);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header & Navigation */
header {
    background-color: var(--header-bg);
    box-shadow: var(--shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

/* جدا کردن نام و نام خانوادگی در لوگو */
.logo {
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.logo-first {
    color: var(--primary);
}

.logo-last {
    color: var(--accent);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-links a:hover {
    color: var(--primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    background: var(--primary);
    bottom: -5px;
    right: 0;
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.admin-link {
    background: var(--accent);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.admin-link:hover {
    background: var(--primary);
}

.theme-toggle, .lang-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.theme-toggle:hover, .lang-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: rotate(15deg);
}

[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* دکمه زبان */
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
}

.lang-text {
    font-size: 0.8rem;
    font-weight: 600;
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

/* Focus styles for accessibility */
a:focus,
button:focus {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* Hero Section */
.hero {
    padding: 10rem 0 5rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

[data-theme="dark"] .hero {
    background: linear-gradient(135deg, #0c4a6e 0%, #1e3a8a 100%);
}

.hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.1;
    top: -100px;
    left: -100px;
}

.hero::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.1;
    bottom: -50px;
    right: -50px;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

.hero-text {
    flex: 1;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}

.profile-img {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 8px solid var(--card-bg);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--secondary);
}

.hero h2 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 2rem;
    max-width: 600px;
}

.highlight {
    background: linear-gradient(120deg, var(--accent) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}

/* نام‌ها در بخش hero */
.name-parts {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.name-parts .highlight {
    background: linear-gradient(120deg, var(--accent) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 700;
}

.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid var(--primary);
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
}

.btn:hover {
    background: transparent;
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    margin-left: 1rem;
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* دکمه کوچک برای نمونه کارها */
.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-height: 36px;
}

/* Sections */
section {
    padding: 5rem 0;
    transition: var(--transition);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.section-title h2 {
    font-size: 2.5rem;
    color: var(--secondary);
    display: inline-block;
    position: relative;
    padding-bottom: 1rem;
}

.section-title h2::after {
    content: '';
    position: absolute;
    width: 70px;
    height: 4px;
    background: var(--primary);
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    border-radius: 2px;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.about-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.info-item:hover {
    transform: translateY(-5px);
}

.info-item i {
    color: var(--primary);
    font-size: 1.2rem;
}

.skill-tag {
    display: inline-block;
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    min-height: 44px;
    min-width: 44px;
}

.skill-tag:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Skills Section */
.skills {
    background-color: rgba(0, 0, 0, 0.02);
    transition: var(--transition);
}

[data-theme="dark"] .skills {
    background-color: rgba(255, 255, 255, 0.02);
}

.skills-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

.skill-item {
    margin-bottom: 2rem;
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.skill-bar {
    height: 10px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

[data-theme="dark"] .skill-bar {
    background: rgba(255, 255, 255, 0.1);
}

.skill-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 1.5s ease;
}

/* ========== Portfolio Section with Desktop View ========== */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.portfolio-live-preview {
    width: 100%;
    background: #1e293b;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Browser Mockup - شبیه‌سازی مرورگر */
.browser-mockup {
    width: 100%;
    background: #2d3748;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.browser-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #2d3748;
    border-bottom: 1px solid #4a5568;
}

.browser-dots {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.browser-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot-red { background: #f87171; }
.dot-yellow { background: #fbbf24; }
.dot-green { background: #34d399; }

.browser-address-bar {
    flex: 1;
    background: #1a202c;
    border-radius: 20px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #cbd5e1;
    font-size: 0.85rem;
    direction: ltr;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-address-bar i {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.browser-address-bar span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.browser-reload {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.browser-reload:hover {
    background: #4a5568;
    color: white;
    transform: rotate(180deg);
}

/* محتوای مرورگر - نمایش دسکتاپ */
.browser-content {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 200px;
    overflow: hidden;
    background: #f8fafc;
}

/* wrapper برای نمایش دسکتاپ */
.iframe-desktop-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.portfolio-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1280px;
    height: 800px;
    border: none;
    background: white;
    transform-origin: 0 0;
    pointer-events: none;
}

/* لودینگ */
.iframe-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* پیام خطا */
.iframe-error-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    color: #991b1b;
    z-index: 20;
    padding: 20px;
    text-align: center;
}

.iframe-error-message i {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #ef4444;
}

.iframe-error-message p {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.iframe-error-message small {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* محتوای پایین کارت */
.portfolio-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.portfolio-content h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--secondary);
}

.portfolio-content p {
    color: var(--gray);
    margin-bottom: 15px;
    line-height: 1.6;
    font-size: 0.95rem;
    flex: 1;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.portfolio-actions {
    display: flex;
    gap: 10px;
    margin-top: auto;
}

/* Contact Section */
.contact {
    background: #1e293b;
    color: #f8fafc;
    transition: var(--transition);
}

[data-theme="dark"] .contact {
    background: #1e40af;
}

.contact .section-title h2 {
    color: #f8fafc;
}

.contact-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 10px;
    transition: var(--transition);
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.contact-item i {
    color: var(--accent);
    font-size: 1.5rem;
}

.contact-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 10px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #f8fafc;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: #f8fafc;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.2);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* Messages */
.message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 5px;
    text-align: center;
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Footer */
footer {
    background: var(--footer-bg);
    color: white;
    padding: 3rem 0;
    text-align: center;
    transition: var(--transition);
}

.footer-logo {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.footer-logo .logo-first {
    color: var(--primary);
}

.footer-logo .logo-last {
    color: var(--accent);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

.social-links a {
    color: white;
    font-size: 1.5rem;
    transition: var(--transition);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-5px);
}

.copyright {
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Language Styles */
[lang="en"] {
    direction: ltr;
    text-align: left;
}

[lang="en"] .hero-content {
    flex-direction: row-reverse;
}

[lang="en"] .hero h1,
[lang="en"] .hero h2,
[lang="en"] .hero p,
[lang="en"] .section-title h2,
[lang="en"] .about-text p,
[lang="en"] .portfolio-content h3,
[lang="en"] .portfolio-content p {
    text-align: left;
}

[lang="en"] .nav-links a::after {
    right: auto;
    left: 0;
}

[lang="en"] .section-title h2::after {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

[lang="en"] .btn-outline {
    margin-left: 0;
    margin-right: 1rem;
}

[lang="en"] .contact-item:hover {
    transform: translateX(-5px);
}

[lang="en"] .hero h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

[lang="en"] .hero h1 .name-parts {
    flex-direction: row-reverse;
}

[lang="en"] .logo {
    flex-direction: row-reverse;
}

/* Dark Mode Specific */
[data-theme="dark"] .browser-mockup {
    background: #1a202c;
}

[data-theme="dark"] .browser-header {
    background: #1a202c;
    border-bottom-color: #2d3748;
}

[data-theme="dark"] .browser-address-bar {
    background: #0f172a;
    color: #e2e8f0;
}

[data-theme="dark"] .iframe-loader {
    background: #1e293b;
    color: #f1f5f9;
}

[data-theme="dark"] .loader-spinner {
    border-color: #334155;
    border-top-color: #60a5fa;
}

[data-theme="dark"] .browser-reload:hover {
    background: #2d3748;
}

/* Responsive Design */
@media (min-width: 1400px) {
    .browser-content {
        min-height: 280px;
    }
}

@media (max-width: 1200px) {
    .browser-content {
        min-height: 240px;
    }
}

@media (max-width: 992px) {
    .hero-content {
        flex-direction: column;
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-image {
        order: 1;
    }
    
    .about-content, .skills-container, .contact-container {
        grid-template-columns: 1fr;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero h2 {
        font-size: 1.5rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    }
    
    .browser-content {
        min-height: 220px;
    }
    
    .browser-header {
        padding: 8px 12px;
    }
    
    .browser-dot {
        width: 10px;
        height: 10px;
    }
    
    .browser-address-bar {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
    
    [lang="en"] .hero-content {
        flex-direction: column;
    }
    
    [lang="en"] .hero h1, 
    [lang="en"] .hero h2, 
    [lang="en"] .hero p {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        right: -100%;
        flex-direction: column;
        background: var(--header-bg);
        width: 100%;
        text-align: center;
        padding: 2rem 0;
        box-shadow: var(--shadow);
        transition: var(--transition);
        z-index: 999;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .hamburger {
        display: flex;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .section-title h2 {
        font-size: 2rem;
    }
    
    .btn, .btn-outline {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
        text-align: center;
    }
    
    .btn-outline {
        margin-left: 0;
    }
    
    .browser-content {
        min-height: 200px;
    }
    
    .portfolio-content h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .about-info {
        grid-template-columns: 1fr;
    }
    
    .hero {
        padding: 8rem 0 3rem;
    }
    
    .hero h1 {
        font-size: 1.8rem;
    }
    
    .skills-container {
        grid-template-columns: 1fr;
    }
    
    .profile-img {
        width: 250px;
        height: 250px;
    }
    
    .browser-content {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .browser-header {
        padding: 6px 10px;
    }
    
    .browser-dot {
        width: 8px;
        height: 8px;
        gap: 4px;
    }
    
    .browser-address-bar {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    
    .browser-content {
        min-height: 160px;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}