/* -------------------- */
/* 0. Wrapper & Toggle Base */
/* -------------------- */
.goldika-mc__wrapper {
    position: relative;
    height: max-content;
    display: flex;
    align-items: center;
    z-index: 9999;
}

.goldika-mc__toggle_wrapper {
    position: relative;
}

.goldika-mc__toggle_button {
    display: flex;
    align-items: center;
    text-decoration: none;
    cursor: pointer;
    padding: 0; /* matches Elementor button */
    border-radius: 6px;
    color: #ccc;
    transition: background-color 0.2s, color 0.2s;
}

.goldika-mc__toggle_button:hover {
    background-color: #333;
    color: #ffa000;
}

/* Icon & Quantity Bubble */
.goldika-mc__toggle_icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.goldika-mc__toggle_icon svg {
    width: 32px;  /* Elementor size */
    height: 32px;
}

.goldika-mc__toggle_icon svg path {
    stroke: #ffa000;
    fill: #ffa000;
}

.goldika-mc__toggle_qty {
    position: absolute;
    top: -5px;
    left: -5px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #ef4444;
    color: #1c1c1c;
    font-size: 10px;
    font-weight: bold;
    line-height: 1;
    padding-top: 1px;
    box-shadow: 0 0 5px #e0321f50;
    z-index: 10;
}
.goldika-mc__toggle_qty[data-counter="0"] {
    display: none;
}

/* -------------------- */
/* 1. Mini Cart Container */
/* -------------------- */
.goldika-mc__container {
    position: absolute;
    top: 100%;
	left:0;
    width: 320px;
    max-width: 90vw;
    background-color: #0E1014; /* Elementor main background */
    border-radius: 16px;        /* match Elementor style */
    box-shadow: 0 0 5px #0E101440; /* mimic drop-shadow */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 9999;
    margin-top: 10px;
    font-family: "Tahoma", sans-serif;
    border: unset; /* Elementor cart has no border */
}

.goldika-mc__container.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* -------------------- */
/* 2. Header & Close Button */
/* -------------------- */
.goldika-mc__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
	direction:rtl;
    position: relative;
    color: white;
    font-weight: bold;	
    font-size: 1.4em;
	flex-direction: row-reverse;
}

.goldika-mc__header::before {
    content: "سبد خرید";
    position: absolute;
    right: 16px;
}

.goldika-mc__close-button {
    cursor: pointer;
    margin: 16px;  /* Elementor style */
    width: 22px;
    height: 22px;
    position: relative;
}

.goldika-mc__close-button::before,
.goldika-mc__close-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 16px;
    background-color: white;
    transform-origin: center;
}

.goldika-mc__close-button::before { transform: translate(-50%, -50%) rotate(45deg); }
.goldika-mc__close-button::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* -------------------- */
/* 3. Content Area / WooCommerce Products */
/* -------------------- */
.goldika-mc__content_area {
    max-height: max-content;
    overflow-y: auto;
    color: white;
}

.goldika-mc__content_area .widget_shopping_cart_content {
    background: #32343d; /* Elementor cart content bg */
    border-top: 1px solid #e6dbd3;
    border-radius: 0 0 16px 16px;
    padding: 16px;
    margin: 0;
}

/* * **START OF GRID-BASED CART ITEM STYLES**
*/

/* --- Wrapper for a single cart item (The main grid) --- */
.elementor-menu-cart__product.cart_item {
    display: grid;
	direction: ltr;
    grid-template-columns: 1fr 60px; 
    grid-template-rows: auto auto; 
    grid-template-areas: 
        "name image"
        "price image";
    gap: 5px 15px; /* 5px row gap, 15px column gap */
    padding: 10px 0;
    margin-bottom: 5px; 
    border-bottom: 1px solid gray;
    position: relative;
    align-items: start;
	justify-items: end;
}

.elementor-menu-cart__product.cart_item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}


/* --- Product Name (Top Left Row) --- */
.elementor-menu-cart__product-name {
    /* Place this item in the "name" area (Row 1, Column 1) */
    grid-area: name;
    /* Ensure the inline style is overridden */
    display: block !important;
}

.elementor-menu-cart__product-name .ast-product-name {
    font-weight: bold;
}
.goldika-mc__content_area .product-name a {
    color: #FAAF00;
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    word-break: break-word; 
    white-space: normal;
}
.goldika-mc__content_area .product-name a:hover {
    color: #FFD470;
}

/* --- Price & Quantity (Bottom Left Row) --- */
.elementor-menu-cart__product-price {
    /* Place this item in the "price" area (Row 2, Column 1) */
    grid-area: price;
    /* Use Flexbox internally to lay out quantity and price horizontally */
    display: flex !important;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 14px;
	width: 100%;
}

.elementor-menu-cart__product-price .quantity {
    /* Space between quantity selector and the price amount */
    margin-right: 10px;
}


/* --- Product Image (The Right Column - Spans 2 Rows) --- */
.elementor-menu-cart__product-image {
    /* Place this item in the "image" area */
    grid-area: image;
    /* Span both rows */
    grid-row: span 2; 
    
    /* Use Flexbox for centering the image inside its cell */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px; /* Redundant due to grid-template-columns, but safe */
    height: 60px;
}

.elementor-menu-cart__product-image img {
    /* Ensure the image fits within its container */
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: none;
    /* Retain original styling for appearance */
    aspect-ratio: 1;
    padding: 6px;
    border-radius: 8px !important;
    border: 1px solid #ffc107 !important;
    background: #373943;
    background: linear-gradient(225deg, rgba(55, 57, 67, 1) -50%, rgba(14, 16, 20, 1) 150%);
    filter: drop-shadow(0px 5px 2px rgba(0, 0, 0, 0.2));
}

/* --- Removal Button --- */
.elementor-menu-cart__product-remove {
    /* Absolute position within the .cart_item grid container */
    position: absolute;
    top: 5px;
    left: 5px;
    z-index: 10;
    display: block !important;
    width: 20px !important;
}

/* Re-applying custom quantity styles to ensure compatibility */
.goldika-mc__content_area .quantity.buttons_added {
    background: #0E1014;
    color: white !important;
    border-radius: 8px;
    padding: 4px;
    height: 30px !important;
    display: flex;
    align-items: center;
    direction: rtl;
}

.goldika-mc__content_area .quantity a {
    margin: 0;
    padding: 4px;
    width: fit-content !important;
    color: #FAAF00 !important;
    background: #32343d !important;
}

.goldika-mc__content_area .quantity .plus {
    border-right: 1px solid;
    border-radius: 4px;
}

.goldika-mc__content_area .quantity .minus {
    border-left: 1px solid;
    border-radius: 4px;
}
.woocommerce-js .quantity .minus, .woocommerce-js .quantity .plus{
   aspect-ratio: 1; height: 100%;
}
.goldika-mc__content_area .quantity .input-text.qty.text {
    padding: 0 5px !important;
    margin: 0 !important;
    width: 25px !important;
    background: unset !important;
    border: unset;
    color: white;
    min-height: 0 !important;
    text-align: center;
}

/* * **END OF GRID-BASED CART ITEM STYLES**
*/


/* -------------------- */
/* 4. Subtotal / Footer Buttons */
/* -------------------- */
.goldika-mc__content_area .elementor-menu-cart__subtotal {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: white;
    padding-bottom:1em;
    padding-top:1.5em;
    border-top:1px solid #ccc;
}

.goldika-mc__content_area .elementor-menu-cart__footer-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: space-between;
}

.goldika-mc__content_area .elementor-menu-cart__footer-buttons a {
    border-radius: 8px !important;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    text-decoration: none;
}

.goldika-mc__content_area .elementor-menu-cart__footer-buttons a:first-child{
    flex:1;
    border: 1px solid #FAAF00 !important;
    background: #FAAF00 !important;
    color: #32343d !important;
}
.goldika-mc__content_area .elementor-menu-cart__footer-buttons a:first-child span{
   font-weight:800 !important;
}
.goldika-mc__content_area .elementor-menu-cart__footer-buttons a:not(:first-child){
    border: 1px solid #FAAF00 !important;
    background: #32343d !important;
    color: #FAAF00 !important;
}

/* -------------------- */
/* 5. Empty Message */
.goldika-mc__content_area .woocommerce-mini-cart__empty-message {
    text-align: center !important;
}

/* -------------------- */
/* 6. Mobile Adjustments */
@media (max-width: 767px) {
    .goldika-mc__container {
        width: 100vw !important;
        position: absolute !important;
        left: -42px !important;
        transform: translateY(0);
    }
}


/* 1. Hide the default minus sign/text and show Trash Icon when value is 1 */
/* This targets BOTH the modern :has() selector and our JS fallback class */
.goldika-mc__content_area .quantity:has(input.qty[value="1"]) .minus,
.goldika-mc__content_area .quantity.is-at-one .minus {
    font-size: 0 !important; 
    background-image: var(--goldika-trash-icon) !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px !important;
    transition: background-color 0.2s ease;
}

/* 2. Ensure the icon stays visible and shows a red tint on hover */
.goldika-mc__content_area .quantity:has(input.qty[value="1"]) .minus:hover,
.goldika-mc__content_area .quantity.is-at-one .minus:hover {
    background-color: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
}

/* 3. Helper to ensure the minus button doesn't show text overflow */
.goldika-mc__content_area .quantity.is-at-one .minus::before {
    display: none !important;
}

/* 1. Target the Elementor loading class on the product row */
.elementor-menu-cart__product.ajax-mini-cart-qty-loading {
    position: relative !important;
    pointer-events: none; /* Prevent double clicks while loading */
}

/* 2. Create the Overlay and Golden Spinner using Pseudo-elements */
.goldika-mc__content_area .ajax-mini-cart-qty-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(14, 16, 20, 0.7) !important; /* Matches your theme dark overlay */
    z-index: 10;
    border-radius: 8px;
}

.goldika-mc__content_area .ajax-mini-cart-qty-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px; /* Centers the spinner */
    border: 3px solid rgba(209, 181, 124, 0.2); /* Faint gold track */
    border-top-color: #d1b57c; /* Your solid gold color */
    border-radius: 50%;
    animation: goldika-spin 0.8s linear infinite;
    z-index: 11;
}

/* 3. The Animation (make sure it's defined once) */
@keyframes goldika-spin {
    to { transform: rotate(360deg); }
}