/* ==================== 1. FONTS (فونت‌ها) ==================== */
@font-face {
    font-family: "Dana";
    src: url("fonts/Dana-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Dana";
    src: url("fonts/Dana-Bold.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "BYekanPlus";
    src: local("Tahoma");
}

/* ==================== 2. VARIABLES (متغیرها - همیشه دارک) ==================== */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;

    /* پس‌زمینه‌ها */
    --bg-base: #000000;
    --bg-glass: rgba(10, 10, 10, 0.85);
    --bg-card: #0a0a0a;          /* کارت‌های عمومی */
    --bg-card-darker: #0B0E14;   /* کارت‌های نمونه‌کار (خیلی تیره) */
    --bg-card-hover: #111;
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-pill: rgba(59, 130, 246, 0.1);

    /* متون */
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-tertiary: #737373;

    /* حاشیه‌ها و سایه‌ها */
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --shadow-glow: rgba(59, 130, 246, 0.3);

    /* فونت‌ها */
    --font-sans: "Dana", "BYekanPlus", "Inter", sans-serif;
    --font-display: "Dana", "BYekanPlus", "Space Grotesk", sans-serif;

    --radius-xl: 1.5rem;
}

/* ==================== 3. RESET & BASE ==================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-base);
    overflow-x: hidden;
    min-height: 100vh;
    direction: rtl;
    text-align: right;
}
h1, h2, h3, h4, .brand-text { font-family: var(--font-display); font-weight: 800; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; height: auto; }

/* ==================== 4. BACKGROUND EFFECTS ==================== */
.mesh-bg {
    position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -2;
    background: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
    animation: meshMove 20s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes meshMove { 0% { transform: scale(1); } 100% { transform: scale(1.1); } }
#particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.6; }

/* ==================== 5. LOADER (NexarTech Neon) ==================== */
.loader {
    position: fixed; inset: 0; background: #000000; z-index: 99999;
    display: flex; justify-content: center; align-items: center;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}
.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-content { display: flex; flex-direction: column; align-items: center; width: 300px; }
.loader-logo {
    font-family: 'Inter', sans-serif; font-size: 3rem; font-weight: 800; margin-bottom: 2rem;
    letter-spacing: -1px; background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.loader-spinner { width: 60px; height: 60px; position: relative; margin-bottom: 1.5rem; }
.spinner-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; }
.spinner-ring:nth-child(1) { border-top-color: #8b5cf6; border-right-color: #8b5cf6; animation: spin 1.5s linear infinite; }
.spinner-ring:nth-child(2) { inset: 8px; border-bottom-color: #06b6d4; border-left-color: #06b6d4; animation: spin 2s linear infinite reverse; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loader-text { font-family: 'Inter', sans-serif; color: #555; font-size: 0.8rem; font-weight: 600; letter-spacing: 2px; margin-bottom: 1rem; text-transform: uppercase; }
.loader-progress { width: 150px; height: 3px; background: #1a1a1a; border-radius: 4px; overflow: hidden; }
.loader-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #3b82f6, #06b6d4); transition: width 0.1s linear; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); }

/* ==================== 6. NAVBAR & UI COMPONENTS ==================== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; width: 100%; }
section { padding: 5rem 1rem; position: relative; }

.navbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border-color); background: var(--bg-glass);
}
.nav-content { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; max-width: 1400px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; color: var(--text-primary); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-link { color: var(--text-secondary); transition: 0.2s; position: relative; }
.nav-link:hover { color: var(--text-primary); }
.nav-link::after { content: ""; position: absolute; bottom: -5px; right: 0; width: 0; height: 2px; background: var(--primary); transition: 0.3s; }
@media (max-width: 768px) { .nav-links { display: none; } }

/* Buttons */
.btn { padding: 0.75rem 1.5rem; border-radius: 99px; font-weight: 700; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 15px var(--shadow-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--shadow-glow); filter: brightness(1.1); }
.btn-outline { border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--primary); background: var(--bg-pill); }

/* Badges & Titles */
.badge-pill {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.6rem 1.5rem; background: var(--bg-pill);
    border: 1px solid var(--primary); color: var(--primary);
    border-radius: 99px; font-size: 1rem; font-weight: 700; margin-bottom: 1.5rem;
    backdrop-filter: blur(5px);
}
.gradient-text-style {
    font-family: var(--font-display); font-weight: 900;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    font-size: clamp(2rem, 4vw, 3rem); line-height: 1.3; margin-bottom: 1rem; text-align: center;
}

/* ==================== 7. HERO SECTION ==================== */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding-top: 80px; }
.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem); margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-desc { font-size: 1.2rem; color: var(--text-secondary); max-width: 700px; margin: 0 auto 2.5rem; }
.hero-btns { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-top: 2rem; }
.hero-btn-lg { padding: 1rem 2.5rem; font-size: 1.25rem; border-radius: 99px; font-weight: 800; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s; }

/* ==================== 8. STATS SECTION ==================== */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 2rem; width: 100%; }
.stat-box {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 2.5rem; padding: 2.5rem 1.5rem; text-align: center;
    transition: 0.3s; display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 10px 30px var(--shadow-color);
}
.stat-box:hover { transform: translateY(-10px); border-color: var(--primary); box-shadow: 0 15px 40px var(--shadow-glow); }
.stat-icon { font-size: 3.5rem; margin-bottom: 1rem; filter: drop-shadow(0 0 10px var(--border-color)); }
.stat-number { font-family: var(--font-display); font-size: 3.5rem; font-weight: 900; color: var(--primary); margin-bottom: 0.5rem; text-shadow: 0 0 20px var(--shadow-glow); }
.stat-label { font-size: 1.1rem; color: var(--text-secondary); font-weight: 500; }

/* ==================== 9. SERVICES SECTION ==================== */
.services-grid-new { display: grid; width: 100%; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; align-items: stretch; }
@media (min-width: 1024px) { .services-grid-new { grid-template-columns: repeat(4, 1fr); gap: 2rem; } }
@media (max-width: 480px) { .services-grid-new { grid-template-columns: 1fr; } }

.service-card-new {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 2rem; padding: 2rem 1.5rem; display: flex; flex-direction: column;
    align-items: center; text-align: center; transition: 0.3s; height: 100%; width: 100%;
}
.service-card-new:hover { transform: translateY(-8px); border-color: var(--primary); background: var(--bg-card-hover); box-shadow: 0 20px 40px var(--shadow-color); }
.service-icon-box {
    width: 60px; height: 60px; background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-radius: 1.2rem; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: white; margin-bottom: 1.5rem; box-shadow: 0 10px 20px var(--shadow-glow);
}
.service-title-new { font-size: 1.3rem; margin-bottom: 1rem; color: var(--text-primary); min-height: 3rem; display: flex; align-items: center; justify-content: center; }
.service-desc-new { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 2rem; text-align: justify; text-align-last: center; width: 100%; line-height: 1.8; }
.service-list { width: 100%; margin-bottom: 2rem; padding-right: 0.5rem; text-align: right; }
.service-list-item { display: flex; align-items: center; gap: 8px; margin-bottom: 0.8rem; font-size: 0.8rem; color: var(--text-secondary); }
.check-icon { width: 18px; height: 18px; background: var(--bg-pill); color: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; flex-shrink: 0; }
.service-btn-new { width: 100%; margin-top: auto; padding: 1rem; background: var(--primary); color: #fff; border-radius: 1rem; font-weight: 700; border: none; transition: 0.2s; }
.service-btn-new:hover { background: var(--primary-dark); transform: scale(1.02); }

/* ==================== 10. TIMELINE SECTION ==================== */
.timeline-container { position: relative; max-width: 1000px; margin: 4rem auto 0; padding: 2rem 0; }
.timeline-container::after {
    content: ""; position: absolute; top: 0; bottom: 0; right: 50%; width: 2px;
    background: linear-gradient(180deg, rgba(59,130,246,0) 0%, var(--primary) 15%, var(--accent-purple) 85%, rgba(139,92,246,0) 100%);
    transform: translateX(50%); box-shadow: 0 0 15px var(--shadow-glow);
}
.timeline-item { position: relative; width: 50%; padding: 0 40px; margin-bottom: 4rem; box-sizing: border-box; }
.timeline-item:nth-child(odd) { margin-left: auto; text-align: right; right: -2px; }
.timeline-item:nth-child(even) { margin-right: auto; text-align: left; left: -2px; }
.timeline-number {
    position: absolute; top: 0; width: 40px; height: 40px;
    background: var(--bg-base); border: 2px solid var(--primary); border-radius: 50%;
    z-index: 10; display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: var(--text-primary); box-shadow: 0 0 15px var(--shadow-glow); transition: 0.3s;
}
.timeline-item:nth-child(odd) .timeline-number { right: -20px; }
.timeline-item:nth-child(even) .timeline-number { left: -20px; }
.timeline-item:hover .timeline-number { transform: scale(1.2); background: var(--primary); color: #fff; }
.timeline-content {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color);
    backdrop-filter: blur(10px); padding: 1.5rem; border-radius: 1.5rem; position: relative; transition: 0.3s;
}
.timeline-content:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--primary); transform: translateY(-5px); box-shadow: 0 10px 30px var(--shadow-color); }
.timeline-title { font-size: 1.25rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.timeline-desc { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
@media (max-width: 768px) {
    .timeline-container::after { right: 30px; }
    .timeline-item { width: 100%; padding-right: 70px; padding-left: 0; text-align: right !important; }
    .timeline-item:nth-child(even), .timeline-item:nth-child(odd) { left: 0; right: 0; }
    .timeline-number, .timeline-item:nth-child(even) .timeline-number { right: 10px; left: auto; }
}

/* ==================== 11. TECH STACK SECTION ==================== */
.tech-grid { display: grid; width: 100%; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; }
@media (min-width: 1024px) { .tech-grid { grid-template-columns: repeat(6, 1fr); gap: 1.5rem; } }
.tech-card {
    background: rgba(255, 255, 255, 0.02); border: 1px solid var(--border-color);
    border-radius: 1.5rem; padding: 1.5rem 0.5rem; text-align: center;
    transition: 0.3s; backdrop-filter: blur(5px);
}
.tech-card:hover { border-color: var(--primary); background: rgba(255, 255, 255, 0.05); transform: translateY(-5px); box-shadow: 0 10px 20px var(--shadow-color); }
.tech-title { color: var(--primary); font-size: 0.95rem; font-weight: 800; margin-bottom: 1rem; text-transform: uppercase; }
.tech-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tech-item { background: rgba(255, 255, 255, 0.05); padding: 0.4rem; border-radius: 0.5rem; font-size: 0.75rem; color: var(--text-secondary); transition: 0.2s; font-family: "Inter", sans-serif; }
.tech-card:hover .tech-item { background: var(--bg-pill); color: var(--text-primary); }

/* ==================== 12. TEAM SECTION (نئونی قاب‌دار) ==================== */
.team-grid-new { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 3rem 1.5rem; margin-top: 3rem; justify-content: center; }
.team-card-new { display: flex; flex-direction: column; align-items: center; text-align: center; transition: 0.3s; position: relative; }
.team-card-new:hover { transform: translateY(-10px); }
.team-photo-box {
    width: 140px; height: 140px; padding: 3px;
    background: linear-gradient(135deg, var(--primary), var(--accent-purple));
    border-radius: 1.5rem; margin-bottom: 1.2rem; box-shadow: 0 10px 30px var(--shadow-glow);
}
.team-photo-new {
    width: 100%; height: 100%; object-fit: cover; border-radius: 1.3rem;
    border: 3px solid #000; background-color: #111;
    filter: grayscale(100%); transition: 0.3s;
}
.team-card-new:hover .team-photo-new { filter: grayscale(0%); }
.team-name-new { font-size: 1.1rem; color: var(--text-primary); margin-bottom: 0.3rem; }
.team-role-new { font-size: 0.85rem; color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

/* ==================== 13. PROJECTS/PORTFOLIO (اصلاح شده و نهایی) ==================== */
.pf-filter { display: flex; justify-content: center; gap: 12px; margin-bottom: 3rem; flex-wrap: wrap; }
.pf-btn {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color);
    color: var(--text-secondary); padding: 0.6rem 1.5rem; border-radius: 50px;
    font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: 0.3s;
}
.pf-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.pf-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 0 20px var(--shadow-glow); }

.pf-grid {
    display: grid; width: 100%; gap: 1.5rem;
    grid-template-columns: 1fr; /* موبایل */
}
@media (min-width: 640px) { .pf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .pf-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .pf-grid { grid-template-columns: repeat(4, 1fr); } }

.pf-card {
    background-color: var(--bg-card-darker);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1.2rem; padding: 12px;
    transition: 0.3s; display: flex; flex-direction: column;
}
.pf-card:hover { transform: translateY(-8px); border-color: var(--primary); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.pf-thumb {
    width: 100%; aspect-ratio: 16/9; border-radius: 0.8rem; overflow: hidden;
    margin-bottom: 1rem; position: relative; background: #000;
}
.pf-img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.pf-card:hover .pf-img { transform: scale(1.05); }
.pf-content { text-align: right; padding: 0 4px; }
.pf-title {
    font-family: "Dana", var(--font-display); font-size: 1.1rem; font-weight: 800;
    color: #fff; margin-bottom: 0.4rem; letter-spacing: -0.5px;
}
.pf-category {
    font-family: "Dana", var(--font-sans); font-size: 0.85rem;
    color: var(--primary); font-weight: 500;
}
.pf-item.hidden { display: none; }

/* ==================== 14. AI CONSULTANT ==================== */
.ai-card {
    max-width: 800px; margin: 0 auto; background: var(--bg-card);
    border: 1px solid var(--border-color); backdrop-filter: blur(12px);
    border-radius: 2rem; padding: 3rem 2rem; text-align: center;
    box-shadow: 0 20px 50px var(--shadow-color); position: relative; overflow: hidden;
}
.ai-card::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 60%); pointer-events: none;
}
.ai-textarea {
    width: 100%; min-height: 180px; background: rgba(0,0,0,0.4);
    border: 2px solid var(--border-color); border-radius: 1.5rem; padding: 1.5rem;
    color: var(--text-primary); font-family: var(--font-sans); font-size: 1.1rem;
    line-height: 1.8; resize: vertical; outline: none; transition: 0.3s; margin-bottom: 2rem;
}
.ai-textarea:focus { border-color: var(--primary); background: rgba(0,0,0,0.6); box-shadow: 0 0 20px var(--shadow-glow); }
.ai-btn {
    width: 100%; padding: 1.2rem; background: linear-gradient(90deg, var(--primary), var(--accent-purple));
    color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem;
    border-radius: 1rem; border: none; cursor: pointer; transition: 0.3s; display: flex;
    align-items: center; justify-content: center; gap: 12px;
}
.ai-btn:hover { transform: translateY(-4px); box-shadow: 0 15px 30px var(--shadow-glow); filter: brightness(1.1); }
.ai-result-container {
    margin-top: 2rem; padding: 2rem; background: var(--bg-pill);
    border: 1px solid var(--border-color); border-radius: 1.5rem; text-align: right;
    display: none; animation: slideUp 0.5s ease forwards;
}
.ai-result-container.visible { display: block; }
.ai-result-header { display: flex; align-items: center; gap: 10px; color: var(--primary); font-weight: 800; margin-bottom: 1rem; }
.ai-result-text { color: #e5e5e5; line-height: 1.8; font-size: 1rem; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.loading-dots::after { content: ' .'; animation: dots 1.5s steps(5, end) infinite; }
@keyframes dots { 0%, 20% { content: ' .'; } 40% { content: ' ..'; } 60% { content: ' ...'; } 80%, 100% { content: ' ....'; } }

/* ==================== 15. FOOTER & MISC ==================== */
footer { border-top: 1px solid var(--border-color); padding: 4rem 1.5rem 2rem; background: var(--bg-card); margin-top: 4rem; }
.mobile-controls { display: none !important; }