/**
 * Purifine Cart Drawer - CSS
 * Version: 1.1.1
 * Style: Fioletowy (#7B3F9E) + Force image dimensions
 */

:root {
    --pc-accent:     #7B3F9E;
    --pc-accent-h:   #9B5FBE;
    --pc-bg:         #ffffff;
    --pc-surface:    #F5F5F5;
    --pc-border:     #E8E8E8;
    --pc-text:       #1a1a1a;
    --pc-muted:      #666666;
    --pc-danger:     #c0392b;
    --pc-green:      #2e7d52;
    --pc-radius:     8px;
    --pc-shadow:     0 24px 80px rgba(0,0,0,0.18);
    --pc-transition: 0.22s cubic-bezier(0.4,0,0.2,1);
    --pc-w:          420px;
}

/* OVERLAY */
.pc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--pc-transition), visibility var(--pc-transition);
}
.pc-overlay.is-open { 
    opacity: 1; 
    visibility: visible; 
}

/* DRAWER */
.pc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--pc-w);
    max-width: 100vw;
    height: 100dvh;
    background: var(--pc-bg);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--pc-shadow);
    border-radius: var(--pc-radius) 0 0 var(--pc-radius);
}
.pc-drawer.is-open { 
    transform: translateX(0); 
}

/* HEADER */
.pc-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 18px;
    border-bottom: 1px solid var(--pc-border);
    flex-shrink: 0;
}
.pc-drawer__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--pc-text);
    font-family: 'Montserrat', sans-serif;
    letter-spacing: -0.01em;
}
.pc-drawer__title svg { 
    color: var(--pc-accent); 
}
.pc-drawer__count {
    background: var(--pc-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.pc-drawer__count:empty { 
    display: none; 
}
.pc-drawer__close {
    background: none;
    border: 1px solid var(--pc-border);
    border-radius: 6px;
    cursor: pointer;
    padding: 8px;
    color: var(--pc-muted);
    display: flex;
    align-items: center;
    transition: all var(--pc-transition);
}
.pc-drawer__close:hover { 
    border-color: var(--pc-accent); 
    color: var(--pc-accent); 
}
.pc-drawer__close svg { 
    width: 16px; 
    height: 16px; 
}

/* SHIPPING PROGRESS */
.pc-drawer__shipping {
    padding: 14px 24px;
    background: var(--pc-surface);
    border-bottom: 1px solid var(--pc-border);
    flex-shrink: 0;
}
.pc-shipping__bar-wrap {
    height: 4px;
    background: var(--pc-border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.pc-shipping__bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pc-accent), var(--pc-accent-h));
    border-radius: 2px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.pc-shipping__bar.is-full { 
    background: linear-gradient(90deg, #2e7d52, #3aaf6e); 
}
.pc-shipping__text {
    font-size: 12px;
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    color: var(--pc-muted);
    margin: 0;
    text-align: center;
}
.pc-shipping__text strong { 
    color: var(--pc-text);
    font-weight: 600;
}
.pc-shipping__text.is-free { 
    color: var(--pc-green); 
    font-weight: 600; 
}

/* BODY */
.pc-drawer__body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--pc-border) transparent;
}
.pc-drawer__body::-webkit-scrollbar { 
    width: 4px; 
}
.pc-drawer__body::-webkit-scrollbar-thumb { 
    background: var(--pc-border); 
    border-radius: 2px; 
}
.pc-drawer__body::-webkit-scrollbar-thumb:hover {
    background: var(--pc-accent);
}

/* LOADING */
.pc-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}
.pc-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--pc-border);
    border-top-color: var(--pc-accent);
    border-radius: 50%;
    animation: pc-spin 0.7s linear infinite;
}
@keyframes pc-spin { 
    to { transform: rotate(360deg); } 
}

/* EMPTY STATE */
.pc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}
.pc-empty__icon {
    width: 64px;
    height: 64px;
    background: var(--pc-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--pc-muted);
}
.pc-empty__title { 
    font-size: 16px; 
    font-weight: 700; 
    font-family: 'Montserrat', sans-serif;
    color: var(--pc-text); 
    margin-bottom: 8px; 
}
.pc-empty__text { 
    font-size: 13px; 
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    color: var(--pc-muted); 
    line-height: 1.6; 
    margin-bottom: 24px; 
    max-width: 260px; 
}
.pc-empty__btn {
    background: var(--pc-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 11px 22px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--pc-transition);
    display: inline-flex;
}
.pc-empty__btn:hover { 
    background: var(--pc-accent-h);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(123, 63, 158, 0.3);
}

/* ITEM */
.pc-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--pc-border);
    animation: pc-fadein 0.22s cubic-bezier(0.4,0,0.2,1);
    transition: opacity 0.2s;
}
.pc-item.is-removing { 
    opacity: 0.3; 
    pointer-events: none; 
}
@keyframes pc-fadein { 
    from { 
        opacity: 0; 
        transform: translateY(6px); 
    } 
}

/* IMAGE - FORCE DIMENSIONS (FIX) */
.pc-item__image {
    width: 68px !important;
    height: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    border-radius: 8px;
    object-fit: cover !important;
    object-position: center !important;
    border: 1px solid var(--pc-border);
    background: var(--pc-surface);
    flex-shrink: 0;
    display: block;
}

.pc-item__info { 
    flex: 1; 
    min-width: 0; 
}
.pc-item__name {
    font-size: 13px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: var(--pc-text);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}
.pc-item__name:hover { 
    color: var(--pc-accent); 
}
.pc-item__price { 
    font-size: 14px; 
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    color: var(--pc-accent); 
    margin-bottom: 10px; 
}

/* QUANTITY */
.pc-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--pc-border);
    border-radius: 6px;
    overflow: hidden;
    height: 30px;
    background: var(--pc-surface);
}
.pc-qty__btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: var(--pc-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--pc-transition);
    flex-shrink: 0;
}
.pc-qty__btn:hover { 
    background: var(--pc-accent); 
    color: #fff; 
}
.pc-qty__btn:disabled { 
    opacity: 0.3; 
    cursor: not-allowed; 
}
.pc-qty__val {
    width: 34px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    border: none;
    background: transparent;
    color: var(--pc-text);
    outline: none;
}

.pc-item__remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--pc-muted);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: all var(--pc-transition);
    flex-shrink: 0;
}
.pc-item__remove:hover { 
    color: var(--pc-danger); 
    background: #fdf2f2; 
}

/* FOOTER */
.pc-drawer__footer {
    padding: 18px 24px 22px;
    border-top: 1px solid var(--pc-border);
    background: var(--pc-bg);
    flex-shrink: 0;
}
.pc-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 14px;
    font-family: 'Lato', sans-serif;
}
.pc-subtotal span:first-child { 
    color: var(--pc-muted);
    font-weight: 300;
}
.pc-subtotal__price { 
    font-size: 20px; 
    font-weight: 800;
    font-family: 'Montserrat', sans-serif;
    color: var(--pc-text); 
    letter-spacing: -0.02em; 
}

/* BUTTONS */
.pc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--pc-transition);
    letter-spacing: 0.02em;
    border: none;
    margin-bottom: 8px;
}
.pc-btn--checkout { 
    background: var(--pc-accent); 
    color: #fff; 
}
.pc-btn--checkout:hover {
    background: var(--pc-accent-h);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 63, 158, 0.3);
}
.pc-btn--continue {
    background: var(--pc-surface);
    color: var(--pc-text);
    border: 1px solid var(--pc-border);
}
.pc-btn--continue:hover { 
    border-color: var(--pc-accent); 
    background: var(--pc-bg); 
}

/* ERROR STATE */
.pc-error {
    padding: 40px 24px;
    text-align: center;
    color: var(--pc-danger);
    font-size: 13px;
    font-family: 'Lato', sans-serif;
}

/* RESPONSIVE */
@media (max-width: 480px) {
    :root { --pc-w: 100vw; }
    .pc-drawer { 
        border-radius: 0; 
    }
    .pc-drawer__header {
        margin-top: 0;
    }
}
