:root {
    --bs-body-bg: #fff;
}

body {
    background-color: #f8f9fa;
    min-height: 100vh;
}

html {
    scroll-behavior: smooth;
}

.sticky-top {
    border-top: 1px solid rgba(0, 0, 0, 0.03);
}

/* ====== عرض أفقي للمنتجات (Scrollable) ====== */
.product-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
    gap: 1.25rem;
    margin-top: 0.75rem;
    padding-bottom: 2.5rem; /* Large padding to guarantee no clipping by forced scrollbar */
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #adb5bd #f1f3f5;
}

/* تخصيص شريط التمرير للمنتجات */
.product-list::-webkit-scrollbar {
    -webkit-appearance: none;
    height: 6px;
    display: block !important;
}
.product-list::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 10px;
    margin: 0 10px;
}
.product-list::-webkit-scrollbar-thumb {
    background-color: #adb5bd;
    border-radius: 10px;
}
.product-list::-webkit-scrollbar-thumb:hover {
    background-color: #6c757d;
}

/* بطاقات المنتجات داخل العرض الأفقي */
.product-list > div {
    flex: 0 0 calc(100% - 1rem); /* جوال */
    scroll-snap-align: start;
    margin-bottom: 1rem; /* More margin to lift card up from bottom bound */
}

@media (min-width: 768px) {
    .product-list > div {
        flex: 0 0 calc(50% - 0.75rem); /* تابلت */
    }
}

@media (min-width: 992px) {
    .product-list > div {
        flex: 0 0 calc(50% - 0.75rem); /* شاشات متوسطة مع الشريط الجانبي */
    }
}

@media (min-width: 1250px) {
    .product-list > div {
        flex: 0 0 calc(33.333% - 1rem); /* 3 منتجات */
    }
}

@media (min-width: 1600px) {
    .product-list > div {
        flex: 0 0 calc(25% - 1.125rem); /* شاشات عريضة جداً: 4 منتجات */
    }
}

/* بطاقة المنتج */
.product-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 0.85rem 1rem; /* Balanced */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.25s ease;
    border: 1px solid #e9ecef;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
    border-color: #0d6efd;
}

/* رأس البطاقة */
.product-card-header h5 {
    color: #2b3445;
}

.product-card-header p {
    color: #6c757d;
}

/* قائمة المواصفات */
.product-specs {
    margin: 0.35rem 0;
}

.product-specs .spec-item {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.65rem; /* Reduced to fit 6 items */
    margin-bottom: 0.25rem; 
    background-color: #f8f9fa;
    border-radius: 8px;
    font-size: 0.82rem; /* Balanced text */
    transition: background 0.2s ease;
}

.product-specs .spec-item:last-child {
    margin-bottom: 0;
}

.spec-item:hover {
    background: #e9ecef;
}

.spec-item i {
    font-size: 1rem;
    width: 24px;
    flex-shrink: 0;
}

.spec-label {
    color: #6c757d;
    font-size: 0.82rem;
    margin: 0 0.35rem;
    flex: 1;
}

.spec-value {
    color: #212529;
    font-weight: 600;
    font-size: 0.82rem;
    text-align: left;
}

/* قسم السعر */
.product-card-footer {
    background: #f8f9fa;
    margin: 0 -1.1rem -1rem;
    padding: 0.85rem 1.1rem;
    border-radius: 0 0 14px 14px;
}

.price-section {
    margin-bottom: 0.5rem;
}

.price-old {
    color: #6c757d;
    text-decoration: line-through;
    font-size: 0.875rem;
}

.price-main {
    margin: 0.5rem 0;
}

.price-main .h4 {
    font-size: 2rem;
    color: #0d6efd;
}

.price-main small {
    color: #6c757d;
    font-size: 0.875rem;
}

.price-trial {
    margin-top: 0.75rem;
}

.price-trial .badge {
    font-size: 0.875rem;
    font-weight: 500;
}

/* زر الطلب */
.product-card-footer .btn {
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.product-card-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.badge-ribbon {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
}

.qr-box img {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.spec-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eef4ff;
    color: #0d6efd;
}

/* ====== الشريط الجانبي (Sidebar Layout) ====== */
.site-container {
    display: flex;
    min-height: 100vh;
    background-color: #f8fafc;
}

.site-sidebar {
    width: 250px;
    min-width: 250px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 1020;
    border-inline-end: 1px solid #eef2f6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.site-sidebar::-webkit-scrollbar {
    display: none;
}

.offcanvas-sidebar {
    width: 270px !important;
}

.user-sidebar-card {
    background-color: #f4f6fc;
    border: 1px solid #e9edf7;
    transition: all 0.2s ease;
}

.user-sidebar-card:hover {
    border-color: #dbeafe;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-radius: 10px;
    color: #4b5563;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link:hover {
    background-color: #f8fafc;
    color: #0d6efd;
}

.sidebar-link.active {
    background-color: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.sidebar-link.active i {
    color: #4338ca !important;
}

.sidebar-link .active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #4338ca;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(67, 56, 202, 0.2);
    margin-inline-start: auto;
}

.sidebar-logout {
    color: #ef4444 !important;
    font-weight: 500;
}

.sidebar-logout:hover {
    background-color: #fef2f2 !important;
    color: #dc2626 !important;
}

.site-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
}

.site-header {
    background: #ffffff;
    border-bottom: 1px solid #eef2f6;
    z-index: 1010;
}

.max-content-width {
    max-width: 1400px;
    margin: 0 auto;
}

/* زر ومربع الدردشة المباشرة */
#chat-toggle-btn {
    position: fixed;
    width: 56px;
    height: 56px;
    z-index: 1050;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

#chat-toggle-btn:hover {
    transform: scale(1.06);
}

#chat-widget {
    position: fixed;
    z-index: 1060;
    height: 620px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background-color: #f0f2f5;
    overflow: hidden;
}

/* في الحواسيب: زر الدردشة بجانب كلمة تسجيل الخروج تماماً */
@media (min-width: 992px) {
    [dir="rtl"] #chat-toggle-btn {
        right: 170px !important;
        left: auto !important;
        bottom: 20px !important;
    }
    [dir="rtl"] #chat-widget {
        right: 260px !important;
        left: auto !important;
        bottom: 20px !important;
        width: 360px !important;
    }
    [dir="ltr"] #chat-toggle-btn {
        left: 170px !important;
        right: auto !important;
        bottom: 20px !important;
    }
    [dir="ltr"] #chat-widget {
        left: 260px !important;
        right: auto !important;
        bottom: 20px !important;
        width: 360px !important;
    }
}

/* في الجوال */
@media (max-width: 991.98px) {
    [dir="rtl"] #chat-toggle-btn {
        left: 20px !important;
        right: auto !important;
        bottom: 20px !important;
    }
    [dir="ltr"] #chat-toggle-btn {
        right: 20px !important;
        left: auto !important;
        bottom: 20px !important;
    }
    #chat-widget {
        right: 15px !important;
        left: 15px !important;
        bottom: 15px !important;
        width: auto !important;
        max-width: none !important;
    }
}