/* =========================================
   AKBARI SOLUTION — RESPONSIVE CSS (Final Bulletproof Version)
   ========================================= */

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100vw; width: 100%; margin: 0; padding: 0; }
img { max-width: 100%; height: auto; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; width: 100%; }
section, .section { overflow-x: hidden; max-width: 100%; }

.mobile-menu-btn { display: none !important; }

/* =========================================
   TABLET & SMALL LAPTOP (1200px and below)
   ========================================= */
@media (max-width: 1200px) {
    .container { padding: 0 25px; }
    .nav-container { flex-wrap: wrap; gap: 15px; }
    .navbar ul { gap: 20px; }
    .search-box input { width: 150px; }
    .hero-content h2 { font-size: 34px; }
    .products-hero-content h1, .services-hero-content h1 { font-size: 36px; }
    .features-bar { grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 25px 30px; }
    .features-bar-frontend { grid-template-columns: repeat(2, 1fr); }
    .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
    .contact-col { grid-column: span 3; }
    .ws-grid, .ws-grid-3, .ws-grid-4 { grid-template-columns: 1fr; }
    .ws-two-col, .ws-three-col { grid-template-columns: 1fr 1fr; }
}

/* =========================================
   TABLET (1024px and below)
   ========================================= */
@media (max-width: 1024px) {
    .container { padding: 0 20px; }
    .header { padding: 12px 0; }
    .logo img { height: 45px; }
    .navbar ul { gap: 15px; }
    .navbar ul li a { font-size: 13px; }
    .search-box input { width: 120px; font-size: 11px; }
    .btn-primary { padding: 8px 18px; font-size: 13px; }
    .hero-container { min-height: 450px; }
    .hero-content { max-width: 70%; }
    .hero-content h2 { font-size: 30px; }
    .hero-content p { font-size: 14px; }
    .products-hero-content h1, .services-hero-content h1 { font-size: 32px; }
    .products-grid-frontend, .services-grid-frontend { grid-template-columns: repeat(2, 1fr); }
    .features-bar { padding: 20px 25px; }
    .feature-item h4 { font-size: 13px; }
    .feature-item p { font-size: 10px; }
    .product-details-top { grid-template-columns: 1fr; gap: 30px; }
    .product-sidebar { grid-template-columns: 1fr; }
    .checkout-grid { grid-template-columns: 1fr; }
    
    .sidebar { position: fixed !important; left: -280px !important; top: 0 !important; width: 260px !important; height: 100vh !important; z-index: 999 !important; transition: left 0.3s ease !important; box-shadow: none !important; }
    .sidebar.active { left: 0 !important; box-shadow: 6px 0 40px rgba(0, 0, 0, 0.6) !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .menu-toggle { display: flex !important; align-items: center; justify-content: center; }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 15px !important; }
    .data-table, .products-table, .ws-users-table, .perm-matrix-table { display: block !important; overflow-x: auto !important; white-space: nowrap !important; -webkit-overflow-scrolling: touch; width: 100%; }
}

/* =========================================
   MOBILE (768px and below)
   ========================================= */
@media (max-width: 768px) {
    .container { padding: 0 15px !important; }
    
    /* ========== HEADER (قطعی) ========== */
    .header { padding: 15px 0 !important; background: #0A1128 !important; }
    
    .nav-container { 
        display: flex !important; 
        flex-direction: row !important; 
        flex-wrap: wrap !important; 
        align-items: center !important; 
        justify-content: space-between !important; 
        width: 100% !important;
        gap: 10px !important;
    }
    
    /* لوگو سمت چپ */
    .logo { 
        flex: 0 0 auto !important; 
        margin: 0 !important; 
        display: flex !important;
        justify-content: flex-start !important;
        order: 1 !important;
    }
    .logo img { height: 35px !important; width: auto !important; }

    /* دکمه سه‌خط سمت راست */
    .mobile-menu-btn {
        display: flex !important;
        flex: 0 0 auto !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        background: transparent !important;
        border: 1px solid rgba(255,255,255,0.2) !important;
        border-radius: 8px !important;
        color: white !important;
        font-size: 18px !important;
        cursor: pointer !important;
        margin: 0 0 0 auto !important; /* پرت کردن به راست */
        padding: 0 !important;
        order: 2 !important;
    }

    /* منوی کشویی در خط دوم */
    .navbar { 
        order: 3 !important;
        display: none !important; 
        flex: 0 0 100% !important;
        width: 100% !important; 
        margin-top: 10px !important;
    }
    .navbar.active { display: block !important; }
    
    .navbar ul { 
        flex-direction: column !important; 
        width: 100% !important; 
        background: #1C2541 !important; 
        border-radius: 12px !important; 
        padding: 10px !important; 
        gap: 5px !important; 
    }
    .navbar ul li a { 
        display: block !important; 
        padding: 12px 15px !important; 
        border-radius: 8px !important; 
        text-align: left !important; 
        font-size: 14px !important; 
        color: #A0AEC0 !important;
    }
    .navbar ul li a.active { background: rgba(0, 168, 255, 0.1) !important; color: #00A8FF !important; }

    /* سرچ و لاگین در خط سوم */
    .nav-actions { 
        order: 4 !important;
        flex: 0 0 100% !important; 
        width: 100% !important; 
        display: flex !important; 
        flex-direction: row !important; 
        gap: 10px !important; 
        margin-top: 10px !important;
    }
    .search-box { 
        flex: 1 !important; 
        width: auto !important; 
        padding: 8px 15px !important; 
        margin: 0 !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 20px !important;
    }
    .search-box input { width: 100% !important; font-size: 13px !important; }
    .btn-primary { 
        width: auto !important; 
        padding: 10px 20px !important; 
        font-size: 14px !important; 
        flex-shrink: 0 !important; 
        border-radius: 8px !important;
    }

    /* ========== HERO SECTION ========== */
    .hero, .products-hero, .services-hero, .about-hero, .contact-hero, .service-details-hero {
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 40px 0 20px 0 !important;
        min-height: auto !important;
        overflow: hidden !important;
        background: #0A1128 !important;
    }
    
    .hero::before, .products-hero::before, .services-hero::before, .about-hero::before, .contact-hero::before, .service-details-hero::before {
        content: '' !important;
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        background: rgba(10, 17, 40, 0.85) !important; 
        z-index: 2 !important;
    }

    .hero-container, .products-hero-container, .services-hero-container {
        position: relative !important;
        z-index: 5 !important;
        display: block !important;
        width: 100% !important;
        padding: 0 15px !important;
    }
    
    .hero-content, .products-hero-content, .services-hero-content, .about-hero-content, .contact-hero-content, .service-details-info {
        background: transparent !important;
        padding: 0 !important;
        border: none !important;
        text-align: left !important;
        margin-bottom: 30px !important;
    }
    
    .hero-content h2, .products-hero-content h1, .services-hero-content h1, .about-hero-content h1, .contact-hero-content h1, .service-details-info h1 {
        font-size: 26px !important; 
        line-height: 1.3 !important; 
        margin-bottom: 15px !important;
        font-weight: 700 !important;
        color: #FFF !important;
    }
    .hero-content p, .products-hero-content p, .services-hero-content p, .about-hero-content p, .contact-hero-content p, .service-details-info > p {
        font-size: 13px !important; 
        color: #CBD5E1 !important; 
        line-height: 1.6 !important;
    }
    
    .badge { 
        background: transparent !important; 
        border: 1px solid #00A8FF !important; 
        color: #00A8FF !important; 
        font-size: 10px !important; 
        padding: 5px 12px !important; 
        margin-bottom: 15px !important;
        display: inline-block !important;
        white-space: nowrap !important; 
        border-radius: 20px !important;
        max-width: 100% !important;
    }
    
    .hero-image, .products-hero-image, .services-hero-image, .about-hero-bg, .contact-hero-bg, .service-details-hero-image {
        position: absolute !important;
        top: 0 !important; left: 0 !important;
        width: 100% !important; height: 100% !important;
        z-index: 1 !important;
        margin: 0 !important; padding: 0 !important;
    }
    .hero-image img, .products-hero-image img, .services-hero-image img, .about-hero-bg img, .contact-hero-bg img, .service-details-hero-image img {
        width: 100% !important; height: 100% !important;
        object-fit: cover !important;
        object-position: center !important; 
        opacity: 1 !important;
    }
    .about-hero-bg::after, .contact-hero-bg::after { display: none !important; }
    
    /* ========== FEATURES BAR ========== */
    .features-bar, .features-bar-frontend {
        position: relative !important;
        z-index: 5 !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        padding: 0 15px !important;
        gap: 12px !important;
        margin-top: 20px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    .feature-item, .feature-item-frontend {
        display: flex !important;
        flex-direction: row !important;
        text-align: left !important;
        padding: 15px !important;
        background: rgba(28, 37, 65, 0.85) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px !important;
        align-items: center !important;
        gap: 15px !important;
        width: 100% !important;
    }
    .feature-item i, .feature-item-frontend i {
        font-size: 24px !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
        color: #00A8FF !important;
    }
    .feature-item h4, .feature-item-frontend h4 { font-size: 14px !important; margin-bottom: 2px !important; color: #FFF !important; }
    .feature-item p, .feature-item-frontend p { font-size: 12px !important; margin: 0 !important; color: #A0AEC0 !important; }

    /* ========== GRIDS ========== */
    .products-grid-frontend, .services-grid-frontend { display: grid !important; grid-template-columns: 1fr !important; gap: 20px !important; }
    .filter-tabs { justify-content: center !important; flex-wrap: wrap !important; gap: 10px !important; }
    .filter-tab { padding: 10px 18px !important; font-size: 13px !important; }
    .card-content { padding: 20px !important; }
    .card-content h3 { font-size: 18px !important; }
    .card-content p { font-size: 13px !important; }
    .card-content .price { font-size: 20px !important; }
    
    /* ========== FOOTER ========== */
    .footer { padding: 50px 0 0 0 !important; overflow: hidden !important; background: #0A1128 !important; }
    .footer-grid { display: flex !important; flex-direction: column !important; align-items: center !important; gap: 30px !important; width: 100% !important; text-align: center !important; }
    .footer-col { width: 100% !important; text-align: center !important; padding: 0 !important; }
    .brand-col { display: flex !important; flex-direction: column !important; align-items: center !important; }
    .brand-col img { height: 60px !important; margin-bottom: 15px !important; }
    .social-links { justify-content: center !important; gap: 15px !important; }
    .footer-col h4 { font-size: 16px !important; margin-bottom: 15px !important; color: #FFF !important; }
    .footer-col ul li { margin-bottom: 10px !important; }
    .footer-col ul li a { font-size: 14px !important; }
    .contact-col ul li { justify-content: center !important; text-align: center !important; font-size: 14px !important; }
    .footer-tagline { text-align: center !important; font-size: 20px !important; transform: rotate(0deg) !important; margin: 15px auto 0 auto !important; }
    .footer-bottom .container { flex-direction: column !important; gap: 15px !important; text-align: center !important; }
    
    /* ========== OTHER PAGES ========== */
    .checkout-header { flex-direction: column !important; text-align: center !important; }
    .checkout-grid { grid-template-columns: 1fr !important; }
    .checkout-product-card { grid-template-columns: 1fr !important; padding: 20px !important; }
    .checkout-form-row { grid-template-columns: 1fr !important; }
    .product-details-top { grid-template-columns: 1fr !important; gap: 30px !important; }
    .product-sidebar { display: grid !important; grid-template-columns: 1fr !important; gap: 20px !important; }
    .about-stats-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
    .about-stat-item { flex-direction: row !important; justify-content: center !important; text-align: left !important; gap: 15px !important; padding: 0 !important; }
    .about-story-grid { grid-template-columns: 1fr !important; gap: 30px !important; }
    .about-mv-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
    .about-values-grid { grid-template-columns: 1fr !important; gap: 30px !important; }
    .contact-grid { grid-template-columns: 1fr !important; gap: 25px !important; }
    .contact-form-row { grid-template-columns: 1fr !important; }
    .quick-response-box { flex-direction: column !important; text-align: center !important; align-items: center !important; }
    
    /* ========== DASHBOARD / ADMIN ========== */
    .sidebar { position: fixed !important; left: -280px !important; top: 0 !important; width: 260px !important; height: 100vh !important; z-index: 999 !important; transition: left 0.3s ease !important; }
    .sidebar.active { left: 0 !important; box-shadow: 6px 0 40px rgba(0, 0, 0, 0.6) !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    .menu-toggle { display: flex !important; }
    .topbar { padding: 12px 15px !important; flex-wrap: wrap !important; gap: 10px !important; }
    .topbar-left { width: 100% !important; gap: 10px !important; }
    .topbar-right { width: 100% !important; justify-content: space-between !important; }
    .search-bar { max-width: 100% !important; flex: 1 !important; }
    .user-info { display: none !important; }
    .dashboard-content { padding: 20px 15px !important; }
    .stats-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
    .page-header, .ws-page-header { flex-direction: column !important; align-items: flex-start !important; gap: 15px !important; }
    .filter-bar, .users-filter-bar { flex-direction: column !important; align-items: stretch !important; gap: 10px !important; }
    .form-row, .form-actions, .ws-two-col, .ws-three-col, .ws-grid, .ws-grid-3, .ws-grid-4 { grid-template-columns: 1fr !important; }
    .data-table, .products-table, .ws-users-table, .perm-matrix-table { display: block !important; overflow-x: auto !important; white-space: nowrap !important; width: 100% !important; }
    .messages-grid { grid-template-columns: 1fr !important; }
    .media-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .profile-grid { grid-template-columns: 1fr !important; }
}

/* =========================================
   SMALL MOBILE (480px and below)
   ========================================= */
@media (max-width: 480px) {
    .container { padding: 0 12px !important; }
    .logo img { height: 35px !important; }
    .hero-content h2, .products-hero-content h1, .services-hero-content h1, .about-hero-content h1, .contact-hero-content h1 { font-size: 22px !important; }
    .hero-content p { font-size: 12px !important; }
    .about-stats-grid { grid-template-columns: 1fr !important; }
    .media-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .stats-grid { grid-template-columns: 1fr !important; }
    .messages-stats-grid { grid-template-columns: 1fr !important; }
}

/* =========================================
   LARGE SCREEN (> 1400px)
   ========================================= */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
    .hero-content h2 { font-size: 46px; }
    .products-hero-content h1, .services-hero-content h1 { font-size: 46px; }
}

/* =========================================
   LANDSCAPE MOBILE
   ========================================= */
@media (max-width: 900px) and (orientation: landscape) {
    .hero { padding: 20px 0 !important; }
    .hero-container { min-height: auto !important; }
    .hero-image { height: 200px !important; }
}

/* =========================================
   SIDEBAR OVERLAY (Mobile menu)
   ========================================= */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* =========================================
   PRINT STYLES
   ========================================= */
@media print {
    .sidebar, .topbar, .menu-toggle, .dashboard-footer, .header, .footer, .back-to-top, .sidebar-overlay { display: none !important; }
    .main-content { margin-left: 0 !important; width: 100% !important; }
    body { background: white !important; color: black !important; }
}

/* =========================================
   ⚠️ UNIVERSAL SIDEBAR — همه سایزها
   ========================================= */
.menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #A0AEC0;
    font-size: 22px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.menu-toggle:hover {
    background: rgba(0, 168, 255, 0.1);
    color: #00A8FF;
}

body.dashboard-body .sidebar {
    position: fixed !important;
    left: -300px !important;
    top: 0 !important;
    width: 260px !important;
    height: 100vh !important;
    z-index: 9999 !important;
    transition: left 0.3s ease !important;
}
body.dashboard-body .sidebar.active {
    left: 0 !important;
    box-shadow: 6px 0 40px rgba(0, 0, 0, 0.6) !important;
}
body.dashboard-body .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}
body.dashboard-body .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}
body.dashboard-body .sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* =========================================
   FIX FOR SERVICES PAGE - WHY CHOOSE SECTION
   ========================================= */
@media (max-width: 768px) {
    .why-choose-services {
        padding: 40px 0 !important;
    }
    
    .why-choose-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px !important;
        width: 100% !important;
    }
    
    .why-choose-left {
        width: 100% !important;
    }
    
    /* تبدیل ۴ ستون به ۱ ستون */
    .why-features-grid-services {
        display: flex !important;
        flex-direction: column !important; 
        gap: 15px !important;
        width: 100% !important;
    }
    
    /* مرتب کردن هر باکس به صورت آیکون در چپ و متن در راست */
    .why-feature-item {
        display: flex !important;
        flex-direction: row !important; 
        align-items: center !important;
        text-align: left !important;
        padding: 15px 20px !important;
        background: rgba(255, 255, 255, 0.03) !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .why-feature-item i {
        font-size: 32px !important;
        margin-bottom: 0 !important;
        margin-right: 15px !important;
        flex-shrink: 0 !important;
    }
    
    .why-feature-item h4 {
        font-size: 15px !important;
        margin-bottom: 4px !important;
        margin-top: 0 !important;
    }
    
    .why-feature-item p {
        font-size: 12px !important;
        margin: 0 !important;
        line-height: 1.5 !important;
    }
}