/* =============================
   RESPONSIVE NAVIGATION & MOBILE MENU
============================= */

/* Hamburger Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-main);
    border-radius: 3px;
    transition: var(--transition);
}

/* Hamburger animation when open */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Hide mobile auth buttons on desktop by default */
.mobile-only-auth {
    display: none;
}

/* Mobile Navigation */
@media (max-width: 968px) {
    .hamburger {
        display: flex;
        order: 3;
        /* Move to the right */
        margin-left: auto;
    }

    .main-nav {
        position: relative;
    }

    .theme-toggle {
        order: 1;
        /* Keep on left */
    }

    .brand-link {
        order: 2;
        /* Middle */
        margin: 0 auto 0 1rem;
    }

    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background: var(--bg-surface);
        flex-direction: column;
        padding: 2rem;
        gap: 0;
        justify-content: flex-start;
        transition: left 0.3s ease;
        box-shadow: var(--shadow-strong);
        overflow-y: auto;
        z-index: 1000;
    }

    body.dark-mode .nav-links {
        background: var(--bg-surface);
        border-right: 1px solid var(--border-subtle);
    }

    /* THIS IS THE KEY FIX! */
    .nav-links.active {
        left: 0;
    }

    .nav-links li {
        width: 100%;
        margin: 0;
    }

    .nav-link {
        display: block;
        padding: 0.75rem 0.5rem;
    }

    /* Hide desktop auth buttons on mobile */
    .desktop-only-auth {
        display: none !important;
    }

    /* Show mobile auth buttons inside menu */
    .mobile-only-auth {
        display: block;
        padding: 0.5rem 1rem;
        /* اضافه شد: padding افقی */
        text-align: center;
    }

    .mobile-only-auth .btn {
        width: 90%;
        display: inline-block;
    }

    .brand-logo {
        width: 50px;
        height: 50px;
    }

    .brand {
        font-size: 1.1rem;
    }

    .container {
        padding: 0 1.5rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .impact-stats {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Small Mobile */
@media (max-width: 576px) {
    .container {
        padding: 0 1rem;
    }

    .hero {
        padding: 3rem 0 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .hero-cta {
        flex-direction: column;
    }

    .hero .btn {
        width: 100%;
        max-width: 300px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .footer-links {
        justify-content: center;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }
}

/* Scroll to Top Button - Responsive */
#scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--accent-teal);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

#scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
}

#scroll-to-top:hover {
    background: var(--accent-gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 576px) {
    #scroll-to-top {
        width: 45px;
        height: 45px;
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 1.25rem;
    }
}