/* =========================================================
   PlasPoint Premium Side Cart Drawer (psc-)
   Shopify / Minimog style — namespaced, conflict-free
   ======================================================= */

:root {
    --psc-pink: #FC5A8D;
    --psc-pink-dark: #e94b7e;
    --psc-pink-light: #FFF0F5;
    --psc-dark: #111111;
    --psc-text: #333333;
    --psc-muted: #8a8a8a;
    --psc-border: #f0f0f0;
    --psc-radius: 12px;
    --psc-ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ---------- Overlay ---------- */
.psc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.psc-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Drawer ---------- */
.psc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 92vw;
    height: 100%;
    height: 100dvh;
    background: #ffffff;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    transform: translateX(105%);
    transition: transform 0.45s var(--psc-ease);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.18);
    border-radius: 20px 0 0 20px;
    font-family: 'Anek Bangla', 'Poppins', -apple-system, sans-serif;
    box-sizing: border-box;
    overflow: hidden;
    will-change: transform;
}
.psc-drawer.is-open {
    transform: translateX(0);
}
.psc-drawer *,
.psc-drawer *::before,
.psc-drawer *::after {
    box-sizing: border-box;
}

/* ---------- Header ---------- */
.psc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--psc-border);
    background: #fff;
    flex-shrink: 0;
}
.psc-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--psc-dark);
    line-height: 1;
}
.psc-header h3 svg {
    width: 22px;
    height: 22px;
    color: var(--psc-pink);
}
.psc-close {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f6f6;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: var(--psc-dark);
    cursor: pointer;
    transition: all 0.25s ease;
}
.psc-close:hover {
    background: var(--psc-pink);
    color: #fff;
    transform: rotate(90deg);
}

/* ---------- Urgency strip ---------- */
.psc-urgency {
    padding: 10px 24px;
    background: linear-gradient(90deg, #fff7ed, #fffaf0);
    border-bottom: 1px solid #fde8cd;
    font-size: 13.5px;
    font-weight: 600;
    color: #c2530a;
    flex-shrink: 0;
}
.psc-urgency span {
    font-weight: 800;
    color: #d00000;
    font-variant-numeric: tabular-nums;
}

/* ---------- Body ---------- */
.psc-body {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.psc-body-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ---------- Free shipping progress ---------- */
.psc-shipbar {
    padding: 14px 24px 16px;
    background: var(--psc-pink-light);
    border-bottom: 1px solid #ffe1ec;
    flex-shrink: 0;
}
.psc-shipbar-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--psc-text);
    margin-bottom: 9px;
    line-height: 1.45;
}
.psc-shipbar-text strong { color: var(--psc-pink-dark); }
.psc-shipbar-text .amount,
.psc-shipbar-text .woocommerce-Price-amount { color: var(--psc-pink-dark); font-weight: 800; }
.psc-shipbar-track {
    height: 8px;
    background: #ffd9e6;
    border-radius: 99px;
    overflow: hidden;
}
.psc-shipbar-track span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--psc-pink), #ff8fb3);
    border-radius: 99px;
    transition: width 0.6s var(--psc-ease);
}
.psc-shipbar-done { background: #f0fdf4; border-bottom-color: #dcfce7; }
.psc-shipbar-done .psc-shipbar-text strong { color: #16a34a; }
.psc-shipbar-done .psc-shipbar-track { background: #dcfce7; }
.psc-shipbar-done .psc-shipbar-track span { background: linear-gradient(90deg, #22c55e, #4ade80); }

/* ---------- Items ---------- */
.psc-items {
    list-style: none;
    margin: 0;
    padding: 6px 24px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #e5e5e5 transparent;
}
.psc-items::-webkit-scrollbar { width: 5px; }
.psc-items::-webkit-scrollbar-thumb { background: #e5e5e5; border-radius: 99px; }

.psc-item {
    display: flex;
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--psc-border);
    animation: pscItemIn 0.35s ease both;
}
.psc-item:last-child { border-bottom: none; }

@keyframes pscItemIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.psc-item-thumb {
    flex-shrink: 0;
    width: 80px;
}
.psc-item-thumb img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover;
    border-radius: var(--psc-radius);
    border: 1px solid #ececec;
    display: block;
    margin: 0;
    background: #fafafa;
}

.psc-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.psc-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}
.psc-item-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--psc-dark);
    line-height: 1.4;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
a.psc-item-name:hover { color: var(--psc-pink); }

.psc-remove {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #b9b9b9;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}
.psc-remove svg { width: 16px; height: 16px; }
.psc-remove:hover { background: #fef2f2; color: #ef4444; }

.psc-item-meta {
    font-size: 12.5px;
    color: var(--psc-muted);
    margin-top: 3px;
    line-height: 1.5;
}
.psc-item-meta dl,
.psc-item-meta .variation {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    margin: 0;
    padding: 0;
    border: none;
}
.psc-item-meta dt,
.psc-item-meta dd {
    display: inline;
    margin: 0;
    padding: 0;
    font-weight: 500;
    float: none;
}
.psc-item-meta dd p { display: inline; margin: 0; }

.psc-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
}

/* Qty stepper */
.psc-qty {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    height: 34px;
    overflow: hidden;
    background: #fff;
    transition: border-color 0.2s;
}
.psc-qty:hover { border-color: var(--psc-pink); }
.psc-qty-btn {
    width: 30px;
    height: 100%;
    background: transparent;
    border: none;
    font-size: 17px;
    font-weight: 600;
    color: var(--psc-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}
.psc-qty-btn:hover { background: var(--psc-pink-light); color: var(--psc-pink); }
.psc-qty-btn:active { transform: scale(0.9); }
.psc-qty-val {
    width: 34px;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--psc-dark);
    background: transparent;
    padding: 0;
    margin: 0;
    pointer-events: none;
    font-family: 'Poppins', sans-serif;
    -moz-appearance: textfield;
    appearance: textfield;
}

.psc-item-price {
    font-size: 16px;
    font-weight: 800;
    color: var(--psc-pink);
    white-space: nowrap;
    font-family: 'Poppins', 'Anek Bangla', sans-serif;
}
.psc-item-price del { color: #bbb; font-weight: 500; font-size: 13px; margin-right: 5px; }
.psc-item-price ins { text-decoration: none; }

/* ---------- Footer / Totals ---------- */
.psc-footer {
    flex-shrink: 0;
    padding: 16px 24px 22px;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    background: #fdfdfd;
    border-top: 1px solid var(--psc-border);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.04);
}
.psc-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    padding: 3px 0;
}
.psc-total-grand {
    font-size: 17px;
    font-weight: 800;
    color: var(--psc-dark);
    padding-top: 7px;
    margin-top: 5px;
    border-top: 1px dashed #e5e5e5;
}
.psc-total-grand .psc-amount {
    font-size: 22px;
    color: var(--psc-dark);
    font-family: 'Poppins', 'Anek Bangla', sans-serif;
}
.psc-amount .amount { color: inherit; }
.psc-note {
    margin: 6px 0 14px;
    font-size: 12.5px;
    color: var(--psc-muted);
    text-align: center;
}

/* Buttons */
.psc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 15px 18px;
    border-radius: 12px;
    font-size: 16.5px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: 'Anek Bangla', sans-serif;
    transition: all 0.25s ease;
    line-height: 1.2;
    box-sizing: border-box;
}
.psc-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.psc-btn-primary {
    background: linear-gradient(135deg, var(--psc-pink), var(--psc-pink-dark));
    color: #fff !important;
    box-shadow: 0 8px 20px rgba(252, 90, 141, 0.35);
}
.psc-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(252, 90, 141, 0.45);
    color: #fff !important;
}
.psc-btn-primary:active { transform: translateY(0); }
.psc-btn-outline {
    background: #fff;
    color: var(--psc-dark) !important;
    border: 1.5px solid #e2e2e2;
    margin-top: 10px;
    padding: 13px 18px;
    font-size: 15.5px;
}
.psc-btn-outline:hover { border-color: var(--psc-dark); background: var(--psc-dark); color: #fff !important; }

/* ---------- Empty cart ---------- */
.psc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 34px;
}
.psc-empty svg { width: 110px; height: 110px; margin-bottom: 22px; }
.psc-empty h4 {
    margin: 0 0 8px;
    font-size: 21px;
    font-weight: 800;
    color: var(--psc-dark);
}
.psc-empty p {
    margin: 0 0 24px;
    font-size: 14.5px;
    color: var(--psc-muted);
    line-height: 1.65;
}
.psc-empty .psc-btn { max-width: 240px; }

/* ---------- Loading spinner ---------- */
.psc-loader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.psc-loader.is-active { opacity: 1; visibility: visible; }
.psc-spinner {
    width: 42px;
    height: 42px;
    border: 3.5px solid #ffd9e6;
    border-top-color: var(--psc-pink);
    border-radius: 50%;
    animation: pscSpin 0.7s linear infinite;
}
@keyframes pscSpin { to { transform: rotate(360deg); } }

/* Add-to-cart button loading state (single product) */
.psc-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}
.psc-btn-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(252, 90, 141, 0.3);
    border-top-color: var(--psc-pink);
    border-radius: 50%;
    animation: pscSpin 0.7s linear infinite;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}

/* ---------- Toast ---------- */
.psc-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--psc-dark);
    color: #fff;
    padding: 13px 24px;
    border-radius: 99px;
    font-size: 14.5px;
    font-weight: 600;
    font-family: 'Anek Bangla', sans-serif;
    z-index: 1000001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s var(--psc-ease);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    text-align: center;
}
.psc-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.psc-toast.psc-toast-error { background: #dc2626; }

/* Body lock while drawer open */
body.psc-locked { overflow: hidden !important; }

/* ---------- Cart count bump animation ---------- */
.cart-count.psc-bump { animation: pscBump 0.45s var(--psc-ease); }
@keyframes pscBump {
    0% { transform: scale(1); }
    40% { transform: scale(1.45); }
    100% { transform: scale(1); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .psc-drawer {
        width: 100%;
        max-width: 100vw;
        border-radius: 0;
    }
    .psc-header { padding: 15px 18px; }
    .psc-header h3 { font-size: 18px; }
    .psc-urgency { padding: 9px 18px; font-size: 12.5px; }
    .psc-shipbar { padding: 12px 18px 14px; }
    .psc-items { padding: 4px 18px; }
    .psc-item { padding: 15px 0; gap: 12px; }
    .psc-item-thumb, .psc-item-thumb img { width: 72px !important; }
    .psc-item-thumb img { height: 72px !important; }
    .psc-item-name { font-size: 14px; }
    .psc-footer { padding: 14px 18px 18px; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
    .psc-btn { padding: 14px 16px; font-size: 15.5px; }
    .psc-total-grand .psc-amount { font-size: 20px; }
}
