/**
 * Resin Driveway UK — Header cart icon + slide-in mini-cart.
 *
 * Brand colours are exposed as CSS variables on .rduk-mini so they are easy
 * to retheme without touching the rest of the rules.
 *
 * @package RDW_Store_Suite
 * @since   1.5.0
 */

.rduk-mini {
    --rduk-navy: #1a2744;
    --rduk-gold: #ffca00;
    --rduk-orange: #e96e20;
    --rduk-ink: #1f2937;
    --rduk-muted: #6b7280;
    --rduk-line: #e5e7eb;
    --rduk-bg: #ffffff;
    box-sizing: border-box;
}
.rduk-mini *,
.rduk-mini *::before,
.rduk-mini *::after { box-sizing: border-box; }

/* ---- Header icon ---- */
.rduk-cart-icon-wrap {
    display: inline-flex;
    align-items: center;
}
.rduk-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    margin: 0;
    border: 0;
    background: transparent;
    color: inherit; /* inherits the header text colour */
    cursor: pointer;
    line-height: 1;
    transition: transform .15s ease, color .15s ease;
}
.rduk-cart-icon:hover { transform: translateY(-1px); color: var(--rduk-gold); }
.rduk-cart-icon__svg { display: block; }

.rduk-cart-count {
    position: absolute;
    top: -2px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--rduk-orange);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}
.rduk-cart-count--empty { display: none; }

/* ---- Overlay ---- */
.rduk-mini-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, .5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
    z-index: 99998;
}
.rduk-mini-overlay.open { opacity: 1; visibility: visible; }

/* ---- Drawer ---- */
.rduk-mini-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 380px;
    max-width: 90vw;
    background: var(--rduk-bg);
    box-shadow: -8px 0 28px rgba(0, 0, 0, .18);
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    display: flex;
    flex-direction: column;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--rduk-ink);
}
.rduk-mini-drawer.open { transform: translateX(0); }

.rduk-mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--rduk-navy);
    color: #fff;
    flex: 0 0 auto;
}
.rduk-mini-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
/* Close button — drawer-scoped selectors (two classes) so the reset beats any
   theme button styling; clean by default (no border/background), fully
   overridable from the widget's Drawer controls. */
.rduk-mini-drawer .rduk-mini-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    margin: 0;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border-radius: 8px;
    opacity: .85;
    transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
.rduk-mini-drawer .rduk-mini-close:hover { opacity: 1; color: var(--rduk-gold); background: transparent; }
/* Light, thin-stroke cancel/close icon (sized by the button's font-size). */
.rduk-mini-drawer .rduk-mini-x { width: 1em; height: 1em; display: block; }

/* ---- Body / items ---- */
.rduk-mini-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 0;
}
.rduk-mini-item {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    padding: 14px 20px;
    border-bottom: 1px solid var(--rduk-line);
}
.rduk-mini-item__thumb { flex: 0 0 auto; }
.rduk-mini-item__thumb img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    border: 1px solid var(--rduk-line);
}
.rduk-mini-item__info {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}
.rduk-mini-item__name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 6px;
    color: var(--rduk-ink);
}
.rduk-mini-item__name br + span { font-weight: 400; }
.rduk-mini-item__price {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--rduk-navy);
}
.rduk-mini-item__qty--fixed {
    font-size: 12px;
    color: var(--rduk-muted);
}

/* qty stepper (non-calculator items) — matches the product-page stepper:
   a grey pill with round buttons and a white number chip. Drawer-scoped so the
   look survives theme button styling. */
.rduk-mini-item__info .rduk-mini-qty { margin-top: 2px; }
.rduk-mini-drawer .rduk-mini-qty {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e8e9eb;
    border: 0;
    border-radius: 999px;
    padding: 4px;
    overflow: visible;
}
.rduk-mini-drawer .rduk-mini-qty__btn {
    border: 0;
    background: #d5d6d9;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    color: #555;
    padding: 0;
    box-shadow: none;
    transition: background .12s ease;
}
.rduk-mini-drawer .rduk-mini-qty__btn:hover { background: #c5c6c9; }
.rduk-mini-drawer .rduk-mini-qty__val {
    min-width: 34px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 999px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--rduk-navy);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
    padding: 0 8px;
}

/* Remove ("cancel") button — light thin-stroke icon at the right of the row. */
.rduk-mini-drawer .rduk-mini-item__remove {
    position: static;
    flex: 0 0 auto;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #9aa2ad;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    padding: 2px;
    margin: 0;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border-radius: 8px;
    transition: color .15s ease, background-color .15s ease;
}
.rduk-mini-drawer .rduk-mini-item__remove:hover { color: var(--rduk-orange); background: transparent; }

.rduk-mini-item.is-loading { opacity: .5; pointer-events: none; }

/* empty state */
.rduk-mini-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    color: var(--rduk-muted);
    text-align: center;
    padding: 40px 20px;
}
.rduk-mini-empty p { margin: 0; font-size: 15px; }
/* The chosen cart icon (or the fallback trolley) in the empty state. */
.rduk-mini-empty__icon { display: inline-flex; color: var(--rduk-muted); }
.rduk-mini-empty__icon svg { width: 44px; height: 44px; }
.rduk-mini-empty__icon i { font-size: 40px; line-height: 1; }
.rduk-mini-empty__icon img { width: 44px; height: 44px; object-fit: contain; }

/* "Clear basket" — a quiet, centred pill with a trash icon under the actions.
   Scoped to the drawer + !important so it beats the theme's button styling
   (which otherwise forces a pink 24px square-cornered button). */
.rduk-mini-drawer .rduk-mini-clear {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto !important;
    margin: 14px auto 0 !important;
    padding: 9px 18px !important;
    background: transparent !important;
    border: 1px solid var(--rduk-line) !important;
    border-radius: 999px !important;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    color: var(--rduk-muted) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.rduk-mini-drawer .rduk-mini-clear:hover {
    color: #c0392b !important;
    border-color: #e6b8b2 !important;
    background: rgba(192, 57, 43, .06) !important;
}
.rduk-mini-clear__icon { flex: 0 0 auto; width: 15px; height: 15px; }

/* ---- Footer ---- */
.rduk-mini-foot {
    flex: 0 0 auto;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--rduk-line);
    background: #fff;
}
.rduk-mini-foot--empty { display: none; }
.rduk-mini-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: var(--rduk-ink);
}
.rduk-mini-subtotal__val { color: var(--rduk-navy); }
.rduk-mini-note {
    margin: 4px 0 14px;
    font-size: 12px;
    color: var(--rduk-muted);
}
.rduk-mini-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.rduk-mini-btn {
    display: block;
    text-align: center;
    padding: 13px 16px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .03em;
    transition: filter .15s ease, background .15s ease, color .15s ease;
}
.rduk-mini-btn--primary {
    background: var(--rduk-orange);
    color: #fff;
}
.rduk-mini-btn--primary:hover { filter: brightness(.93); color: #fff; }
.rduk-mini-btn--ghost {
    background: #fff;
    color: var(--rduk-navy);
    border: 2px solid var(--rduk-navy);
}
.rduk-mini-btn--ghost:hover { background: var(--rduk-navy); color: #fff; }

/* ---- Mobile ---- */
@media (max-width: 480px) {
    .rduk-mini-drawer { width: 100%; max-width: 100%; }
}
