﻿/* ================================================================
   CART — Variables
   ================================================================ */
:root {
    --cart-dark:  #2d375b;
    --cart-red:   #f0424f;
    --cart-red2:  #d93a46;
    --cart-grey:  #f4f5f7;
    --cart-white: #ffffff;
    --cart-panel-w: 390px;
}

/* ================================================================
   Mini-tab (right edge)
   ================================================================ */
.cart-mini {
    position: fixed;
    top: 250px;
    right: 10px;
    transform: translateY(-50%);
    z-index: 10;
    cursor: pointer;
    transition: right 0.3s linear, transform 0.3s linear;
    user-select: none;
    flex-direction: column;
    align-items: center;
    display: none;                /* shown by JS when cart not empty */
}
/* counter badge is hidden while the cart is empty */
.cart-mini.visible { display: flex; }
.cart-mini:hover { transform: translateY(-50%) translateX(-3px); }

.cart-mini:hover .cart-arrow {
    background: var(--dark-grey) url(/img/arrow.svg) no-repeat 15px 20px;
    background-size: 30px;
}

.cart-mini-arrow { display: block; }

.cart-mini-count {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    cursor: pointer;
    border: none;
    border-radius: 0 0 0 20px;
    font-size: 25px;
    font-weight: 600;
    color: var(--dark-blue3);
    background: var(--grey3);
}

/* ================================================================
   Sliding panel
   ================================================================ */
.cart-panel {
    position: fixed;
    z-index: 901;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, .25);
    transition: transform .3s ease;
    right: 0;
    top: 150px;
    width: 100%;
    max-width: 430px;
    max-height: calc(100vh - 290px);
    background: var(--grey3);
    border-radius: 20px 0 0 20px;
    transform: translateX(100%);
}
.cart-panel.open { transform: translateX(-10px); }

/* Overlay behind the sliding panel */
.cart-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
    pointer-events: none;
}
.cart-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cart-panel-header {
    flex-shrink: 0;
    background: var(--cart-dark);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 16px 0 0 0;
}
.cart-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    color: #fff;
}
.cart-panel-title {
    font-size: 17px;
    font-weight: 500;
}

/* Items list */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--cart-dark) var(--cart-grey);
}
.cart-items::-webkit-scrollbar { width: 6px; }
.cart-items::-webkit-scrollbar-track { background: var(--cart-grey); }
.cart-items::-webkit-scrollbar-thumb { background: var(--cart-dark); border-radius: 3px; }

.cart-item {
    background: var(--cart-white);
    border-radius: 10px;
    padding: 13px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.cart-item-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--cart-dark);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.cart-item-remove:hover { color: var(--cart-red); }

.cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cart-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--cart-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-meta {
    font-size: 12px;
    color: #7c7c7c;
}
.cart-item-qty-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.cart-qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: var(--cart-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-qty-btn:hover { background: var(--cart-dark); color: #fff; border-color: var(--cart-dark); }
.cart-qty-input {
    width: 38px;
    height: 24px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}
.cart-item-price {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 14px;
    color: var(--cart-dark);
    white-space: nowrap;
}

/* Footer */
.cart-footer {
    flex-shrink: 0;
    background: var(--cart-white);
    border-top: 1px solid #e0e0e0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
        border-radius: 0 0 0 16px;
}
.cart-order-btn {
    width: 100%;
    background: var(--cart-red);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}
.cart-order-btn:hover { background: var(--cart-red2); }
.cart-total {
    font-size: 16px;
    color: var(--cart-dark);
    text-align: right;
}
.cart-total strong { font-size: 18px; }

/* ================================================================
   Order modal
   ================================================================ */
.cart-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.cart-modal.open { opacity: 1; visibility: visible; }

.cart-modal-box {
    position: relative;
    background: var(--cart-white);
    border-radius: 12px;
    padding: 36px 32px 28px;
    width: 500px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.cart-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    line-height: 1;
}
.cart-modal-close:hover { color: var(--cart-red); }
.cart-modal-title {
    margin: 0 0 24px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--cart-dark);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

/* Order details inside modal */
.cart-order-details {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}
.cart-order-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}
.cart-order-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.cart-order-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--cart-dark);
    flex: 1;
}
.cart-order-item-meta {
    font-size: 12px;
    color: #7c7c7c;
    white-space: nowrap;
}
.cart-order-total {
    text-align: right;
    font-size: 16px;
    color: var(--cart-dark);
}
.cart-order-total strong {
    font-size: 18px;
}

#cart-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
#cart-form input,
#cart-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    border: 1px solid #c8ccd4;
    border-radius: 7px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
}
#cart-form input:focus,
#cart-form textarea:focus {
    outline: none;
    border-color: var(--cart-dark);
}
.cart-form-row {
    display: flex;
    gap: 14px;
}
.cart-form-row input { flex: 1; }
@media(max-width: 480px) { .cart-form-row { flex-direction: column; } }
#cart-form textarea { height: 90px; resize: vertical; }
.cart-submit-btn {
    width: 100%;
    background: var(--cart-dark);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    transition: background .2s;
}
.cart-submit-btn:hover { background: #1a2548; }

/* Success message inside modal */
.cart-success {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}
.cart-success-text {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--cart-dark);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

/* ================================================================
   Add-to-cart inline widget  (replaces the button after click)
   ================================================================ */
.cart-add-widget {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cart-add-widget .cart-qty-btn {
    width: 50px;
    height: 50px;
    font-size: 18px;
    background: #fff;
}
.cart-add-widget .cart-qty-input {
    width: 44px;
    height: 30px;
    font-size: 15px;
}
.cart-add-confirm {
    background: var(--cart-dark);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
}
.cart-add-confirm:hover { background: #1a2548; }

/* ================================================================
   Cart item with image
   ================================================================ */
.cart-item {
    background: var(--cart-white);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    align-items: start;
}

/* image cell */
.cart-item-img {
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;

    width: auto;
    height: 100%;
    max-height: 80px; 
    aspect-ratio: 1 / 1;
}
.cart-item-img img {
    object-fit: contain;
    display: block;

    width: auto;
    height: 100%;
    aspect-ratio: 1 / 1;
}

/* info cell */
.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    position: relative;
}
.cart-item-remove {
    background: none;
    border: none;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    margin-left: auto;
    display: block;
    position: absolute;
    top: 0;
    right: 0;
}
.cart-item-remove:hover { color: var(--cart-red); }

/* when no image — span full width */
.cart-item:not(:has(.cart-item-img)) {
    grid-template-columns: 1fr;
}

/* ================================================================
   Inline qty widget in card (updated — no confirm button)
   ================================================================ */
.cart-add-widget {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.cart-add-widget .cart-qty-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #fff;
    color: var(--cart-dark);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background .15s;
}
.cart-add-widget .cart-qty-btn:hover {
    background: var(--cart-dark);
    color: #fff;
    border-color: var(--cart-dark);
}
.cart-add-widget .cart-qty-input {
    width: 44px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 7px;
    font-size: 15px;
    font-family: inherit;
}


.cart-arrow {
    width: 60px;
    height: 60px;
    cursor: pointer;
    border: none;
    transition: right 0.3s linear;
    z-index: 10;
    background: var(--dark-blue3) url(/img/arrow.svg) no-repeat 15px 20px;
    background-size: 30px;
    transform: rotate(90deg);
    border-radius: 0 0 0 20px;
    transition-delay: 0s;
}

@media screen and (max-width: 768px) {
    .cart-panel {
        top: 170px;
        height: calc(100vh - 270px);
        max-height: calc(100vh - 270px);
        max-width: 95vw;
    }
}