/* ===== Cart popup modal — restored to the original compact/polished style. ===== */

.ps-cart-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    font-family: var(--ps-font, 'Inter', sans-serif);
}
.ps-cart-modal[hidden] { display: none; }
.ps-cart-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .5);
    cursor: pointer;
}
.ps-cart-modal-dialog {
    position: relative;
    background: #fff;
    border-radius: 8px;
    max-width: 1100px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
    z-index: 1;
    overflow: hidden;
}

/* Head */
.ps-cart-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 22px 12px;
    border-bottom: 1px solid #eef0f3;
}
.ps-cart-modal-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #1a1a1a;
}
.ps-cart-modal-sub {
    font-size: 12px;
    color: #6b7785;
    margin-top: 2px;
}
.ps-cart-modal-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: #6b7785;
    padding: 4px;
}
.ps-cart-modal-close:hover { color: #1a1a1a; }

/* Banner */
.ps-cart-modal-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f7fc;
    padding: 8px 22px;
    font-size: 12px;
    color: #1a1a1a;
}
.ps-cart-modal-banner-text { flex: 1; }
.ps-cart-modal-banner-text a { color: #0d91d3; text-decoration: none; }
.ps-cart-modal-banner-text a:hover { text-decoration: underline; }
.ps-cart-modal-banner-close {
    background: transparent;
    border: 0;
    font-size: 18px;
    color: #6b7785;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* Items table — compact */
.ps-cart-modal-table { padding: 8px 20px 10px; }
.ps-cart-modal-thead,
.ps-cart-modal-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 75px 100px 80px 28px;
    gap: 10px;
    align-items: center;
}
.ps-cart-modal-thead {
    padding: 6px 0;
    border-bottom: 1px solid #eef0f3;
    font-size: 10px;
    color: #6b7785;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.ps-cart-modal-row {
    padding: 7px 0;
    border-bottom: 1px solid #f5f7fa;
}
.ps-cart-modal-row:last-child { border-bottom: 0; }
.ps-cart-modal-row-img {
    width: 40px;
    height: 40px;
    background: #f5f7fa;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ps-cart-modal-row-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.ps-cart-modal-row-name {
    font-size: 12px;
    color: #0d91d3;
    text-decoration: none;
    font-weight: 500;
    line-height: 1.25;
    display: block;
}
.ps-cart-modal-row-name:hover { text-decoration: underline; }
.ps-cart-modal-row-code {
    font-size: 10px;
    color: #6b7785;
    margin-top: 2px;
}
.ps-cart-modal-row-price,
.ps-cart-modal-row-total {
    font-size: 12px;
    color: #1a1a1a;
}
.ps-cart-modal-row-total { font-weight: 500; }

/* Quantity selector — filled blue buttons like the original */
.ps-cart-qty {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid #d1d8e0;
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
}
.ps-cart-qty button {
    width: 26px;
    height: 26px;
    border: 0;
    background: #0d91d3;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ps-cart-qty button:hover { background: #0a7eb8; }
.ps-cart-qty input {
    width: 36px;
    height: 26px;
    border: 0;
    text-align: center;
    font-size: 12px;
    padding: 0;
    -moz-appearance: textfield;
}
.ps-cart-qty input::-webkit-outer-spin-button,
.ps-cart-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ps-cart-qty input:focus { outline: none; }

/* Remove X — inline SVG (currentColor works only for real SVG in DOM,
   data: URLs ignore currentColor and rendered washed out / broken-looking). */
.ps-cart-modal-remove {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .12s ease, color .12s ease;
}
.ps-cart-modal-remove svg {
    width: 16px;
    height: 16px;
    display: block;
    stroke: currentColor;
}
.ps-cart-modal-remove:hover { background: #fef2f2; color: #dc2626; }

/* Totals */
.ps-cart-modal-totals {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eef0f3;
    text-align: right;
    font-size: 13px;
}
.ps-cart-modal-totals-row {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    padding: 2px 0;
    color: #4a5562;
}
.ps-cart-modal-totals-row strong {
    min-width: 110px;
    text-align: left;
    font-weight: 500;
}
.ps-cart-modal-totals-row span { min-width: 90px; text-align: right; }
.ps-cart-modal-totals-row.ps-total {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a1a;
    margin-top: 4px;
}

/* Actions — 3 uniformly-styled blue buttons, with icons */
.ps-cart-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 0 22px 16px;
}
.ps-cart-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .03em;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: background .12s ease;
    color: #fff !important; /* enforce white on all states + nested SVG */
}
.ps-cart-modal-btn:hover,
.ps-cart-modal-btn:focus,
.ps-cart-modal-btn:active,
.ps-cart-modal-btn:visited { color: #fff !important; text-decoration: none; }
/* Line/outline icons: stroke white, fill MUST stay none — forcing fill turns
   the path shapes into solid white blobs (which is what was rendering before). */
.ps-cart-modal-btn svg {
    width: 18px;
    height: 18px;
    stroke: #fff !important;
    fill: none !important;
    stroke-width: 1.8;
    flex: 0 0 18px;
}
.ps-cmb-secondary { background: #0d91d3; }
.ps-cmb-secondary:hover { background: #0a7eb8; }
.ps-cmb-primary { background: #0e1f3d; }
.ps-cmb-primary:hover { background: #1a3567; }

/* Related products — slider of compact upsell cards (5 visible / 10 total). */
.ps-cart-modal-related {
    padding: 10px 22px 14px;
    background: #f8fafc;
    border-top: 1px solid #eef0f3;
    position: relative;
}
.ps-cart-modal-related-title {
    font-size: 12px;
    color: #4a5562;
    font-weight: 500;
    margin: 0 0 8px;
}
.ps-cart-modal-related-slider {
    position: relative;
}
.ps-cart-modal-related-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding: 2px 0;
}
.ps-cart-modal-related-grid::-webkit-scrollbar { display: none; }
.ps-cart-modal-related-grid .ps-related-card {
    flex: 0 0 calc((100% - 32px) / 5);
    scroll-snap-align: start;
}
.ps-related-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    color: #0d91d3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}
.ps-related-nav:hover { color: #0a7eb8; background: #f0f7fc; }
.ps-related-nav-prev { left: -10px; }
.ps-related-nav-next { right: -10px; }
.ps-related-nav:disabled { opacity: .3; cursor: default; }
.ps-related-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease;
}
.ps-related-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.06); }
.ps-related-img {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    overflow: hidden;
}
.ps-related-img img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Bottom row of the card: name+price on the LEFT, add-to-cart icon button on the RIGHT */
.ps-related-bottom {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 5px 6px 6px;
}
.ps-related-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ps-related-name {
    font-size: 10px;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ps-related-name:hover { color: #0d91d3; }
.ps-related-price {
    font-size: 11px;
    font-weight: 700;
    color: #c0392b;
    line-height: 1;
}
/* Add-to-cart on related cards = small blue square with ONLY the cart icon */
.ps-related-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    background: #0d91d3;
    color: #fff;
    border: 0;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    padding: 0;
    cursor: pointer;
    transition: background .12s ease;
    font-size: 0;
    line-height: 0;
    margin: 0;
}
.ps-related-add::before {
    content: '';
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M0.88 2.82c.1-.4.5-.65.9-.55l2.1.56c.81.21 1.44.83 1.7 1.64l.42 1.33L19.61 6.83c.67.05 1.27.37 1.7.91l-.01-.01c.42.53.61 1.2.53 1.88l-.24 2c-.24 1.96-1.82 3.53-3.77 3.72l-9.36.87c-.04.01-.08.02-.12.02l-1.03.1c-.43.04-.76.41-.76.85 0 .47.38.86.84.86l1.86-.01.1-.01h.1l7.45-.02c.06 0 .12 0 .18-.01 1.01 0 1.83.84 1.83 1.86 0 1.03-.82 1.86-1.83 1.86s-1.83-.83-1.83-1.86c0-.12.01-.23.03-.34l-4.14.01c.02.11.03.23.03.35 0 1.03-.82 1.86-1.83 1.86s-1.83-.83-1.83-1.86c0-.12.01-.23.03-.34h-.18l.01-.01c-1.29 0-2.32-1.07-2.32-2.37 0-1.23.91-2.25 2.12-2.36h.11L4.17 4.92c-.1-.31-.35-.55-.66-.63L1.41 3.73c-.39-.1-.63-.51-.53-.91z'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
}
.ps-related-add:hover { background: #0a7eb8; }
.ps-related-add:disabled { background: #9ca3af; cursor: not-allowed; }

@media (max-width: 768px) {
    .ps-cart-modal { padding: 0; }
    .ps-cart-modal-dialog { border-radius: 0; min-height: 100vh; }
    .ps-cart-modal-thead { display: none; }
    .ps-cart-modal-row { grid-template-columns: 64px 1fr 30px; row-gap: 6px; }
    .ps-cart-modal-row > *:nth-child(3),
    .ps-cart-modal-row > *:nth-child(4),
    .ps-cart-modal-row > *:nth-child(5) { grid-column: 2; }
    .ps-cart-modal-actions { grid-template-columns: 1fr; }
    .ps-cart-modal-related-grid { grid-template-columns: repeat(3, 1fr); }
}
