/**
 * PG Side Cart — frontend styles.
 * Modern clean look matching the gold/cream/maroon theme:
 *   - Panel: gold/mustard background
 *   - Cards: cream background with subtle border
 *   - Accents (Checkout, title): deep maroon
 *   - Quantity stepper: black-bordered white boxes
 */

:root {
        --pgsc-accent: #8B1A1A;
        --pgsc-accent-text: #FAF3DC;
        --pgsc-badge-bg: #ef4444;
        --pgsc-badge-text: #ffffff;
        --pgsc-panel-bg: #C9A227;
        --pgsc-panel-text: #1A1A1A;
        --pgsc-overlay: rgba(0, 0, 0, 0.55);
        --pgsc-radius: 16px;
        --pgsc-width: 380px;
        /* Theme tokens */
        --pgsc-card-bg: #FAF6DC;
        --pgsc-card-border: #E8E4C4;
        --pgsc-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.3);
        --pgsc-ease: cubic-bezier(0.4, 0, 0.2, 1);
        --pgsc-duration: 320ms;
        --pgsc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

.pg-sc-root {
        position: fixed;
        inset: 0;
        z-index: 99999;
        pointer-events: none;
}

/* Lock body scroll while the cart is open */
body.pg-sc-body-open {
        overflow: hidden;
}

.pg-sc-root * {
        box-sizing: border-box;
}

/* ---------- Overlay ---------- */
.pg-sc-overlay {
        position: absolute;
        inset: 0;
        background: var(--pgsc-overlay);
        opacity: 0;
        transition: opacity var(--pgsc-duration) var(--pgsc-ease);
        pointer-events: none;
}

.pg-sc-root.is-open {
        pointer-events: auto;
}

.pg-sc-root.is-open .pg-sc-overlay {
        opacity: 1;
        pointer-events: auto;
}

/* ---------- Panel ---------- */
.pg-sc-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        width: var(--pgsc-width);
        max-width: 92vw;
        background: var(--pgsc-panel-bg);
        color: var(--pgsc-panel-text);
        box-shadow: var(--pgsc-shadow);
        display: flex;
        flex-direction: column;
        font-family: var(--pgsc-font);
        font-size: 14px;
        line-height: 1.5;
        transition: transform var(--pgsc-duration) var(--pgsc-ease);
        will-change: transform;
        overflow: hidden;
}

.pg-sc-root--right .pg-sc-panel {
        right: 0;
        border-radius: var(--pgsc-radius) 0 0 var(--pgsc-radius);
        transform: translateX(100%);
}

.pg-sc-root--left .pg-sc-panel {
        left: 0;
        border-radius: 0 var(--pgsc-radius) var(--pgsc-radius) 0;
        transform: translateX(-100%);
}

.pg-sc-root.is-open .pg-sc-panel {
        transform: translateX(0);
}

@media (max-width: 480px) {
        .pg-sc-panel {
                width: 100vw;
                max-width: 100vw;
                border-radius: 0 !important;
        }
}

/* ---------- Panel header ---------- */
.pg-sc-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 18px 14px;
        flex-shrink: 0;
}

.pg-sc-panel-title {
        margin: 0;
        font-size: 22px;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: var(--pgsc-accent);
}

.pg-sc-close {
        background: transparent;
        border: 0;
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--pgsc-accent);
        border-radius: 8px;
        transition: background 0.15s ease, transform 0.15s ease;
}

.pg-sc-close:hover {
        background: rgba(139, 26, 26, 0.12);
        transform: rotate(90deg);
}

/* ---------- Notices ---------- */
.pg-sc-notices {
        flex-shrink: 0;
        padding: 4px 12px 0;
}

.pg-sc-notice {
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 13px;
        margin-bottom: 8px;
        line-height: 1.4;
}

.pg-sc-notice-success {
        background: #ecfdf5;
        color: #065f46;
        border: 1px solid #a7f3d0;
}

.pg-sc-notice-error {
        background: #fef2f2;
        color: #991b1b;
        border: 1px solid #fecaca;
}

.pg-sc-notice-info {
        background: #fff7ed;
        color: #9a3412;
        border: 1px solid #fed7aa;
}

/* ---------- Free shipping bar ---------- */
.pg-sc-free-bar {
        padding: 8px 12px;
        flex-shrink: 0;
}

.pg-sc-free-bar-text {
        margin: 0 0 6px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--pgsc-panel-text);
}

.pg-sc-free-bar-track {
        height: 6px;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 999px;
        overflow: hidden;
}

.pg-sc-free-bar-fill {
        height: 100%;
        width: 0%;
        border-radius: 999px;
        background: var(--pgsc-accent);
        transition: width 0.5s var(--pgsc-ease);
}

/* ---------- Cart body ---------- */
.pg-sc-cart-body {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 4px 12px 8px;
}

.pg-sc-loading {
        padding: 40px 0;
        text-align: center;
        color: rgba(0, 0, 0, 0.45);
        font-size: 13px;
}

/* ---------- Empty state ---------- */
.pg-sc-empty {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 20px;
        text-align: center;
        color: rgba(0, 0, 0, 0.5);
}

.pg-sc-empty-icon {
        opacity: 0.35;
        margin-bottom: 16px;
}

.pg-sc-empty-text {
        margin: 0;
        font-size: 15px;
        max-width: 240px;
}

/* ---------- Cart items (card style) ---------- */
.pg-sc-items {
        padding: 4px 0;
        display: flex;
        flex-direction: column;
        gap: 12px;
}

.pg-sc-item {
        display: flex;
        gap: 12px;
        padding: 10px;
        background: var(--pgsc-card-bg);
        border: 1px solid var(--pgsc-card-border);
        border-radius: 8px;
        transition: opacity 0.2s ease;
}

.pg-sc-item-thumb {
        flex: 0 0 80px;
        width: 80px;
        height: 64px;
        border-radius: 6px;
        overflow: hidden;
        background: #fff;
}

.pg-sc-item-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
}

.pg-sc-item-info {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        min-width: 0;
}

.pg-sc-item-top {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 6px;
}

.pg-sc-item-name {
        font-size: 15px;
        font-weight: 500;
        line-height: 1.35;
        color: #1A1A1A;
        flex: 1 1 auto;
}

.pg-sc-item-name a {
        color: inherit;
        text-decoration: none;
}

.pg-sc-item-name a:hover {
        color: var(--pgsc-accent);
}

.pg-sc-item-remove {
        background: transparent;
        border: 0;
        padding: 2px;
        color: #000;
        cursor: pointer;
        border-radius: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        transition: color 0.15s ease;
}

.pg-sc-item-remove:hover {
        color: #dc2626;
}

.pg-sc-item-attr {
        font-size: 12px;
        color: rgba(0, 0, 0, 0.55);
        margin-bottom: 6px;
}

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

/* ---------- Quantity stepper (black-bordered white boxes) ---------- */
.pg-sc-item-qty {
        display: inline-flex;
        align-items: center;
        border: 1.5px solid #000;
        border-radius: 4px;
        overflow: hidden;
        background: #fff;
}

.pg-sc-qty-btn {
        background: #fff;
        border: 0;
        width: 28px;
        height: 26px;
        cursor: pointer;
        font-size: 16px;
        line-height: 1;
        color: #000;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.15s ease;
}

.pg-sc-qty-btn:hover {
        background: #f3f4f6;
}

.pg-sc-qty-input {
        width: 32px;
        height: 26px;
        border: 0;
        border-left: 1.5px solid #000;
        border-right: 1.5px solid #000;
        text-align: center;
        font-size: 13px;
        font-weight: 600;
        color: #000;
        padding: 0;
        -moz-appearance: textfield;
        background: #fff;
}

.pg-sc-qty-input::-webkit-outer-spin-button,
.pg-sc-qty-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
}

.pg-sc-qty-static {
        font-size: 13px;
        font-weight: 700;
        color: #000;
}

.pg-sc-item-price {
        font-size: 16px;
        font-weight: 700;
        color: #000;
        white-space: nowrap;
}

/* ---------- Coupon area ---------- */
.pg-sc-coupon {
        padding: 8px 12px 12px;
        flex-shrink: 0;
}

.pg-sc-coupon-form {
        display: flex;
        gap: 8px;
        margin-bottom: 8px;
}

.pg-sc-coupon-input {
        flex: 1 1 auto;
        min-width: 0;
        height: 38px;
        padding: 0 12px;
        border: 1.5px solid #000;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        background: #fff;
        color: #000;
        transition: border-color 0.15s ease;
}

.pg-sc-coupon-input:focus {
        outline: none;
        border-color: var(--pgsc-accent);
}

.pg-sc-coupon-btn {
        flex: 0 0 auto;
        height: 38px;
        padding: 0 16px;
        font-weight: 600;
        font-size: 13px;
}

.pg-sc-coupons-applied {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
}

.pg-sc-coupon-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: rgba(0, 0, 0, 0.08);
        color: var(--pgsc-panel-text);
        padding: 4px 6px 4px 10px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.02em;
}

.pg-sc-coupon-remove {
        background: transparent;
        border: 0;
        cursor: pointer;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        line-height: 1;
        color: rgba(0, 0, 0, 0.5);
        padding: 0;
        transition: background 0.15s ease, color 0.15s ease;
}

.pg-sc-coupon-remove:hover {
        background: rgba(220, 38, 38, 0.15);
        color: #dc2626;
}

/* ---------- Totals + actions (no footer wrapper) ---------- */
.pg-sc-totals {
        flex-shrink: 0;
        margin: 0 12px 12px;
        background: var(--pgsc-card-bg);
        border: 1px solid var(--pgsc-card-border);
        border-radius: 8px;
        padding: 12px 14px;
}

.pg-sc-total-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 3px 0;
        font-size: 17px;
        font-weight: 600;
        color: #000;
}

.pg-sc-total-row--shipping {
        color: rgba(0, 0, 0, 0.6);
        font-size: 13px;
        font-weight: 500;
}

.pg-sc-total-row--total {
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px dashed var(--pgsc-card-border);
        font-size: 17px;
        font-weight: 700;
}

.pg-sc-actions {
        flex-shrink: 0;
        display: flex;
        gap: 8px;
        padding: 0 12px 16px;
}

.pg-sc-actions .pg-sc-btn {
        flex: 1 1 0;
        min-width: 0;
}

/* When only one button is present, make it full width */
.pg-sc-actions .pg-sc-btn:only-child {
        flex: 1 1 100%;
        width: 100%;
}

/* ---------- Buttons ---------- */
.pg-sc-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        height: 48px;
        padding: 0 18px;
        border: 0;
        border-radius: 10px;
        font-size: 18px;
        font-weight: 600;
        font-family: inherit;
        cursor: pointer;
        text-decoration: none;
        transition: transform 0.12s ease, opacity 0.15s ease, background 0.15s ease;
        white-space: nowrap;
        line-height: 1;
}

.pg-sc-btn:active {
        transform: translateY(1px);
}

.pg-sc-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
}

.pg-sc-btn--accent {
        background: var(--pgsc-accent);
        color: var(--pgsc-accent-text);
}

.pg-sc-btn--accent:hover {
        opacity: 0.92;
}

.pg-sc-btn--ghost {
        background: transparent;
        color: var(--pgsc-panel-text);
        border: 1.5px solid var(--pgsc-accent);
}

.pg-sc-btn--ghost:hover {
        background: rgba(139, 26, 26, 0.08);
}

/* ---------- Floating trigger button ---------- */
.pg-sc-trigger {
        position: fixed;
        z-index: 99998;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: var(--pgsc-accent);
        color: var(--pgsc-accent-text);
        border: 0;
        border-radius: 999px;
        cursor: pointer;
        font-family: var(--pgsc-font);
        font-weight: 600;
        font-size: 14px;
        line-height: 1;
        padding: 0;
        box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.35);
        transition: transform 0.18s var(--pgsc-ease), box-shadow 0.18s ease, opacity 0.18s ease;
}

.pg-sc-trigger:hover {
        transform: translateY(-2px) scale(1.03);
        box-shadow: 0 14px 36px -10px rgba(0, 0, 0, 0.4);
}

.pg-sc-trigger:active {
        transform: translateY(0) scale(1);
}

.pg-sc-trigger--small {
        width: 50px;
        height: 50px;
}

.pg-sc-trigger--medium {
        width: 58px;
        height: 58px;
}

.pg-sc-trigger--large {
        width: 66px;
        height: 66px;
}

.pg-sc-trigger--has-text {
        width: auto;
        padding: 0 22px;
        gap: 10px;
}

.pg-sc-trigger--has-text.pg-sc-trigger--small {
        height: 44px;
}

.pg-sc-trigger--has-text.pg-sc-trigger--medium {
        height: 50px;
}

.pg-sc-trigger--has-text.pg-sc-trigger--large {
        height: 56px;
}

.pg-sc-trigger--top-left     { top: 20px; left: 20px; }
.pg-sc-trigger--top-right    { top: 20px; right: 20px; }
.pg-sc-trigger--bottom-left  { bottom: 20px; left: 20px; }
.pg-sc-trigger--bottom-right { bottom: 20px; right: 20px; }

@media (max-width: 768px) {
        .pg-sc-trigger--hide-mobile {
                display: none !important;
        }
}

.pg-sc-trigger-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
}

.pg-sc-trigger-icon svg {
        width: 24px;
        height: 24px;
        display: block;
}

.pg-sc-trigger--small .pg-sc-trigger-icon svg { width: 20px; height: 20px; }
.pg-sc-trigger--large .pg-sc-trigger-icon svg { width: 28px; height: 28px; }

.pg-sc-trigger-text {
        white-space: nowrap;
}

/* ---------- Badge ---------- */
.pg-sc-badge {
        position: absolute;
        top: -4px;
        right: -4px;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: var(--pgsc-badge-bg);
        color: var(--pgsc-badge-text);
        font-size: 11px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        border: 2px solid #fff;
        opacity: 0;
        transform: scale(0.6);
        transition: opacity 0.2s ease, transform 0.2s var(--pgsc-ease);
}

.pg-sc-trigger--has-text .pg-sc-badge {
        position: static;
        margin-left: 2px;
        border: 0;
}

.pg-sc-badge--show {
        opacity: 1;
        transform: scale(1);
}

/* ---------- Misc ---------- */
.pg-sc-link {
        color: var(--pgsc-accent);
        text-decoration: none;
        font-weight: 600;
}

.pg-sc-link:hover {
        text-decoration: underline;
}

.pg-sc-added-bounce {
        animation: pgscBounce 0.6s var(--pgsc-ease);
}

@keyframes pgscBounce {
        0%   { transform: scale(1); }
        30%  { transform: scale(1.15) rotate(-6deg); }
        60%  { transform: scale(0.95) rotate(4deg); }
        100% { transform: scale(1); }
}

/* Quantity button loading spinner overlay on item */
.pg-sc-item.is-loading {
        opacity: 0.55;
        pointer-events: none;
}
