.wpil-mini-cart-wrapper {
    position: relative;
}

.wpil-cart-link {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    position: relative !important;
}

.wpil-cart-text {
    font-size: 17px;
    font-weight: 500;
    color: #000;
    transition: color 0.2s;
}

.wpil-cart-link:hover .wpil-cart-text {
    color: #ff6b00;
}

.wpil-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    transition: all 0.2s;
}

.wpil-cart-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.wpil-cart-link:hover .wpil-cart-icon {
    color: #333;
}

.wpil-cart-count {
    position: absolute;
    top: -14px;
    right: -10px;
    background: #ff6b00;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.wpil-mini-cart-dropdown {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    background: #fff;
    border-left: 2px solid #e5e7eb;
    box-shadow: -5px 0 25px rgba(0,0,0,0.1);
    width: 480px;
    max-width: 90vw;
    opacity: 0;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99999;
    overflow-y: auto;
}

.wpil-mini-cart-wrapper.open .wpil-mini-cart-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.wpil-mini-cart-items {
    max-height: 450px;
    overflow-y: auto;
}

.wpil-mini-cart-item {
    display: flex;
    gap: 16px;
    padding: 10px 24px;
    border-bottom: 3px solid #f1f5f9;
    transition: background 0.2s;
    position: relative;
}

.wpil-mini-cart-item:hover {
    background: #f8fafc;
}

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

.wpil-mini-cart-item.removing {
    opacity: 0.5;
    pointer-events: none;
}

.wpil-remove-item {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border: none;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    font-weight: 700;
}

.wpil-remove-item:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.wpil-mini-cart-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.wpil-mini-cart-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.wpil-mini-cart-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.wpil-mini-cart-quantity-price {
    margin-top: auto;
}

.wpil-mini-cart-title {
    font-size: 17px;
    font-weight: 500;
    color: #1e293b;
    margin: 0 0 12px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wpil-mini-cart-quantity-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.wpil-mini-cart-qty {
    font-size: 14px;
    color: #64748b;
}

.wpil-mini-cart-meta {
    font-size: 12px;
    color: #666;
    margin: 3px 0;
}

.wpil-mini-cart-price {
    font-size: 17px;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
}

.wpil-mini-cart-footer {
    padding: 12px 20px;
    border-top: 2px solid #e5e7eb;
    background: #f8fafc;
}

.wpil-mini-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.wpil-mini-cart-actions {
    display: flex;
    gap: 10px;
}

.wpil-mini-cart-btn {
    flex: 1;
    padding: 12px 14px;
    text-align: center;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    line-height: 1.4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpil-mini-cart-btn.view-cart {
    background: #fff;
    color: #000;
    border: 2px solid #000;
}

.wpil-mini-cart-btn.view-cart:hover {
    background: #f5f5f5;
    border-color: #000;
}

.wpil-mini-cart-btn.checkout {
    background: #000;
    color: #fff;
}

.wpil-mini-cart-btn.checkout:hover {
    background: #333;
}

.wpil-mini-cart-empty {
    padding: 50px 24px;
    text-align: center;
    color: #64748b;
    font-size: 15px;
}

/* Desktop overlay - only covers left side, not cart area */
@media (min-width: 769px) {
    .wpil-mini-cart-items {
        max-height: 80vh;
    }
    .wpil-mini-cart-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 480px;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease, right 0.3s ease;
        pointer-events: none;
    }

    body.wpil-cart-open .wpil-mini-cart-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* Adjust for smaller screens */
    @media (max-width: 1024px) {
        .wpil-mini-cart-overlay {
            right: 90vw;
        }
    }
}

@media (max-width: 768px) {
    .wpil-mini-cart-dropdown {
        position: fixed;
        top: auto !important;
        right: 0;
        left: 0;
        margin: 0;
        border-radius: 0;
        border-left: none;
        width: 100%;
        max-width: 100%;
        bottom: 0;
        height: auto;
        max-height: 80vh;
        transform: translateY(100%);
        border: none;
        border-top: 2px solid #e5e7eb;
        z-index: 10000 !important;
    }

    .wpil-mini-cart-wrapper.open .wpil-mini-cart-dropdown {
        transform: translateY(0);
    }
}

.wpil-mini-cart-mobile-header {
    display: none;
    padding: 16px 20px;
    border-bottom: 2px solid #e5e7eb;
    background: #f8fafc;
}

.wpil-close-mini-cart {
    width: 100%;
    padding: 14px 20px;
    background: #fff;
    color: red;
    border: 1px solid red;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wpil-close-mini-cart:hover {
    background: #333;
}


@media (max-width: 768px) {
    .wpil-mini-cart-mobile-header {
        display: block;
    }

    /* Mobile overlay - covers area above cart (height set by JS) */
    .wpil-mini-cart-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }

    body.wpil-cart-open .wpil-mini-cart-overlay {
        pointer-events: auto;
    }

    .wpil-mini-cart-wrapper.open ~ .wpil-mini-cart-overlay,
    body.wpil-cart-open .wpil-mini-cart-overlay {
        opacity: 1;
        visibility: visible;
    }
}
