/* ==========================================================================
   البرز هاب - ماژول ریسپانسیو Mobile First
   شامل: Off Canvas Sidebar, Sticky CTA, Responsive Tables,
          Responsive Elementor Widgets, Tablet Optimization, CLS Fix
   ========================================================================== */

/* ---------- پایه Mobile First ---------- */
.alborz-mobile-first * {
    -webkit-tap-highlight-color: transparent;
}

.alborz-mobile-first img,
.alborz-mobile-first video,
.alborz-mobile-first iframe {
    max-width: 100%;
    height: auto;
}

.alborz-mobile-first {
    -webkit-text-size-adjust: 100%;
}

/* ---------- CLS Fix: رزرو فضای عناصر پویا ----------
   توجه: عمداً به هیچ سلکتور عمومی img اعمال نمی‌شود تا لوگو، آواتار
   دایره‌ای کارشناسان، آیکون‌های فوتر و تصاویر محتوا به‌هم نریزند.
   فقط روی کانتینرهایی که خودِ پلاگین ساختار/نسبت ابعادشان را تعریف
   کرده اعمال می‌شود. */
.alborz-cls-fix .alborz-blog-w-thumb {
    aspect-ratio: 16 / 9;
}

.alborz-cls-fix .alborz-blog-w-thumb-item-img,
.alborz-cls-fix .alborz-cat-card-image {
    aspect-ratio: 1 / 1;
}

.alborz-cls-fix [data-skeleton] {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 400% 100%;
    animation: alborzSkeleton 1.4s ease infinite;
    min-height: 1em;
    border-radius: 6px;
}

@keyframes alborzSkeleton {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.alborz-cls-fix .alborz-cat-table-wrap,
.alborz-cls-fix .at-reviews-table-wrap,
.alborz-cls-fix .alborz-price-table-wrapper {
    min-height: 120px;
}

/* ---------- Off Canvas Sidebar ---------- */
.alborz-offcanvas-active .alborz-hf-drawer-panel {
    will-change: right;
}

.alborz-offcanvas-active body.alborz-hf-no-scroll {
    position: fixed;
    width: 100%;
}

@media (max-width: 992px) {
    .alborz-offcanvas-active .alborz-cat-cards-row {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- Sticky CTA ---------- */
.alborz-sticky-cta {
    position: fixed;
    bottom: 16px;
    left: 0;
    right: 0;
    z-index: 9990;
    display: flex;
    justify-content: center;
    pointer-events: none;
    padding: 0 16px env(safe-area-inset-bottom, 0px);
    direction: rtl;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    opacity: 0;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.alborz-sticky-cta.alborz-sticky-cta-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.alborz-sticky-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 360px;
    background: linear-gradient(135deg, var(--gold, #f5b901), var(--gold-dark, #e5a800));
    color: var(--dark, #1e293b) !important;
    border: none;
    border-radius: 50px;
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(245, 185, 1, 0.35), 0 4px 12px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.alborz-sticky-cta-btn:active {
    transform: scale(0.97);
    box-shadow: 0 4px 14px rgba(245, 185, 1, 0.35);
}

.alborz-sticky-cta-btn svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
}

@media (max-width: 992px) {
    .alborz-sticky-cta-enabled .alborz-sticky-cta {
        display: flex;
    }
    .alborz-sticky-cta-enabled.alborz-sticky-cta-padding {
        padding-bottom: 80px;
    }
}

@media (min-width: 993px) {
    .alborz-sticky-cta {
        display: none !important;
    }
}

@media (max-width: 380px) {
    .alborz-sticky-cta-btn {
        padding: 13px 18px;
        font-size: 14px;
    }
}

/* ---------- Responsive Tables ---------- */
.alborz-rtables .alborz-cat-table-wrap,
.alborz-rtables .at-reviews-table-wrap,
.alborz-rtables .alborz-price-table-wrapper,
.alborz-rtables .edit-tags-php .wp-list-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

.alborz-rtables .alborz-cat-table-wrap::after,
.alborz-rtables .at-reviews-table-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 24px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(255,255,255,0), rgba(255,255,255,0.9));
    opacity: 0;
    transition: opacity 0.2s;
}

.alborz-rtables .alborz-cat-table-wrap.is-scrollable::after,
.alborz-rtables .at-reviews-table-wrap.is-scrollable::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .alborz-rtables .alborz-cat-products-table,
    .alborz-rtables .at-reviews-table,
    .alborz-rtables .alborz-price-table {
        min-width: 640px;
    }

    .alborz-rtables .alborz-cat-products-table thead th,
    .alborz-rtables .alborz-cat-products-table tbody td,
    .alborz-rtables .at-reviews-table th,
    .alborz-rtables .at-reviews-table td {
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    .alborz-rtables .alborz-cat-products-table .name,
    .alborz-rtables .at-reviews-table .at-review-text {
        white-space: normal;
        min-width: 140px;
    }
}

/* ---------- Responsive Elementor Widgets ---------- */
@media (max-width: 1024px) {
    .alborz-relementor .elementor-widget-alborz_team .at-team-wrapper[class*="at-team-grid"],
    .alborz-relementor .at-team-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .alborz-relementor .alborz-blog-w-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 600px) {
    .alborz-relementor .at-team-grid,
    .alborz-relementor .alborz-blog-w-grid,
    .alborz-relementor .alborz-blog-w-cols-2,
    .alborz-relementor .alborz-blog-w-cols-3,
    .alborz-relementor .alborz-blog-w-cols-4,
    .alborz-relementor .at-related-grid {
        grid-template-columns: 1fr !important;
    }

    .alborz-relementor .elementor-column {
        width: 100% !important;
    }

    .alborz-relementor .ah-expert-swiper-prev,
    .alborz-relementor .ah-expert-swiper-next {
        width: 30px !important;
        height: 30px !important;
    }
}

/* ---------- Tablet Optimization ---------- */
@media (min-width: 768px) and (max-width: 1024px) {
    .alborz-tablet-opt .alborz-cat-container,
    .alborz-tablet-opt .at-product-container {
        max-width: 96%;
        padding: 24px 16px;
    }

    .alborz-tablet-opt .alborz-cat-cards-row {
        grid-template-columns: 1fr 1fr;
    }

    .alborz-tablet-opt .alborz-cat-card-chart,
    .alborz-tablet-opt .alborz-cat-card-expert {
        grid-column: span 1;
    }

    .alborz-tablet-opt .alborz-cat-card-info {
        grid-column: span 2;
    }

    .alborz-tablet-opt .alborz-blog-w-cols-3,
    .alborz-tablet-opt .alborz-blog-w-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .alborz-tablet-opt .at-team-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .alborz-tablet-opt .alborz-pt-modern-table th,
    .alborz-tablet-opt .alborz-pt-modern-table td {
        padding: 12px 10px;
        font-size: 13px;
    }
}
