/* =========================
   Floating Cart
   ========================= */

.floating-cart {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
}

/* Floating button */

.floating-cart-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    background: #ffffff;
    color: #2d2d2d;
    border: 2px solid #2aa7a4;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
    transition:
            transform 0.2s ease,
            box-shadow 0.2s ease,
            background 0.2s ease;
}

.floating-cart-button:hover,
.floating-cart-button:focus {
    background: #f1fbfa;
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
}

/* Cart count */

.floating-cart-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    box-sizing: border-box;
    background: #d92d20;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

/* =========================
   Popup
   ========================= */

.floating-cart-popup {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 380px;
    max-height: 72vh;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #ddd8d0;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

.floating-cart-popup[hidden] {
    display: none;
}

/* Header */

.floating-cart-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e7e2da;
}

.floating-cart-popup-header h2 {
    margin: 0;
    color: #242424;
    font-size: 1.55rem;
    font-weight: 700;
}

.floating-cart-popup-header button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: #ffffff;
    color: #7a5730;
    border: 1px solid #c79a62;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
            background 0.2s ease,
            transform 0.2s ease;
}

.floating-cart-popup-header button:hover {
    background: #fff8ef;
    transform: rotate(3deg);
}

.floating-cart-popup form {
    margin: 0;
}

/* =========================
   Cart Items
   ========================= */

.floating-cart-items {
    display: flex;
    flex-direction: column;
}

.floating-cart-item {
    padding: 18px 0;
    border-bottom: 1px solid #e7e2da;
}

.floating-cart-item:first-child {
    padding-top: 18px;
}

.floating-cart-item:last-child {
    margin-bottom: 18px;
}

/* Product name */

.floating-cart-item > p:first-child {
    margin: 0 0 8px;
}

.floating-cart-item > p:first-child strong {
    color: #252525;
    font-size: 1.08rem;
    font-weight: 700;
}

/* Price */

.floating-cart-item > p:nth-of-type(2) {
    margin: 0 0 12px;
    color: #5f5a54;
}

/* =========================
   Quantity
   ========================= */

.floating-cart-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 12px;
}

.floating-cart-quantity button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #ffffff;
    color: #7a5730;
    border: 1px solid #c9975c;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition:
            background 0.2s ease,
            transform 0.2s ease;
}

.floating-cart-quantity button:hover {
    background: #fff7ec;
    transform: translateY(-1px);
}

.cart-quantity-value {
    min-width: 26px;
    color: #2d2d2d;
    font-weight: 700;
    text-align: center;
}

/* =========================
   Subtotal
   ========================= */

.floating-cart-item > p:nth-last-of-type(1) {
    margin: 8px 0 12px;
    color: #4a4742;
}

.floating-cart-item .cart-item-subtotal {
    color: #2c2c2c;
    font-weight: 700;
}

/* =========================
   Remove
   ========================= */

.floating-cart-remove {
    padding: 7px 13px;
    background: #ffffff;
    color: #8a5e27;
    border: 1px solid #c9975c;
    border-radius: 7px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition:
            background 0.2s ease,
            color 0.2s ease;
}

.floating-cart-remove:hover {
    background: #fff4e8;
    color: #6f481b;
}

/* =========================
   Total
   ========================= */

#floating-cart-update-form + p {
    margin: 0;
    padding: 16px;
    background: linear-gradient(
            135deg,
            #f8f3eb,
            #fffaf3
    );
    border: 1px solid #e2d4c1;
    border-radius: 10px 10px 0 0;
}

#floating-cart-update-form + p strong {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #292929;
    font-size: 1.12rem;
}

#floating-cart-total {
    color: #8a6738;
    font-size: 1.24rem;
    font-weight: 800;
}

/* =========================
   Checkout Button
   ========================= */

#floating-cart-update-form + p + p {
    margin: 0;
}

#floating-cart-update-form + p + p a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 18px;
    box-sizing: border-box;
    background: linear-gradient(
            135deg,
            #2a8581,
            #236f6c
    );
    color: #ffffff;
    border-radius: 0 0 10px 10px;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(42, 133, 129, 0.2);
    transition:
            transform 0.2s ease,
            box-shadow 0.2s ease,
            background 0.2s ease;
}

#floating-cart-update-form + p + p a::after {
    content: "→";
    font-size: 1.05rem;
}

#floating-cart-update-form + p + p a:hover {
    background: linear-gradient(
            135deg,
            #247873,
            #1d625f
    );
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(42, 133, 129, 0.26);
}

/* Empty cart */

.floating-cart-popup > p:only-child {
    margin: 18px 0 4px;
    color: #66615b;
    text-align: center;
}

/* =========================
   Mobile
   ========================= */

@media (max-width: 600px) {
    .floating-cart {
        right: 16px;
        bottom: 16px;
    }

    .floating-cart-popup {
        width: min(380px, calc(100vw - 32px));
        padding: 18px;
    }
}