/* ===================================================
   GV Shop – Cart Widget (mod_gvshop_cart)
   =================================================== */

/* Allineamento nel wrapper Helix Ultimate */
.sp-module:has(.gvshop-cart-widget) {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.sp-module-content:has(.gvshop-cart-widget) {
    display: flex;
    align-items: center;
    line-height: 1;
}

.gvshop-cart-widget {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Toggle button */
.gvshop-cart-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--gvshop-icon-color, #fff);
    font-size: inherit;
    line-height: 1;
    transition: opacity 0.2s;
}

.gvshop-cart-toggle:hover {
    opacity: 0.75;
}

.gvshop-cart-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Badge */
.gvshop-cart-badge {
    position: absolute;
    top: 0;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--gvshop-badge-bg, #e53e3e);
    color: var(--gvshop-badge-text, #fff);
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    pointer-events: none;
}

/* Dropdown */
.gvshop-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1050;
    min-width: 320px;
    max-width: 380px;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    animation: gvshopDropIn 0.15s ease-out;
}

@keyframes gvshopDropIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empty state */
.gvshop-cart-empty {
    padding: 24px 16px;
    text-align: center;
    color: #a0aec0;
    font-size: 14px;
}

/* Item list */
.gvshop-cart-items {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.gvshop-cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    transition: background 0.15s;
}

.gvshop-cart-item:last-child {
    border-bottom: none;
}

.gvshop-cart-item:hover {
    background: #f7fafc;
}

.gvshop-cart-item-img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
    background: #edf2f7;
}

.gvshop-cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gvshop-cart-item-title {
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gvshop-cart-item-meta {
    color: #a0aec0;
    font-size: 12px;
}

.gvshop-cart-item-line-total {
    font-weight: 600;
    color: #2d3748;
    white-space: nowrap;
    flex-shrink: 0;
}

.gvshop-cart-item-remove {
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    color: #cbd5e0;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.gvshop-cart-item-remove:hover {
    color: #e53e3e;
    background: #fff5f5;
}

/* Footer */
.gvshop-cart-footer {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    background: #f7fafc;
}

.gvshop-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 10px;
}

.gvshop-cart-actions {
    display: flex;
    gap: 8px;
}

/* Buttons */
.gvshop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
    white-space: nowrap;
}

.gvshop-btn-outline {
    background: #fff;
    border-color: #e2e8f0;
    color: #4a5568;
}

.gvshop-btn-outline:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    color: #2d3748;
}

.gvshop-btn-primary {
    background: var(--gvshop-btn-bg, #3182ce);
    color: var(--gvshop-btn-text, #fff);
}

.gvshop-btn-primary:hover {
    background: var(--gvshop-btn-bg-hover, #2b6cb0);
    color: var(--gvshop-btn-text-hover, #fff);
    filter: none;
}

/* ==== Responsive ==== */
@media (max-width: 576px) {
    .gvshop-cart-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        max-width: 100%;
        margin-top: 0;
        border-radius: 16px 16px 0 0;
        max-height: 70vh;
        display: flex;
        flex-direction: column;
        animation: gvshopSlideUp 0.2s ease-out;
    }

    @keyframes gvshopSlideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .gvshop-cart-items {
        flex: 1;
        overflow-y: auto;
    }
}
