/* ==========================================================================
   Parker Brand – Minicart Drawer
   BEM block: .minicart-drawer__*

   Colours reference the Parker design system:
     Navy    #1B2A3D   (header bg)
     Green   #5B8C2A   (checkout btn, qty confirm)
     Red     #D9534F   (remove btn)
     Grey    #F5F5F5   (footer bg)
   ========================================================================== */

/* ------------------------------------------------------------------
   Offcanvas overrides – minicart is always right-side, wider
   ------------------------------------------------------------------ */
#offcanvas.offcanvas-right {
    width: 380px;
    max-width: 100%;
}

/* Dark navy header when used as minicart */
#offcanvas.offcanvas-right .offcanvas-header {
    background: #1B2A3D;
    border-bottom: none;
    padding: 16px 20px;
}

#offcanvas.offcanvas-right .offcanvas-title {
    color: #FFFFFF;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#offcanvas.offcanvas-right .offcanvas-close {
    color: #FFFFFF;
    font-size: 28px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#offcanvas.offcanvas-right .offcanvas-close:hover {
    opacity: 1;
}

/* ------------------------------------------------------------------
   Wrapper – fills drawer, flex column for sticky footer
   ------------------------------------------------------------------ */
.minicart-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #FFFFFF;
}

/* Hide regular #header-cart content (always use offcanvas) */
#header-cart.skip-content {
    display: none !important;
}

/* ------------------------------------------------------------------
   Items container – scrollable
   ------------------------------------------------------------------ */
.minicart-drawer__items {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Thin scrollbar */
.minicart-drawer__items::-webkit-scrollbar {
    width: 5px;
}

.minicart-drawer__items::-webkit-scrollbar-thumb {
    background: #CCC;
    border-radius: 3px;
}

.minicart-drawer__items::-webkit-scrollbar-track {
    background: transparent;
}

/* ------------------------------------------------------------------
   Item list
   ------------------------------------------------------------------ */
.minicart-drawer__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------------
   Single item — horizontal: [thumb] [details] [actions]
   ------------------------------------------------------------------ */
.minicart-drawer__item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
    position: relative;
    transition: background-color 0.3s ease;
}

.minicart-drawer__item:last-child {
    border-bottom: none;
}

/* Just-added highlight animation */
@keyframes minicart-flash {
    0%   { background-color: #e8f5e9; }
    100% { background-color: transparent; }
}

.minicart-drawer__item--just-added {
    animation: minicart-flash 2.5s ease-out;
}

/* Loading/updating state */
.minicart-drawer__item--updating {
    opacity: 0.5;
    pointer-events: none;
}

/* ------------------------------------------------------------------
   Thumbnail
   ------------------------------------------------------------------ */
.minicart-drawer__item-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #F0F0F0;
}

.minicart-drawer__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.minicart-drawer__item-image a {
    display: block;
    line-height: 0;
}

/* ------------------------------------------------------------------
   Item info (right side)
   ------------------------------------------------------------------ */
.minicart-drawer__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Product name */
.minicart-drawer__item-name {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: #1B2A3D;
}

.minicart-drawer__item-name a {
    color: inherit;
    text-decoration: none;
}

.minicart-drawer__item-name a:hover {
    color: #5B8C2A;
}

/* Price line: "2 x £29.99" */
.minicart-drawer__item-price {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #5B8C2A;
}

.minicart-drawer__item-qty-label {
    color: #777777;
    font-weight: 500;
}

/* ------------------------------------------------------------------
   Qty controls: [-] [input] [+] [checkmark]
   Hidden by default — shown when .editing class is on the item
   ------------------------------------------------------------------ */
.minicart-drawer__qty {
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

/* Show qty controls when editing */
.minicart-drawer__item.editing .minicart-drawer__qty {
    display: flex;
}

.minicart-drawer__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    background: #FFFFFF;
    color: #333333;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, background-color 0.2s;
}

.minicart-drawer__qty-btn:hover {
    border-color: #5B8C2A;
    background: #f8faf5;
}

.minicart-drawer__qty-input {
    width: 40px !important;
    height: 32px !important;
    text-align: center;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    padding: 0 !important;
    -moz-appearance: textfield;
    appearance: textfield;
}

.minicart-drawer__qty-input::-webkit-inner-spin-button,
.minicart-drawer__qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.minicart-drawer__qty-input:focus {
    outline: none;
    border-color: #5B8C2A;
}

/* Green checkmark button — hidden until qty changes */
.minicart-drawer__qty-confirm {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #5B8C2A;
    border-radius: 6px;
    background: #5B8C2A;
    color: #FFFFFF;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s;
}

.minicart-drawer__qty-confirm:hover {
    background: #4A7322;
}

/* Show checkmark when qty has been modified */
.minicart-drawer__qty--dirty .minicart-drawer__qty-confirm {
    display: flex;
}

/* ------------------------------------------------------------------
   Edit / Remove action buttons — pink rounded squares
   ------------------------------------------------------------------ */
.minicart-drawer__item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: flex-start;
}

.minicart-drawer__action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #FEE2E2;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background-color 0.2s;
    color: #E31E24;
    text-decoration: none;
}

.minicart-drawer__action svg {
    width: 16px;
    height: 16px;
    color: #E31E24;
    stroke: #E31E24;
}

.minicart-drawer__action:hover {
    background: #FECACA;
}

/* ------------------------------------------------------------------
   Footer – sticky at bottom
   ------------------------------------------------------------------ */
.minicart-drawer__footer {
    border-top: 2px solid #E8E8E8;
    padding: 16px 20px;
    background: #F9F9F9;
    flex-shrink: 0;
}

/* Total row */
.minicart-drawer__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.minicart-drawer__total-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #222222;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.minicart-drawer__total-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #222222;
}

.minicart-drawer__total-note {
    font-size: 0.8rem;
    color: #777777;
    text-align: center;
    width: 100%;
}

/* Action buttons */
.minicart-drawer__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.minicart-drawer__btn {
    display: block;
    text-align: center;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    border: none;
}

/* Navy "View Cart Details" button */
.minicart-drawer__btn--cart {
    background: #1B2A3D;
    color: #FFFFFF;
}

.minicart-drawer__btn--cart:hover {
    background: #2C3E50;
    color: #FFFFFF;
}

/* Green "Checkout" button */
.minicart-drawer__btn--checkout {
    background: #5B8C2A;
    color: #FFFFFF;
}

.minicart-drawer__btn--checkout:hover {
    background: #4A7322;
    color: #FFFFFF;
}

/* ------------------------------------------------------------------
   Empty state
   ------------------------------------------------------------------ */
.minicart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    flex: 1;
}

.minicart-drawer__empty-icon {
    color: #CCCCCC;
    margin-bottom: 16px;
}

.minicart-drawer__empty-text {
    font-size: 0.95rem;
    color: #777777;
    margin: 0 0 24px;
}

.minicart-drawer__empty .minicart-drawer__btn {
    width: 100%;
    max-width: 220px;
}

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */

/* Tablet: ~85% width */
@media (max-width: 1024px) {
    #offcanvas.offcanvas-right {
        width: 350px;
    }
}

/* Mobile: full width, slide from bottom */
@media (max-width: 768px) {
    #offcanvas.offcanvas-right {
        width: 100%;
        height: 90vh;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    #offcanvas.offcanvas-right[open] {
        transform: translateY(0);
    }

    .minicart-drawer__item {
        padding: 12px 16px;
        gap: 12px;
    }

    .minicart-drawer__item-image {
        width: 56px;
        height: 56px;
    }

    .minicart-drawer__footer {
        padding: 14px 16px;
    }

    .minicart-drawer__btn {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
}
