/* ============================================
   Gallery.css - گالری اسکرول افقی
   نسخه نهایی - با فاصله مناسب از راست + دکمه‌های ناوبری بهبودیافته
   ============================================ */

/* ===== کانتینر اصلی گالری ===== */
.gallery-section {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: var(--gap-xl, 1.5rem) 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

/* ===== کانتینر اسکرول ===== */
.gallery-scroll-wrapper {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    /* ===== فاصله بیشتر از سمت راست ===== */
    padding: 12px 24px 20px 24px;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.gallery-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

/* ===== کارت ===== */
.gallery-card {
    flex: 0 0 200px;
    width: 200px;
    max-width: 200px;
    min-width: 200px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: #222;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    box-sizing: border-box;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(var(--card-shadow-rgb), 0.25);
}

/* ===== تصویر ===== */
.gallery-image-box {
    position: relative;
    width: 100%;
    height: 120px;
    background: #f0f0f0;
    overflow: hidden;
    flex-shrink: 0;
}

.gallery-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-card:hover .gallery-image-box img {
    transform: scale(1.05);
}

/* ===== برچسب ===== */
.gallery-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: var(--badge-color, #b91c1c);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 2;
    white-space: nowrap;
}

/* ===== نشانک ===== */
.gallery-bookmark {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.85rem;
    z-index: 2;
    transition: all 0.2s ease;
}

.gallery-bookmark:hover {
    background: #fff;
    color: var(--badge-color, #b91c1c);
}

/* ===== محتوا ===== */
.gallery-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    box-sizing: border-box;
    min-width: 0;
}

.gallery-title {
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.5;
    margin: 0;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: #777;
    margin-top: auto;
    padding-top: 6px;
    border-top: 1px dashed #eee;
    gap: 6px;
}

.gallery-instructor,
.gallery-duration {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-instructor {
    flex: 1 1 auto;
    min-width: 0;
}

.gallery-duration {
    flex: 0 0 auto;
}

/* ===== فوتر کارت ===== */
.gallery-footer {
    padding: 8px 10px;
    background: #fafafa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
}

.gallery-price {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--badge-color, #b91c1c);
    white-space: nowrap;
}

.gallery-cart-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--card-shadow-rgb), 0.1);
    color: var(--badge-color, #b91c1c);
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.gallery-card:hover .gallery-cart-btn {
    background: var(--badge-color, #b91c1c);
    color: #fff;
}

/* ===== دکمه‌های ناوبری ===== */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    font-size: 1.3rem;
    color: #555;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    /* ===== تضمین کلیک‌پذیری ===== */
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.gallery-nav-btn:hover {
    background: var(--primary-blue, #4A90E2);
    color: #fff;
    border-color: var(--primary-blue, #4A90E2);
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-nav-btn.prev { left: 6px; }
.gallery-nav-btn.next { right: 6px; }

/* ============================================
   واکنش‌گرایی
   ============================================ */

/* ===== موبایل کوچک (حداکثر 480px) ===== */
@media (max-width: 480px) {
    .gallery-card {
        flex: 0 0 160px;
        width: 160px;
        max-width: 160px;
        min-width: 160px;
    }
    .gallery-image-box {
        height: 100px;
    }
    .gallery-title {
        font-size: 0.75rem;
    }
    .gallery-meta {
        font-size: 0.65rem;
    }
    .gallery-price {
        font-size: 0.75rem;
    }
    .gallery-cart-btn {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    .gallery-nav-btn {
        display: none;
    }
    .gallery-scroll-wrapper {
        gap: 8px;
        padding: 10px 16px 15px 16px;
    }
}

/* ===== موبایل (481px تا 767px) ===== */
@media (min-width: 481px) and (max-width: 767px) {
    .gallery-card {
        flex: 0 0 180px;
        width: 180px;
        max-width: 180px;
        min-width: 180px;
    }
    .gallery-image-box {
        height: 110px;
    }
    .gallery-nav-btn {
        display: none;
    }
    .gallery-scroll-wrapper {
        padding: 12px 20px 18px 20px;
    }
}

/* ===== تبلت (768px تا 1023px) ===== */
@media (min-width: 768px) and (max-width: 1023px) {
    .gallery-card {
        flex: 0 0 200px;
        width: 200px;
        max-width: 200px;
        min-width: 200px;
    }
    .gallery-scroll-wrapper {
        padding: 12px 24px 20px 24px;
    }
}

/* ===== دسکتاپ (1024px به بالا) ===== */
@media (min-width: 1024px) {
    .gallery-card {
        flex: 0 0 220px;
        width: 220px;
        max-width: 220px;
        min-width: 220px;
    }
    .gallery-image-box {
        height: 130px;
    }
    .gallery-scroll-wrapper {
        padding: 12px 28px 20px 28px;
    }
    .gallery-nav-btn.prev { left: -8px; }
    .gallery-nav-btn.next { right: -8px; }
}

/* ===== دسکتاپ بزرگ (1200px به بالا) ===== */
@media (min-width: 1200px) {
    .gallery-card {
        flex: 0 0 230px;
        width: 230px;
        max-width: 230px;
        min-width: 230px;
    }
    .gallery-scroll-wrapper {
        padding: 12px 32px 20px 32px;
    }
}