/* ===== SIDEBAR MENU STYLES ===== */
.custom-sidebar {
    background: #fff;
    padding: 0;
    max-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.custom-sidebar .offcanvas-header {
    padding: 20px 25px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.custom-sidebar .offcanvas-body {
    padding: 16px !important;
    overflow-y: auto;
    height: 100vh;
    overflow: scroll;
    flex-grow: 1;
    padding-right: 5px !important;
}

.sidebar-title {
    /* font-family: "Domaine Display", serif; -- Removed to match Cart sidebar */
    font-size: 1.15rem !important;
    color: #2c3e50;
    margin-bottom: 0;
    letter-spacing: 0.5px;
    font-weight: 600; /* Match typical h5 weight */
}

/* New Sidebar Menu Container */
.sidebar-menu-container {
    padding: 10px 0;
}

.sidebar-menu-item-wrapper {
    border-bottom: 1px solid #f8f9fa;
}

[dir="rtl"] .sidebar-menu-item-wrapper .bi-chevron-right {
    transform: scaleX(-1) !important;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 25px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    text-decoration: none;
    color: #2c3e50;
    font-family: var(--font-secondary); /* Use site secondary font */
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-menu-link:hover {
    background-color: #fcfcfc;
    color: var(--secondary-color); /* Premium Blue */
    padding-left: 30px; /* Slide effect */
}

/* Highlight Link (New Year) */
.sidebar-menu-link.highlight-link {
    background: #fffbf0; /* Light cream background */
    border-left: 4px solid #b21f1f; /* Red accent border */
}

.sidebar-menu-link.highlight-link span {
    color: #b21f1f;
    font-weight: 500;
}

/* Emoji handling - ensuring visibility */
.sidebar-menu-link .emoji {
    font-style: normal;
    margin-left: 5px;
}

/* Icons */
.arrow-icon,
.toggle-icon {
    font-size: 0.9rem;
    color: #adb5bd;
    transition: transform 0.3s ease;
}

.sidebar-menu-link:hover .arrow-icon {
    transform: translateX(5px);
    color: var(--secondary-color);
}

/* Accordion State */
.sidebar-menu-link[aria-expanded="true"] {
    background-color: #f8f9fa;
    color: var(--secondary-color);
}

.sidebar-menu-link[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
    color: var(--secondary-color);
}

/* Submenu */
.submenu-body {
    padding: 0;
    background-color: #fafafa;
}

.submenu-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.submenu-link {
    display: block;
    padding: 12px 25px 12px 40px; /* Indented */
    color: #6c757d;
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    position: relative;
}

.submenu-link:hover {
    color: #2c3e50;
    background-color: #f0f0f0;
    padding-left: 45px;
}

.submenu-link::before {
    content: "";
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 1px;
    background-color: #dee2e6;
    transition: width 0.2s;
}

.submenu-link:hover::before {
    width: 12px;
    background-color: #adb5bd;
}

/* Cart Sidebar Items (Preserved) */
.cart-items-list {
    overflow-y: auto;
    /* max-height removed - relying on flex parent */
    flex: 1;
    height: 100%; /* Ensure it fills parent */
    padding-right: 5px; /* Prevent scrollbar from overlapping content */
    padding: 0 25px; /* Restore padding for cart items */
}

/* Custom Scrollbar for Cart Items */
.cart-items-list::-webkit-scrollbar {
    width: 4px;
}

.cart-items-list::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items-list::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 10px;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    transition: background-color 0.2s;
}

.cart-item:hover {
    background-color: #fcfcfc;
}

.cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background-color: #f8f9fa;
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-title {
    font-family: var(--font-primary);
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 4px;
    padding-right: 25px; /* Space for delete button */
    text-decoration: none;
    line-height: 1.2;
}

.cart-item-variant {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 4px;
}

.cart-item-price {
    font-weight: 600;
    color: var(--primary-color); /* Gold/Yellow color from image */
    font-size: 0.95rem;
}

.cart-item-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 5px;
}

.cart-item-remove {
    position: absolute;
    top: 10px;
    right: 0;
    border: none;
    background: transparent;
    color: #ff9999;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.cart-item-remove:hover {
    color: #ff4d4d;
}

.cart-item-remove .ion-trash-a {
    font-size: 16px;
}

.cart-item-addons {
    font-size: 0.85rem;
    color: #6c757d;
}

.cart-item-addons small {
    display: block;
    line-height: 1.4;
}

.qty-control {
    display: flex;
    align-items: center;
    background: white !important;
    border-radius: 20px;
    padding: 2px 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.qty-btn {
    width: 30px;
    height: 30px;
    background: #fff2c6;
    border: #ffecac;
    font-size: 1.2rem;
    color: #333;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    padding: 0;
}

.qty-input {
    width: 38px;
    text-align: center !important;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    padding: 0;
}

/* Empty State */
.cart-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.cart-empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Cart Sidebar Specific */
.cart-sidebar {
    width: 400px !important;
    display: flex !important;
    flex-direction: column !important;
}

.cart-sidebar .offcanvas-body {
    padding: 25px; /* Keep padding for cart sidebar */
    overflow: hidden; /* Prevent body scroll, handle in list */
    flex: 1 1 auto; /* Grow to fill space */
    display: flex;
    flex-direction: column;
    min-height: 0; /* Crucial for nested flex scrolling */
}

.offcanvas-footer {
    padding: 20px 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    margin-top: 0; /* Flex parent handles positioning */
    flex-shrink: 0; /* Prevent footer from shrinking */
    z-index: 10;
}

.cart-summary {
    margin-bottom: 15px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tax-note {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
    margin-top: 10px;
}

.btn-checkout {
    font-weight: 600;
    padding: 12px;
    border-radius: 8px;
}

@media (max-width: 576px) {
    .cart-sidebar {
        width: 100% !important;
    }
}

/* Offcanvas Show State - Fixed Timing */
.offcanvas {
    position: fixed;
    bottom: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    visibility: hidden;
    background-color: #fff;
    background-clip: padding-box;
    outline: 0;
    transition:
        transform 0.3s ease-in-out,
        visibility 0s linear 0.3s !important;
}

.offcanvas.show {
    transition:
        transform 0.3s ease-in-out,
        visibility 0s linear 0s !important;
}

.offcanvas-start {
    top: 0;
    left: 0;
    width: 400px;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateX(-100%);
}

@media (max-width: 576px) {
    .offcanvas-start {
        width: 100% !important;
    }
}

.offcanvas-end {
    top: 0;
    right: 0;
    width: 400px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
}

.offcanvas.showing,
.offcanvas.show {
    transform: translateX(0) !important;
    visibility: visible !important;
}

.offcanvas.hiding {
    transform: translateX(100%) !important;
    visibility: visible !important;
}

.offcanvas-start.hiding {
    transform: translateX(-100%) !important;
}

/* Offcanvas Backdrop - Synchronized Timing */
.offcanvas-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    transition: opacity 0.3s ease-in-out !important;
}

.offcanvas-backdrop.fade {
    opacity: 0;
}

.offcanvas-backdrop.show {
    opacity: 0.5;
    transition: opacity 0.3s ease-in-out !important;
}

/* Offcanvas Header */
.offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.offcanvas-title {
    margin-bottom: 0;
    line-height: 1.5;
}

/* Close Button */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    background: transparent
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e")
        center/1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.75;
}

/* Body Fix Class */
body.fix {
    overflow: hidden;
}

/* =========================================
   RTL SUPPORT FOR SIDEBARS
   ========================================= */

/* OFF-CANVAS START (MENU) - Moves to RIGHT in RTL */
[dir="rtl"] .offcanvas-start {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateX(100%); /* Start hidden on Right */
}

/* OFF-CANVAS END (CART) - Moves to LEFT in RTL */
[dir="rtl"] .offcanvas-end {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
    transform: translateX(-100%); /* Start hidden on Left */
}

/* Fix Hiding Transitions in RTL */

/* Menu Hiding: Slide back to Right */
[dir="rtl"] .offcanvas-start.hiding {
    transform: translateX(100%) !important;
}

/* Cart Hiding: Slide back to Left */
/* Note: We target offcanvas-end explicitly or generic offcanvas if not start */
[dir="rtl"] .offcanvas-end.hiding,
[dir="rtl"] .offcanvas.hiding:not(.offcanvas-start) {
    transform: translateX(-100%) !important;
}

/* Fix Sidebar Link Hover Directions */
[dir="rtl"] .sidebar-menu-link {
    text-align: right;
}

[dir="rtl"] .sidebar-menu-link:hover {
    padding-left: 25px; /* Reset LTR padding */
    padding-right: 30px; /* RTL Slide effect */
}

[dir="rtl"] .sidebar-menu-link:hover .arrow-icon {
    transform: translateX(-5px); /* Flip arrow movement */
}

[dir="rtl"] .submenu-link {
    padding: 12px 40px 12px 25px; /* Flip padding */
    text-align: right;
}

[dir="rtl"] .submenu-link::before {
    left: auto;
    right: 25px;
}

[dir="rtl"] .submenu-link:hover {
    padding-left: 25px;
    padding-right: 45px;
}

/* Cart Item Item Details */
[dir="rtl"] .cart-item-title {
    padding-right: 0;
    padding-left: 25px; /* Space for delete button */
}

[dir="rtl"] .cart-item-remove {
    right: auto;
    left: 0;
}
