/* =========================================
   1. تنظیمات اولیه و متغیرها (Root & Reset)
   ========================================= */
:root {
    --primary-color: #0099ff;       /* آبی اصلی */
    --secondary-color: #0056b3;     /* آبی تیره برای هاور */
    --accent-color: #00fff9;        /* فیروزه‌ای نئونی برای گلیچ */
    --text-dark: #1e293b;           /* رنگ متن اصلی */
    --text-light: #f8fafc;          /* رنگ متن روشن */
    --glass-bg: rgba(255, 255, 255, 0.85); /* پس‌زمینه شیشه‌ای */
    --dark-glass: rgba(15, 23, 42, 0.95);  /* پس‌زمینه شیشه‌ای تیره */
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(0, 153, 255, 0.4);
    --transition-fast: all 0.3s ease;
    --transition-smooth: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    outline: none;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    background-color: #f1f5f9;
    color: var(--text-dark);
    line-height: 1.8;
    direction: rtl;
    overflow-x: hidden;
    /* این ویژگی برای اسکرول نرم در موبایل عالی است */
    -webkit-font-smoothing: antialiased; 
}

/* استایل اسکرول‌بار سفارشی */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #e2e8f0;
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* =========================================
   2. ساختار اصلی صفحه (Layout Engine)
   ========================================= */
/* این کلاس حیاتی‌ترین بخش برای چسبیدن فوتر است */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
}

main {
    flex: 1 0 auto; /* محتوا را باز می‌کند تا فوتر به پایین هل داده شود */
    width: 100%;
}

#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1; /* پشت تمام المان‌ها */
    background-color: #f8fafc;
}

/* =========================================
   3. هدر کپسولی (Capsule Header)
   ========================================= */
.header {
    position: fixed;
    top: 20px;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    transition: var(--transition-smooth);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 95%;
    max-width: 1200px;
    height: 80px;
    padding: 0 30px;
    background: var(--dark-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

/* لوگو و دکمه در طرفین ثابت هستند */
.logo, .nav-cta {
    flex: 0 0 160px;
}

.logo {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.logo img {
    height: 55px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.3));
}

/* منوی وسط */
.navbar {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.nav-item {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: 25px;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* دکمه تماس */
.contact-btn {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff !important;
    padding: 12px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    box-shadow: var(--shadow-glow);
    transition: var(--transition-fast);
    text-align: center;
}

.contact-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 153, 255, 0.6);
}

/* حالت اسکرول شده هدر */
.header.scrolled {
    top: 0;
}

.header.scrolled .header-container {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 2px solid var(--primary-color);
}

/* =========================================
   4. بنر اصلی و اسلایدر (Hero Section)
   ========================================= */
.hero-section {
    position: relative;
    height: 650px;
    width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 50px;
}

.banner-slider {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
}

/* استایل اسلایدها با انیمیشن Fade */
.slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.1); /* زوم خفیف */
    transition: opacity 1.5s ease-in-out, transform 6s linear;
}

.slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 1;
}

.overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at center, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.8) 100%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
    color: #fff;
    padding: 0 20px;
}

/* انیمیشن گلیچ متن (Glitch Effect) */
.glitch {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 20px;
    text-transform: uppercase;
    position: relative;
    text-shadow: 0.05em 0 0 var(--primary-color), -0.025em -0.05em 0 var(--accent-color), 0.025em 0.05em 0 #75fa69;
    animation: glitch 800ms infinite;
}

@keyframes glitch {
    0% { text-shadow: 0.05em 0 0 var(--primary-color), -0.05em -0.025em 0 var(--accent-color), -0.025em 0.05em 0 #75fa69; }
    14% { text-shadow: 0.05em 0 0 var(--primary-color), -0.05em -0.025em 0 var(--accent-color), -0.025em 0.05em 0 #75fa69; }
    15% { text-shadow: -0.05em -0.025em 0 var(--primary-color), 0.025em 0.025em 0 var(--accent-color), -0.05em -0.05em 0 #75fa69; }
    49% { text-shadow: -0.05em -0.025em 0 var(--primary-color), 0.025em 0.025em 0 var(--accent-color), -0.05em -0.05em 0 #75fa69; }
    50% { text-shadow: 0.025em 0.05em 0 var(--primary-color), 0.05em 0 0 var(--accent-color), 0 -0.05em 0 #75fa69; }
    99% { text-shadow: 0.025em 0.05em 0 var(--primary-color), 0.05em 0 0 var(--accent-color), 0 -0.05em 0 #75fa69; }
    100% { text-shadow: -0.025em 0 0 var(--primary-color), -0.025em -0.025em 0 var(--accent-color), -0.025em -0.05em 0 #75fa69; }
}

.hero-subtitle {
    font-size: 1.8rem;
    font-weight: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.dynamic-text {
    font-weight: 800;
    color: var(--accent-color);
    padding-left: 15px;
    text-align: right;
    min-width: 120px;
}

/* =========================================
   5. بخش‌های محتوایی (Glass Cards)
   ========================================= */
.menu-section {
    max-width: 1100px;
    margin: 60px auto;
    padding: 50px;
    background: var(--glass-bg);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    
    /* انیمیشن ظاهر شدن */
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease-out;
}

.menu-section.active {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    font-size: 2.2rem;
    color: var(--secondary-color);
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
}

.about-us-text p {
    font-size: 1.1rem;
    color: #475569;
    text-align: justify;
    margin-bottom: 20px;
}

/* =========================================
   6. گالری پروژه‌ها (Project Sliders)
   ========================================= */
.product-group {
    margin-bottom: 30px;
}

.service-label {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--text-dark);
    margin: 30px 0 15px 0;
    padding-right: 15px;
    border-right: 4px solid var(--primary-color);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.gallery-container {
    display: flex;
    overflow-x: auto;
    gap: 25px;
    padding: 20px 5px;
    scroll-behavior: smooth;
    /* مخفی کردن اسکرول‌بار اما فعال بودن اسکرول */
    scrollbar-width: none; 
    -ms-overflow-style: none;
}

.gallery-container::-webkit-scrollbar {
    display: none;
}

.tilt-card {
    flex: 0 0 320px; /* عرض ثابت کارت‌ها */
    margin: 0;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

.tilt-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 20px;
    border: 4px solid #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: var(--transition-fast);
}

.tilt-card:hover img {
    transform: translateY(-10px);
    border-color: var(--primary-color);
    box-shadow: 0 15px 30px rgba(0, 153, 255, 0.3);
}

/* دکمه‌های اسلایدر */
.slider-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(0, 153, 255, 0.3);
}

.slider-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

/* =========================================
   7. فوتر حرفه‌ای (Modern Footer)
   ========================================= */
.modern-footer {
    background: linear-gradient(to right, #0f172a, #1e293b);
    color: var(--text-light);
    padding: 60px 20px 30px;
    border-top: 5px solid var(--primary-color);
    margin-top: auto; /* اطمینان مضاعف برای چسبیدن به پایین */
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 40px;
}

.footer-info {
    flex: 1;
    min-width: 300px;
    display: flex;
    gap: 50px;
    flex-wrap: wrap;
}

.footer-section h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    display: inline-block;
}

.footer-section p, .footer-section a {
    color: #94a3b8;
    margin-bottom: 10px;
    display: block;
    text-decoration: none;
    transition: 0.3s;
}

.footer-section a:hover {
    color: var(--accent-color);
    padding-right: 5px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-map iframe {
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    filter: grayscale(20%);
    transition: 0.3s;
}

.footer-map iframe:hover {
    filter: grayscale(0%);
}

/* =========================================
   8. ابزارها (Lightbox & BackToTop)
   ========================================= */
.lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    border: 2px solid #fff;
}

.close {
    position: absolute;
    top: 30px; right: 40px;
    color: #fff;
    font-size: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover { color: var(--primary-color); }

.back-to-top {
    position: fixed;
    bottom: 30px; left: 30px;
    width: 50px; height: 50px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: var(--transition-smooth);
    opacity: 0;
    visibility: hidden;
    z-index: 900;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =========================================
   9. ریسپانسیو موبایل (Mobile)
   ========================================= */
@media (max-width: 850px) {
    /* هدر را وادار می‌کنیم که محتوا را فشرده کند اما در یک خط نگه دارد */
    .header-container {
        height: 60px;
        padding: 0 8px;
        width: 98%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap; /* جلوگیری مطلق از شکستن خط */
    }

    /* لوگو را کوچک می‌کنیم تا فضا باز شود */
    .logo {
        flex: 0 1 auto; /* اجازه می‌دهیم در صورت نیاز کمی کوچک شود */
    }
    .logo img {
        height: 30px !important;
        width: auto;
    }

    /* بخش اصلی: منو */
    .navbar {
        display: flex;
        flex: 1 1 auto; /* فضا را پر می‌کند و اجازه انقباض دارد */
        justify-content: center;
        gap: 4px;
        margin: 0 4px;
    }

    .nav-item {
        font-size: 9px; /* فونت را کمی کوچک کردیم تا کلمات کامل جا شوند */
        padding: 4px 6px;
        white-space: nowrap;
        flex-shrink: 1; /* اجازه می‌دهیم کلمات به هم نزدیک‌تر شوند */
    }

    /* دکمه تماس */
    .nav-cta {
        flex: 0 1 auto;
    }
    .contact-btn {
        font-size: 9px;
        padding: 6px 8px !important;
        border-radius: 12px !important;
        white-space: nowrap;
    }

    /* برای اینکه محتوای بنر و نوشته‌ها در گوشی درست دیده شوند */
    .glitch { font-size: 1.8rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-section { height: 350px; }
}