/* =====================================================
   MYP Carrinho Lateral — Elegant WooCommerce Side Cart
   ===================================================== */

/* === Variables === */
:root {
    --myp-primary:        #00c4c4;
    --myp-primary-light:  #67e0e0;
    --myp-primary-dark:   #008f8f;
    --myp-gradient:       linear-gradient(160deg, #ffffff 0%, #f0fafa 55%, #ccf2f2 100%);
    --myp-gradient-soft:  linear-gradient(135deg, #f0fafa 0%, #ccf2f2 100%);
    --myp-text:           #1e293b;
    --myp-text-muted:     #64748b;
    --myp-border:         #e2e8f0;
    --myp-white:          #ffffff;
    --myp-shadow:         0 16px 40px rgba(0,0,0,.10), 0 4px 16px rgba(0,0,0,.06);
    --myp-radius:         16px;
    --myp-sidebar-width:  420px;
    --myp-ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --myp-transition:     0.35s var(--myp-ease);
}

/* ====================================================
   Overlay
   ==================================================== */
.myp-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--myp-transition), visibility var(--myp-transition);
}
.myp-cart-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ====================================================
   Sidebar container
   ==================================================== */
.myp-cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--myp-sidebar-width);
    max-width: 100vw;
    height: 100dvh;
    z-index: 99999999;
    display: flex;
    flex-direction: column;
    background: var(--myp-white);
    box-shadow: var(--myp-shadow);
    transform: translateX(110%);
    transition: transform var(--myp-transition);
    overflow: hidden;
    will-change: transform;
}
.myp-cart-sidebar.is-open {
    transform: translateX(0);
}

/* Loading overlay inside sidebar */
.myp-cart-sidebar.is-loading {
    pointer-events: none;
}
.myp-cart-sidebar.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(2px);
    z-index: 10;
}
.myp-cart-sidebar.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border: 3px solid var(--myp-primary-light);
    border-top-color: var(--myp-primary);
    border-radius: 50%;
    z-index: 11;
    animation: myp-spin 0.7s linear infinite;
}

/* ====================================================
   Header
   ==================================================== */
.myp-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    background: var(--myp-gradient-soft);
    border-bottom: 1px solid var(--myp-border);
    flex-shrink: 0;
}
.myp-cart-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.myp-cart-icon-header {
    width: 22px;
    height: 22px;
    color: #0094aa;
    flex-shrink: 0;
}
.myp-cart-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--myp-text);
    letter-spacing: -0.3px;
    margin: 0;
}
.myp-cart-header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    background: #0094aa;
    color: #fff;
    border-radius: 13px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}
.myp-cart-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(59,130,246,.10);
    border-radius: 50%;
    cursor: pointer;
    color: var(--myp-text);
    transition: background 0.2s, transform 0.25s var(--myp-ease);
    flex-shrink: 0;
    padding: 0;
}
.myp-cart-close:hover {
    background: rgba(59,130,246,.20);
    transform: rotate(90deg);
}
.myp-cart-close svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* ====================================================
   Scrollable body
   ==================================================== */
.myp-cart-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 0;
    scroll-behavior: smooth;
}
.myp-cart-body::-webkit-scrollbar       { width: 4px; }
.myp-cart-body::-webkit-scrollbar-track { background: transparent; }
.myp-cart-body::-webkit-scrollbar-thumb {
    background: var(--myp-primary-light);
    border-radius: 2px;
}

/* ====================================================
   Empty state
   ==================================================== */
.myp-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 64px 32px;
    text-align: center;
}
.myp-cart-empty svg {
    width: 80px;
    height: 80px;
    color: var(--myp-primary-light);
    opacity: 0.75;
}
.myp-cart-empty p {
    font-size: 16px;
    color: var(--myp-text-muted);
    margin: 0;
}
.myp-btn-shop {
    display: inline-block;
    padding: 11px 26px;
    background: var(--myp-primary);
    color: #fff !important;
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
}
.myp-btn-shop:hover {
    background: var(--myp-primary-dark);
    transform: translateY(-1px);
}

/* ====================================================
   Items list
   ==================================================== */
.myp-cart-items {
    list-style: none;
    margin: 0;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Single item card */
.myp-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--myp-white);
    border-radius: var(--myp-radius);
    padding: 14px 14px 14px 14px;
    border: 1px solid var(--myp-border);
    position: relative;
    transition: opacity 0.3s var(--myp-ease), transform 0.3s var(--myp-ease);
}
.myp-cart-item.removing {
    opacity: 0;
    transform: translateX(48px);
}

/* Thumbnail */
.myp-item-thumb {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--myp-gradient-soft);
    display: block;
}
.myp-item-thumb img,
.myp-item-thumb .myp-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

/* Info column */
.myp-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 20px; /* space for remove btn */
}
.myp-item-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--myp-text) !important;
    text-decoration: none !important;
    line-height: 1.35;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.myp-item-name:hover {
    color: var(--myp-primary) !important;
}

/* Variation badges */
.myp-item-variations {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.myp-variation-item {
    font-size: 10.5px;
    color: var(--myp-text-muted);
    background: var(--myp-gradient-soft);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--myp-border);
    white-space: nowrap;
}
.myp-variation-item strong {
    font-weight: 600;
}

/* Bottom row: qty + subtotal */
.myp-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
}

/* Qty stepper */
.myp-qty-control {
    display: inline-flex;
    align-items: center;
    border: 1.5px solid var(--myp-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    width: auto;
    flex: 0 0 auto;
    align-self: flex-start;
}
.myp-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    color: var(--myp-primary);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    flex: 0 0 28px;
}
.myp-qty-btn:hover {
    background: var(--myp-gradient-soft);
}
.myp-qty-input {
    width: 36px;
    height: 28px;
    border: none;
    border-left: 1px solid var(--myp-border);
    border-right: 1px solid var(--myp-border);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--myp-text);
    background: transparent;
    outline: none;
    padding: 0;
    appearance: textfield;
    -moz-appearance: textfield;
    flex: 0 0 60px;
}
.myp-qty-input::-webkit-outer-spin-button,
.myp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Subtotal + unit price */
.myp-item-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
}
.myp-item-unit-price {
    font-size: 11px;
    color: var(--myp-text-muted);
    white-space: nowrap;
}
.myp-item-subtotal {
    font-size: 15px;
    font-weight: 700;
    color: var(--myp-primary-dark);
    white-space: nowrap;
}

/* Remove button */
.myp-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    color: #cbd5e1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}
.myp-item-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}
.myp-item-remove svg {
    width: 14px;
    height: 14px;
    pointer-events: none;
}

/* ====================================================
   Footer
   ==================================================== */
.myp-cart-footer {
    flex-shrink: 0;
    padding: 10px 24px 20px 24px;
    background: var(--myp-white);
    border-top: 1px solid var(--myp-border);
}
.myp-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1.5px dashed var(--myp-border);
}
.myp-cart-subtotal > span:first-child {
    font-size: 14px;
    color: var(--myp-text-muted);
    font-weight: 500;
}
.myp-subtotal-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--myp-text);
    letter-spacing: -0.5px;
}
.myp-cart-actions {
    display: flex;
    gap: 10px;
}
.myp-btn-cart,
.myp-btn-checkout {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 13px 16px;
    border-radius: 10px;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    letter-spacing: 0.1px;
    cursor: pointer;
    border: none;
}
.myp-btn-cart {
    background: var(--myp-gradient-soft);
    color: var(--myp-primary-dark) !important;
    border: 1.5px solid var(--myp-primary-light);
}
.myp-btn-cart:hover {
    background: #ccf2f2;
    border-color: var(--myp-primary);
}
.myp-btn-checkout {
    background: linear-gradient(135deg, var(--myp-primary) 0%, var(--myp-primary-dark) 100%);
    color: #fff !important;
    border: 1.5px solid transparent;
    box-shadow: rgba(0, 196, 196, 0.4) 0px 2px 5px;
}
.myp-btn-checkout:hover {
    background: linear-gradient(135deg, #009999 0%, #007070 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,196,196,.50);
}

/* ====================================================
   Floating Action Button (FAB)
   ==================================================== */
.myp-cart-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    border: none;
    background-image: linear-gradient(to right, #DFFAFA, #f2ffff, #DFFAFA);
    color: #0094aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99997;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.03), 1px 1px 5px rgb(0 0 0 / 33%);
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
    padding: 0;
}
.myp-cart-fab,
.myp-cart-fab:hover,
.myp-cart-fab:focus,
.myp-cart-fab:active,
body.myp-cart-open .myp-cart-fab {
    background-color: #f2ffff;
    background-image: linear-gradient(to right, #DFFAFA, #f2ffff, #DFFAFA);
    color: #0094aa;
}
.myp-cart-fab:hover {
    transform: scale(1.10) translateY(-2px);
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.03), 0 8px 18px rgba(0, 0, 0, 0.20);
}
.myp-cart-fab:active {
    transform: scale(0.95);
}
.myp-fab-icon {
    width: 28px;
    height: 28px;
    pointer-events: none;
}

/* Badge count */
.myp-fab-count {
    position: absolute;
    top: -8px;
    left: -8px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #0094aa;
    color: #fff;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transform: scale(0);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
}
.myp-cart-fab.has-items .myp-fab-count {
    transform: scale(1);
}

/* ====================================================
   Body scroll lock
   ==================================================== */
body.myp-cart-open {
    overflow: hidden;
}

/* ====================================================
   Cart notice (erro / sucesso)
   ==================================================== */
.myp-cart-notice {
    margin: 0 14px 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    animation: myp-notice-in 0.25s var(--myp-ease) both;
}
.myp-notice-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.myp-notice-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
@keyframes myp-notice-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====================================================
   Keyframes
   ==================================================== */
@keyframes myp-spin {
    to { transform: rotate(360deg); }
}
/* ====================================================
   Responsive
   ==================================================== */
@media (max-width: 480px) {
    :root {
        --myp-sidebar-width: 100vw;
    }
    .myp-cart-sidebar {
        border-radius: 0;
    }
    .myp-cart-fab {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    .myp-fab-icon {
        width: 24px;
        height: 24px;
    }
    .myp-cart-items {
        padding: 0 10px;
    }
    .myp-cart-header {
        padding: 16px 18px;
    }
    .myp-cart-footer {
        padding: 16px 18px;
    }
}
