/* =================================== */
/* ===== Component: Mini Cart    ===== */
/* =================================== */

.dm-cart-button {
    position: relative;
    display: inline-block;
}

.dm-cart-button > .dm-cart-trigger {
    position: relative;
}

.dm-cart-trigger {
    border: none;
    background: none;
    margin: 0;
}

.dm-cart-trigger svg {
    width: 24px;
}

/* Badge for item count */
.dm-cart-count {
    position: absolute;
    top: -9px;
    inset-inline-end: -7px;
    width: 17px;
    height: 17px;
    padding: 0 6px;
    background-color: var(--dm-danger-color);
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    line-height: 20px;
    text-align: center;
    font-weight: 700;
}

/* The dropdown panel */
.dm-cart-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    border-radius: var(--dm-border-radius);
    width: min(340px, 75vw);
    z-index: 999;
    max-height: 80vh;
    background-color: #fff;
    box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);
    padding: 10px;
    display: none;
    z-index: 999;
    transition: opacity 0.3s ease, top 0.3s ease, visibility 0.3s ease;
}

.dm-cart-button.is-open .dm-cart-dropdown {
    display: block;
}

@media (max-width: 768px) {
    .dm-cart-dropdown {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        opacity: 0;
        visibility: hidden;
        display: block; /* Keep display block so animation works */
        transition: transform 0.4s ease, opacity 0.3s ease;
    }

    .dm-cart-button.is-open .dm-cart-dropdown {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .dm-cart-button.is-open ~ body::before {
        opacity: 1;
        pointer-events: all;
    }
}

/* Empty cart message */
.dm-mini-cart-empty {
    padding: 20px;
    text-align: center;
    color: var(--dm-muted-color);
}

/* Item list inside dropdown */
.dm-cart-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 40vh; /* Prevents long lists from stretching the page */
    overflow-y: auto;
}

.dm-cart-list > li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 25px 0;
    margin-left: 15px;
    border-bottom: 1px solid #ddd;
    font-size: 16px;
    color: #000;
    font-weight: 600;
}

.dm-cart-list > li:last-child {
    border-bottom: 0;
}

.dm-cart-dropdown .dm-cart-list li .muted {
    padding-top: 10px;
    color: #616161;
    font-size: 13px;
    font-weight: normal;
}

.dm-cart-dropdown .dm-cart-list li strong {
    text-decoration: none;
    color: #000;
    font-size: 20px;
    font-weight: 600;
}

.dm-cart-list .dm-remove-item {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 4px;
    cursor: pointer;
    border-radius: 50%;
    line-height: 0;
    color: var(--dm-muted-color);
    transition: all .2s ease;
}

.dm-cart-dropdown a:first-child {
    border-radius: 25px;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    display: block;
    margin: 20px 0 0;
    padding: 15px 10px;
    width: 100%;
    background-color: #588E80;
    color: white;
    border: none;
    transition: color 0.3s ease, background-color 0.3s ease;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.dm-cart-dropdown a:first-child:hover {
    background-color: #4e7f72;
    color: #fff !important;
}

.dm-cart-dropdown a:first-child:after {
    content: "";
    background: #5C6680;
    position: absolute;
    z-index: -1;
    left: -20%;
    right: -20%;
    top: 0;
    bottom: 0;
    transform: skewX(-45deg) scale(0, 1);
    transition: all 0.5s;
}

.dm-cart-dropdown a:first-child:hover:after {
    transform: skewX(-45deg) scale(1, 1);
    -webkit-transition: all 0.5s;
    transition: all 0.5s;
}


.dm-cart-dropdown a:last-child {
    border-radius: 25px;
    font-size: 14px;
    text-decoration: none;
    text-align: center;
    display: block;
    margin: 20px 0 0;
    padding: 15px 10px;
    width: 100%;
    border: 1px solid #588E80;
    background-color: white;
    color: #616161;
    transition: color 0.3s ease, background-color 0.3s ease;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.dm-cart-dropdown a:last-child:after {
    content: "";
    background: #588E80;
    position: absolute;
    z-index: -1;
    left: -20%;
    right: -20%;
    top: 0;
    bottom: 0;
    transform: skewX(-45deg) scale(0, 1);
    transition: all 0.5s;
}

.dm-cart-dropdown a:last-child:hover:after {
    transform: skewX(-45deg) scale(1, 1);
    -webkit-transition: all 0.5s;
    transition: all 0.5s;
}

.dm-cart-dropdown a:last-child:hover {
    background-color: #4e7f72;
    border-color: #4e7f72;
    color: #fff !important;
}

.dm-cart-list strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

/* Action buttons at the bottom */
.dm-cart-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 15px;
    border-top: 1px solid var(--dm-border-color);
}

.dm-cart-actions .dm-btn {
    flex: 1; /* Makes buttons take equal width */
}