/* --- SGR Theme Compatibility Styles --- */

.sgr-recommendation-wrapper {
    clear: both;
    width: 100%;
}

.sgr-fomo-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444; 
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ct-media-container {
    position: relative;
}

/* ==========================================
   FBT (Frequently Bought Together) Styles
========================================== */

.sgr-fbt-container {
    margin: 30px 0;
    padding: 20px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.sgr-fbt-container h3 {
    margin-top: 0;
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--theme-headings-color, #1e293b);
}

.sgr-fbt-images {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.sgr-fbt-images a {
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    transition: opacity 0.3s;
}

.sgr-fbt-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sgr-fbt-plus {
    font-size: 24px;
    color: #94a3b8;
    font-weight: bold;
}

.sgr-fbt-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 20px 0 !important;
}

.sgr-fbt-list li {
    margin-bottom: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.sgr-fbt-list label {
    display: flex;
    align-items: center;
    cursor: pointer;
    width: 100%;
}

.sgr-fbt-main-item {
    font-weight: 600;
}

.sgr-fbt-checkbox {
    margin-right: 12px !important;
    width: 18px;
    height: 18px;
    accent-color: var(--theme-palette-color-1, #4f46e5);
}

.sgr-fbt-item-title {
    flex-grow: 1;
}

.sgr-fbt-item-price {
    color: #ef4444;
    font-weight: 700;
    margin-left: 10px;
}

.sgr-fbt-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

.sgr-fbt-total-price {
    font-size: 1.1em;
    color: #64748b;
}

.sgr-fbt-total-price strong {
    color: #16a34a;
    font-size: 1.3em;
    margin-left: 5px;
}

.sgr-fbt-btn {
    padding: 10px 20px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
}

/* ==========================================
   CART UPSELL (Checkout / Cart Banner) Styles
========================================== */

.sgr-upsell-box {
    background: #fff;
    border: 2px dashed var(--theme-palette-color-1, #4f46e5);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.03);
}

.sgr-upsell-title {
    margin-top: 0;
    font-size: 1.2em;
    font-weight: 800;
    color: var(--theme-headings-color, #1e293b);
    margin-bottom: 20px;
}

.sgr-upsell-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sgr-upsell-item {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    transition: transform 0.2s;
}

.sgr-upsell-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.sgr-upsell-img {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    margin-right: 15px;
}

.sgr-upsell-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sgr-upsell-info {
    flex-grow: 1;
}

.sgr-upsell-info h4 {
    margin: 0 0 5px 0 !important;
    font-size: 15px;
    font-weight: 600;
}

.sgr-upsell-info .price {
    font-weight: bold;
    color: #ef4444;
}

.sgr-upsell-action .sgr-add-upsell-btn {
    padding: 6px 15px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    margin: 0 !important;
}

/* موبایل رسپانسیو */
@media (max-width: 600px) {
    .sgr-fbt-total-box {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    .sgr-fbt-total-price {
        text-align: center;
    }
    .sgr-fbt-btn {
        width: 100%;
    }
    .sgr-upsell-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .sgr-upsell-img {
        margin-right: 0;
    }
}

/* ==========================================
   Smart Graph - Floating Toast Notification
========================================== */
#sgr-sticky-bar {
    position: fixed;
    bottom: -150px;
    left: 20px;
    right: 20px;
    max-width: 380px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    z-index: 99999;
    padding: 10px 14px; /* پدینگ استاندارد */
    box-sizing: border-box;
    border: 1px solid #e2e8f0;
    opacity: 0;
    pointer-events: none;
    transition: bottom 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.5s ease-in-out;
}

#sgr-sticky-bar.sgr-visible {
    bottom: 20px;
    opacity: 1;
    pointer-events: auto;
}

.sgr-sticky-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sgr-sticky-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    min-width: 0; /* حیاتی برای جلوگیری از له شدن متن */
}

.sgr-sticky-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    flex-shrink: 0; /* عکس هرگز کوچکتر نشود */
}

.sgr-sticky-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* حیاتی برای سه نقطه شدن متن */
    flex-grow: 1;
}

.sgr-sticky-fomo {
    font-size: 11px;
    color: #059669; /* رنگ سبز جذاب برای حس خرید */
    font-weight: 700;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sgr-sticky-text h4 {
    margin: 0 !important;
    font-size: 13px;
    color: #0f172a;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* اگر اسم محصول طولانی بود سه نقطه میشه */
}

.sgr-sticky-action {
    flex-shrink: 0; /* دکمه تحت هیچ شرایطی فشرده نشود */
}

.sgr-sticky-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
    white-space: nowrap; /* متن دکمه نشکند */
}

.sgr-pulse-anim {
    animation: sgrPulse 2s infinite;
}

@keyframes sgrPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@media screen and (max-width: 768px) {
    #sgr-sticky-bar { left: 15px; right: 15px; bottom: -150px; }
    #sgr-sticky-bar.sgr-visible { bottom: 15px; }
    .sgr-sticky-btn { padding: 6px 12px; font-size: 12px; }
}