:root {
    --ugwsc-width: 430px;
    --ugwsc-radius: 14px;
    --ugwsc-border: #e8e8e8;
    --ugwsc-text: #202124;
    --ugwsc-muted: #6f7378;
    --ugwsc-accent: #1d4ed8;
}

body.ugwsc-open {
    overflow: hidden;
}

.ugwsc-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: rgba(0, 0, 0, .44);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}

.ugwsc-drawer {
    position: fixed;
    z-index: 999999;
    top: 0;
    right: 0;
    width: min(var(--ugwsc-width), 100vw);
    height: 100dvh;
    background: #fff;
    color: var(--ugwsc-text);
    box-shadow: -14px 0 38px rgba(0, 0, 0, .15);
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.22, .61, .36, 1);
    display: flex;
    flex-direction: column;
}

body.ugwsc-open .ugwsc-overlay {
    opacity: 1;
    visibility: visible;
}

body.ugwsc-open .ugwsc-drawer {
    transform: translateX(0);
}

.ugwsc-header {
    min-height: 72px;
    padding: 0 22px;
    border-bottom: 1px solid var(--ugwsc-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.ugwsc-header h2 {
    margin: 0;
    font-size: 21px;
    line-height: 1.2;
    font-weight: 700;
}

.ugwsc-close,
.ugwsc-remove,
.ugwsc-qty-btn {
    appearance: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: inherit;
}

.ugwsc-close {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 32px;
    line-height: 1;
}

.ugwsc-close:hover {
    background: #f4f4f4;
}

.ugwsc-content {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.ugwsc-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px 22px 10px;
}

.ugwsc-item {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--ugwsc-border);
}

.ugwsc-thumb img {
    display: block;
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 10px;
    background: #f6f6f6;
}

.ugwsc-item-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.ugwsc-item-top,
.ugwsc-item-bottom,
.ugwsc-subtotal-row,
.ugwsc-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ugwsc-item-top {
    align-items: flex-start;
}

.ugwsc-name {
    min-width: 0;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 650;
}

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

.ugwsc-name dl.variation {
    margin: 6px 0 0;
    color: var(--ugwsc-muted);
    font-size: 12px;
    font-weight: 400;
}

.ugwsc-remove {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 23px;
    line-height: 1;
    color: #777;
}

.ugwsc-remove:hover {
    background: #f3f3f3;
    color: #111;
}

.ugwsc-qty {
    display: inline-grid;
    grid-template-columns: 34px 46px 34px;
    height: 36px;
    border: 1px solid #d9d9d9;
    border-radius: 9px;
    overflow: hidden;
}

.ugwsc-qty-btn {
    font-size: 19px;
}

.ugwsc-qty-btn:hover {
    background: #f4f4f4;
}

.ugwsc-qty-input {
    width: 46px !important;
    min-width: 0 !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 2px !important;
    border: 0 !important;
    border-left: 1px solid #e3e3e3 !important;
    border-right: 1px solid #e3e3e3 !important;
    border-radius: 0 !important;
    text-align: center;
    box-shadow: none !important;
    appearance: textfield;
}

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

.ugwsc-line-price {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.ugwsc-footer {
    padding: 18px 22px 22px;
    border-top: 1px solid var(--ugwsc-border);
    background: #fff;
}

.ugwsc-subtotal-row {
    font-size: 17px;
}

.ugwsc-tax-note {
    margin: 8px 0 16px;
    color: var(--ugwsc-muted);
    font-size: 12px;
    line-height: 1.4;
}

.ugwsc-actions {
    align-items: stretch;
}

.ugwsc-button {
    flex: 1;
    min-height: 47px;
    padding: 12px 14px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    transition: transform .15s ease, opacity .15s ease;
}

.ugwsc-button:hover {
    transform: translateY(-1px);
    opacity: .92;
}

.ugwsc-button-secondary {
    border: 1px solid #d5d5d5;
    color: #222 !important;
    background: #fff;
}

.ugwsc-button-primary {
    color: #fff !important;
    background: var(--ugwsc-accent);
}

.ugwsc-empty {
    margin: auto;
    padding: 40px 24px;
    text-align: center;
    color: var(--ugwsc-muted);
}

.ugwsc-empty-icon {
    margin-bottom: 10px;
    font-size: 48px;
    opacity: .55;
}

.ugwsc-error {
    margin: 12px 22px 0;
    padding: 11px 13px;
    border-radius: 8px;
    background: #fff1f1;
    color: #a40000;
    font-size: 13px;
}

.ugwsc-loading .ugwsc-content::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(255, 255, 255, .66);
}

.ugwsc-loading .ugwsc-content::before {
    content: '';
    position: absolute;
    z-index: 6;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #ddd;
    border-top-color: var(--ugwsc-accent);
    border-radius: 50%;
    animation: ugwsc-spin .75s linear infinite;
}

@keyframes ugwsc-spin {
    to { transform: rotate(360deg); }
}

.ugwsc-floating-button {
    position: fixed;
    z-index: 99990;
    right: 22px;
    bottom: 22px;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--ugwsc-accent);
    color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    cursor: pointer;
}

.ugwsc-floating-icon {
    font-size: 23px;
}

.ugwsc-floating-button .ugwsc-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #111;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 480px) {
    .ugwsc-header {
        min-height: 64px;
        padding: 0 16px;
    }

    .ugwsc-items {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ugwsc-item {
        grid-template-columns: 74px minmax(0, 1fr);
        gap: 12px;
    }

    .ugwsc-thumb img {
        width: 74px;
        height: 74px;
    }

    .ugwsc-footer {
        padding: 16px;
    }

    .ugwsc-actions {
        flex-direction: column;
    }
}
