/* ============================================================
   Moshina Category Browser Widget Styles
   ============================================================ */

.moshina-cat-browser {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    font-family: inherit;
    direction: rtl;
}

/* ------------------------------------------------------------
   1. Left/Right Vertical Sidebar (Main Categories)
   ------------------------------------------------------------ */
.moshina-cat-sidebar {
    width: 85px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.moshina-cat-sidebar-item {
    background: #ffffff;
    border: 1px solid #eef0f3;
    border-radius: 12px;
    padding: 10px 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    position: relative;
}

.moshina-cat-sidebar-item:hover {
    border-color: var(--moshina-cat-accent, #361601);
    transform: translateY(-1px);
}

.moshina-cat-sidebar-item.active {
    border: 2px solid var(--moshina-cat-accent, #361601);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(132, 184, 57, 0.18);
}

.moshina-cat-sidebar-icon {
    width: 38px;
    height: 38px;
    object-fit: contain;
    margin: 0 auto 4px;
    display: block;
}

.moshina-cat-sidebar-name {
    font-size: 11px;
    font-weight: 700;
    color: #444444;
    display: block;
    line-height: 1.2;
    word-break: break-word;
}

.moshina-cat-sidebar-item.active .moshina-cat-sidebar-name {
    color: var(--moshina-cat-accent, #361601);
}

/* Sidebar Copy Link Button — appears on hover */
.moshina-sidebar-copy-link {
    position: absolute;
    top: -7px;
    left: -7px;
    width: 22px;
    height: 22px;
    background: var(--moshina-cat-accent, #5a8a1a);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.moshina-cat-sidebar-item:hover .moshina-sidebar-copy-link {
    opacity: 1;
    transform: scale(1);
}

.moshina-sidebar-copy-link:hover {
    background: #3d6e10;
    transform: scale(1.15) !important;
}

.moshina-sidebar-copy-link.copied {
    background: #22c55e;
}


/* ------------------------------------------------------------
   2. Main Content Area
   ------------------------------------------------------------ */
.moshina-cat-main-content {
    flex-grow: 1;
    min-width: 0;
    position: relative;
}

/* Category Header Banner */
.moshina-cat-header-banner {
    background: linear-gradient(135deg, var(--moshina-cat-accent, #361601) 0%, #6f9c2d 100%);
    border-radius: 14px;
    padding: 14px 18px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(132, 184, 57, 0.2);
}

.moshina-banner-info h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.moshina-banner-info p {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.moshina-banner-img {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Copy Category Link Button */
.moshina-copy-cat-link-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.moshina-copy-cat-link-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    transform: translateY(-1px);
}

.moshina-copy-cat-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: moshinaToastFadeIn 0.3s ease;
}

@keyframes moshinaToastFadeIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Subcategories Grid View */
.moshina-subcat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

@media (min-width: 768px) {
    .moshina-subcat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

.moshina-subcat-card {
    background: #f7f8fa;
    border: 1px solid #eef0f3;
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.moshina-subcat-card:hover {
    background: #ffffff;
    border-color: var(--moshina-cat-accent, #361601);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.moshina-subcat-card.active-all {
    border: 2px solid var(--moshina-cat-accent, #361601);
    background: #f4f9eb;
}

.moshina-subcat-icon {
    width: 46px;
    height: 46px;
    object-fit: contain;
    margin-bottom: 8px;
}

.moshina-subcat-icon-all {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--moshina-cat-accent, #361601);
    border-radius: 8px;
    margin-bottom: 8px;
    color: var(--moshina-cat-accent, #361601);
}

.moshina-subcat-name {
    font-size: 13px;
    font-weight: 700;
    color: #333333;
}

/* Horizontal Subcategory Pills (Filtered State) */
.moshina-subcat-pills-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
    scrollbar-width: none;
    /* Firefox */
}

.moshina-subcat-pills-bar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.moshina-subcat-pill {
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #f4f5f7;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #444444;
    cursor: pointer;
    transition: all 0.2s ease;
}

.moshina-subcat-pill:hover {
    border-color: var(--moshina-cat-accent, #361601);
    color: var(--moshina-cat-accent, #361601);
}

.moshina-subcat-pill.active {
    border: 1.5px dashed var(--moshina-cat-accent, #361601);
    background: #f3f9eb;
    color: var(--moshina-cat-accent, #361601);
}

.moshina-subcat-pill-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Product Count Bar */
.moshina-products-count-bar {
    font-size: 13px;
    font-weight: 700;
    color: #666666;
    margin-bottom: 10px;
    text-align: left;
    /* Left in RTL = left side */
}

/* Product Grid */
.moshina-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 992px) {
    .moshina-product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

.moshina-product-card {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.moshina-product-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    border-color: #ddd;
    text-decoration: none;
    color: inherit;
}

.moshina-product-thumb-wrap {
    position: relative;
    width: 100%;
    padding-top: 85%;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 8px;
}

.moshina-product-thumb-wrap img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.moshina-product-title {
    font-size: 12px;
    font-weight: 700;
    color: #222222;
    margin: 4px 0 6px;
    line-height: 1.3;
    min-height: 32px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.moshina-product-title:hover {
    color: var(--moshina-cat-accent, #361601);
}

.moshina-product-price {
    font-size: 13px;
    font-weight: 800;
    color: #111111;
    margin-bottom: 8px;
}

.moshina-add-to-cart-btn {
    width: 100%;
    padding: 8px 0;
    background: var(--moshina-cat-accent, #361601);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
}

.moshina-add-to-cart-btn:hover {
    background: #73a42f;
    color: #ffffff;
}

.moshina-add-to-cart-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Loading overlay animation */
.moshina-cat-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.moshina-cat-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.moshina-cat-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--moshina-cat-accent, #361601);
    border-radius: 50%;
    animation: moshinaSpin 0.7s linear infinite;
}

@keyframes moshinaSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ------------------------------------------------------------
   3. Pagination Navigation Buttons
   ------------------------------------------------------------ */
.moshina-cat-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eef0f3;
    flex-wrap: wrap;
}

.moshina-cat-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    font-family: inherit;
}

.moshina-cat-page-btn:hover {
    border-color: var(--moshina-cat-accent, #361601);
    color: var(--moshina-cat-accent, #361601);
    background: #f8fafc;
}

.moshina-cat-page-btn.active {
    background: var(--moshina-cat-accent, #361601);
    color: #ffffff;
    border-color: var(--moshina-cat-accent, #361601);
    box-shadow: 0 2px 8px rgba(54, 22, 1, 0.2);
}

/* Mobile-specific visibility and formatting overrides for pagination */
@media (max-width: 767px) {
    .moshina-cat-pagination {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-top: 20px !important;
        margin-bottom: 25px !important;
        padding-top: 12px !important;
        border-top: 1px solid #eef0f3 !important;
        justify-content: center !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        width: 100% !important;
        clear: both !important;
    }

    .moshina-cat-page-btn {
        display: inline-flex !important;
        visibility: visible !important;
        min-width: 40px !important; /* Slightly larger for easier mobile tapping */
        height: 40px !important;
        font-size: 14px !important;
        border-radius: 8px !important;
        margin: 2px !important;
    }
}

/* ------------------------------------------------------------
   4. Scroll Sentinel & Infinite Load Indicator
   ------------------------------------------------------------ */
.moshina-scroll-sentinel {
    width: 100%;
    padding: 16px 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.moshina-scroll-loader {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.moshina-cat-spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: var(--moshina-cat-accent, #361601);
    border-radius: 50%;
    animation: moshinaSpin 0.6s linear infinite;
}

.moshina-card-fadein {
    animation: moshinaCardFadeIn 0.35s ease-out forwards;
}

@keyframes moshinaCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}