/* ========================================
   استایل‌های اصلی پلاگین مشاوران حرفه‌ای
   ======================================== */

/* ===== استایل‌های پایه ===== */
.adviser-categories-wrapper,
.adviser-consultants-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
    direction: rtl;
    box-sizing: border-box;
}

.adviser-section-title {
    text-align: right;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 25px;
    color: #333;
    border-bottom: 3px solid #4CAF50;
    padding-bottom: 10px;
}

/* ========================================
   کاروسل - با direction: ltr برای حرکت صحیح
   ======================================== */
.categories-carousel,
.consultants-carousel {
    position: relative;
    overflow: hidden;
    padding: 10px 50px 20px 50px;
    margin: 0 -10px;
    touch-action: pan-y;
    direction: ltr !important; /* مهم: برای حرکت صحیح */
}

.categories-carousel .carousel-track,
.consultants-carousel .carousel-track {
    display: flex;
    gap: 0;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    cursor: grab;
    touch-action: pan-y;
    direction: ltr !important;
}

.categories-carousel .carousel-track:active,
.consultants-carousel .carousel-track:active {
    cursor: grabbing;
}

.categories-carousel .carousel-item,
.consultants-carousel .carousel-item {
    flex: 0 0 auto;
    width: calc(100% / 3 - 20px);
    min-width: 250px;
    max-width: 350px;
    padding: 0 10px;
    box-sizing: border-box;
    direction: rtl !important; /* محتوای داخل کارت راست به چپ */
}

/* ========================================
   دکمه‌های کاروسل
   ======================================== */
.categories-carousel .carousel-nav,
.consultants-carousel .carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    z-index: 9999 !important;
    border-radius: 50%;
    font-size: 20px;
    transition: all 0.3s ease;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
}

.categories-carousel:hover .carousel-nav,
.consultants-carousel:hover .carousel-nav {
    opacity: 1;
    pointer-events: auto;
}

.categories-carousel .carousel-nav:hover,
.consultants-carousel .carousel-nav:hover {
    background: rgba(0, 0, 0, 0.95);
    transform: translateY(-50%) scale(1.08);
}

.categories-carousel .carousel-nav:active,
.consultants-carousel .carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

/* دکمه چپ (❮) - در سمت چپ */
.categories-carousel .carousel-nav.prev,
.consultants-carousel .carousel-nav.prev {
    left: 5px;
}

/* دکمه راست (❯) - در سمت راست */
.categories-carousel .carousel-nav.next,
.consultants-carousel .carousel-nav.next {
    right: 5px;
}

/* ===== در موبایل دکمه‌ها همیشه نمایش داده شوند ===== */
@media (max-width: 768px) {
    .categories-carousel,
    .consultants-carousel {
        padding: 10px 40px 20px 40px;
        direction: ltr !important;
    }
    
    .categories-carousel .carousel-nav,
    .consultants-carousel .carousel-nav {
        opacity: 1 !important;
        pointer-events: auto !important;
        width: 38px;
        height: 38px;
        padding: 8px 10px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .categories-carousel,
    .consultants-carousel {
        padding: 10px 30px 20px 30px;
        direction: ltr !important;
    }
    
    .categories-carousel .carousel-nav,
    .consultants-carousel .carousel-nav {
        width: 32px;
        height: 32px;
        padding: 6px 8px;
        font-size: 14px;
    }
}

/* ===== برای رزولوشن بالا (لپ‌تاپ و دسکتاپ) ===== */
@media (min-width: 769px) {
    .categories-carousel,
    .consultants-carousel {
        direction: ltr !important;
    }
}

/* ===== کارت‌های داخل کاروسل ===== */
.carousel-item .consultant-card,
.carousel-item .category-item {
    height: 100%;
    min-height: 280px;
}

/* ========================================
   دسته‌بندی‌ها (حالت شبکه‌ای)
   ======================================== */
.adviser-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.category-item {
    background: #fff;
    border-radius: 15px;
    padding: 25px 20px;
    text-align: center;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.category-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 17px;
    font-weight: bold;
    margin: 8px 0;
    color: #333;
}

.category-desc {
    color: #777;
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
}

.category-meta {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.category-consultants {
    color: #666;
    font-size: 14px;
    font-weight: bold;
}

.category-link {
    display: inline-block;
    background: #4CAF50;
    color: #fff;
    padding: 8px 18px;
    border-radius: 25px;
    border: none;
    font-size: 13px;
    margin-top: 10px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}

.category-link:hover {
    background: #388E3C;
    color: #fff;
}

/* ========================================
   مشاوران (حالت شبکه‌ای)
   ======================================== */
.consultants-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.consultant-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.consultant-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.consultant-card.online {
    border-top: 3px solid #4CAF50;
}

.consultant-card.offline {
    border-top: 3px solid #ccc;
    opacity: 0.8;
}

.consultant-avatar {
    position: relative;
    height: 140px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.consultant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    font-size: 56px;
    color: #4CAF50;
}

.online-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.consultant-info {
    padding: 14px 16px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.consultant-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 3px;
}

.consultant-expertise {
    color: #888;
    font-size: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 34px;
    line-height: 1.5;
    margin: 0 0 8px;
}

.consultant-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.stat-item {
    font-size: 13px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 2px;
}

.stat-item small {
    font-size: 10px;
    color: #999;
}

.consultant-category {
    font-size: 12px;
    color: #666;
    margin: 6px 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.consultant-link {
    background: #2196F3;
    color: #fff;
    padding: 8px 18px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 13px;
    margin-top: auto;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.3s;
}

.consultant-link:hover {
    background: #1976D2;
    color: #fff;
}

/* ========================================
   صفحه‌بندی
   ======================================== */
.consultants-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 16px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 5px;
    transition: all 0.3s;
    min-width: 40px;
    text-align: center;
}

.page-link.active {
    background: #4CAF50;
    color: #fff;
    border-color: #4CAF50;
}

/* ========================================
   کانتینر نمایش مشاوران دسته‌بندی
   ======================================== */
#category-consultants-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 15px;
    border: 1px solid #e0e0e0;
    margin-top: 30px;
}

.category-consultants-title {
    text-align: right;
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.close-consultants-btn {
    display: block;
    margin: 15px auto 0;
    background: #f44336;
    color: #fff;
    border: none;
    padding: 8px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.close-consultants-btn:hover {
    background: #d32f2f;
}

/* ========================================
   پیام‌های وضعیت
   ======================================== */
.loading-consultants {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 16px;
}

.error-msg {
    text-align: center;
    padding: 20px;
    color: #f44336;
    font-size: 16px;
}

.no-items {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 16px;
}

/* ========================================
   نشانگر اسکرول
   ======================================== */
.carousel-scroll-indicator {
    text-align: center;
    margin-top: 8px;
    color: #aaa;
    font-size: 12px;
    direction: rtl;
    padding: 5px 0;
}

/* ========================================
   پاسخگو (Responsive)
   ======================================== */

/* تبلت */
@media (max-width: 992px) {
    .categories-carousel .carousel-item,
    .consultants-carousel .carousel-item {
        width: calc(50% - 20px);
        min-width: 220px;
    }
    .consultants-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .adviser-categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .categories-carousel,
    .consultants-carousel {
        direction: ltr !important;
    }
}

/* موبایل */
@media (max-width: 600px) {
    .categories-carousel .carousel-item,
    .consultants-carousel .carousel-item {
        width: calc(80% - 10px);
        min-width: 200px;
    }
    .consultants-grid {
        grid-template-columns: 1fr;
    }
    .adviser-categories-grid {
        grid-template-columns: 1fr;
    }
    .adviser-section-title {
        font-size: 20px;
    }
    .consultant-card {
        min-height: 280px;
    }
    .category-item {
        min-height: 200px;
    }
    .categories-carousel,
    .consultants-carousel {
        direction: ltr !important;
    }
}

/* موبایل کوچک */
@media (max-width: 480px) {
    .categories-carousel .carousel-item,
    .consultants-carousel .carousel-item {
        width: calc(85% - 10px);
        min-width: 180px;
        padding: 0 8px;
    }
    .consultant-card {
        min-height: 260px;
    }
    .category-item {
        min-height: 190px;
        padding: 20px 15px;
    }
    .category-icon {
        font-size: 40px;
    }
    .consultant-stats {
        gap: 15px;
        flex-wrap: wrap;
    }
    .stat-item {
        font-size: 12px;
    }
    .categories-carousel,
    .consultants-carousel {
        direction: ltr !important;
    }
}