/**
 * OZ Custom WC UI - Cart Menu & Mini Cart Styles
 * Slide-in mini cart from right side
 */

/* Cart Menu Container */
.oz-wcui-cart-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-family: var(--oz-wcui-font, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    line-height: 1.5;
    z-index: 9990;
}

/* Cart Trigger Button */
.oz-wcui-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: transparent !important;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    color: var(--oz-wcui-text, #d8d8d8);
    transition: color 0.2s ease, opacity 0.2s ease;
    /* Remove any pink/focus overlays */
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
}

/* Hover: Dim slightly (reduce opacity) - NO background */
.oz-wcui-cart-trigger:hover {
    background: transparent !important;
    color: rgba(216, 216, 216, 0.7);
    opacity: 0.85;
}

/* Focus visible: subtle outline only, no background */
.oz-wcui-cart-trigger:focus-visible {
    background: transparent !important;
    outline: 2px solid var(--oz-wcui-primary, #3176ce) !important;
    outline-offset: 2px;
}

/* Active/Click state - NO pink overlay */
.oz-wcui-cart-trigger:active,
.oz-wcui-cart-trigger:focus {
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Cart Icon */
.oz-wcui-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.oz-wcui-cart-icon svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Cart Count Badge */
.oz-wcui-cart-count {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--oz-wcui-primary, #3176ce);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
}

/* Badge should always be visible, even when cart is empty (shows "0") */

/* Cart Total */
.oz-wcui-cart-total {
    font-size: 14px;
    font-weight: 600;
    color: var(--oz-wcui-text, #d8d8d8);
}

@media (max-width: 480px) {
    .oz-wcui-cart-total {
        display: none;
    }
}

/* Mini Cart Panel */
.oz-wcui-mini-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 100vw;
    height: calc(100vh - 80px); /* Account for sticky player */
    height: calc(100dvh - 80px);
    background: var(--oz-wcui-bg-card, #1a1a1a);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9991;
    overflow: hidden;
    border-radius: 2px;
}

.oz-wcui-cart-menu[data-open="true"] .oz-wcui-mini-cart {
    transform: translateX(0);
}

/* Mini Cart Header */
.oz-wcui-mini-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--oz-wcui-border, #333333);
    flex-shrink: 0;
}

.oz-wcui-mini-cart-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--oz-wcui-text-light, #ffffff);
}

.oz-wcui-mini-cart-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent !important;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--oz-wcui-text-muted, #9a9a9a);
    transition: background-color 0.2s ease, color 0.2s ease;
    /* ISSUE #3 FIX: Remove pink overlay */
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    filter: none !important;
}

.oz-wcui-mini-cart-close:hover,
.oz-wcui-mini-cart-close:focus-visible {
    background: var(--oz-wcui-bg-hover, #252525) !important;
    color: var(--oz-wcui-text-light, #ffffff);
    outline: none !important;
    box-shadow: none !important;
}

/* ISSUE #3 FIX: Remove pink overlay on all states */
.oz-wcui-mini-cart-close:focus,
.oz-wcui-mini-cart-close:active {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    filter: none !important;
}

.oz-wcui-mini-cart-close svg {
    width: 20px;
    height: 20px;
}

/* BOGO Banner */
.oz-wcui-bogo-banner {
    padding: 0 24px;
    flex-shrink: 0;
}

.oz-wcui-bogo-banner:empty {
    display: none;
}

.oz-wcui-bogo-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    background: linear-gradient(135deg, rgba(49, 118, 206, 0.15) 0%, rgba(49, 118, 206, 0.05) 100%);
    border: 1px solid rgba(49, 118, 206, 0.3);
    border-radius: 2px;
    font-size: 14px;
    font-weight: 500;
    color: var(--oz-wcui-primary, #3176ce);
}

.oz-wcui-bogo-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Cart Items Container */
.oz-wcui-mini-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--oz-wcui-border, #333333) transparent;
}

.oz-wcui-mini-cart-items::-webkit-scrollbar {
    width: 6px;
}

.oz-wcui-mini-cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.oz-wcui-mini-cart-items::-webkit-scrollbar-thumb {
    background: var(--oz-wcui-border, #333333);
    border-radius: 3px;
}

/* Empty Cart */
.oz-wcui-empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--oz-wcui-text-muted, #9a9a9a);
}

.oz-wcui-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.oz-wcui-empty-cart p {
    margin: 0;
    font-size: 15px;
}

/* Cart Item */
.oz-wcui-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--oz-wcui-border, #333333);
}

.oz-wcui-cart-item:last-child {
    border-bottom: none;
}

.oz-wcui-item-image {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 2px;
    overflow: hidden;
    background: var(--oz-wcui-bg-dark, #0d0d0d);
}

.oz-wcui-item-image img,
.oz-wcui-item-image .oz-wcui-item-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.oz-wcui-item-details {
    flex: 1;
    min-width: 0;
}

.oz-wcui-item-name {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--oz-wcui-text, #d8d8d8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oz-wcui-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--oz-wcui-primary, #3176ce);
}

.oz-wcui-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--oz-wcui-text-muted, #9a9a9a);
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.oz-wcui-item-remove:hover,
.oz-wcui-item-remove:focus-visible {
    background: rgba(239, 68, 68, 0.1);
    color: var(--oz-wcui-error, #ef4444);
}

.oz-wcui-item-remove svg {
    width: 16px;
    height: 16px;
}

/* Mini Cart Footer */
.oz-wcui-mini-cart-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--oz-wcui-border, #333333);
    background: var(--oz-wcui-bg-dark, #0d0d0d);
    flex-shrink: 0;
}

.oz-wcui-mini-cart-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--oz-wcui-text, #d8d8d8);
}

.oz-wcui-subtotal-amount {
    font-weight: 700;
    color: var(--oz-wcui-text-light, #ffffff);
}

.oz-wcui-mini-cart-actions {
    display: flex;
    gap: 12px;
}

.oz-wcui-mini-cart-actions .oz-wcui-btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 14px;
}

/* Backdrop */
.oz-wcui-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9990;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.oz-wcui-cart-menu[data-open="true"] .oz-wcui-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .oz-wcui-mini-cart {
        width: 100vw;
        height: calc(100vh - 65px); /* Account for smaller sticky player on mobile */
        height: calc(100dvh - 65px);
    }

    .oz-wcui-mini-cart-header,
    .oz-wcui-mini-cart-items,
    .oz-wcui-mini-cart-footer,
    .oz-wcui-bogo-banner {
        padding-left: 16px;
        padding-right: 16px;
    }

    .oz-wcui-mini-cart-actions {
        flex-direction: column;
    }

    .oz-wcui-mini-cart-footer {
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

/* Tablet responsive */
@media (min-width: 481px) and (max-width: 1024px) {
    .oz-wcui-mini-cart {
        height: calc(100vh - 80px);
        height: calc(100dvh - 80px);
    }
}

/* Hide View Cart button - only show Checkout */
.oz-wcui-mini-cart-actions .oz-wcui-btn-secondary {
    display: none !important;
}

/* Make Checkout button full width when View Cart is hidden */
.oz-wcui-mini-cart-actions .oz-wcui-btn-primary {
    flex: 1;
    width: 100%;
}

/* Fix text colors - use #d8d8d8 for regular text */
.oz-wcui-mini-cart-title {
    color: var(--oz-wcui-text-light, #ffffff);
}

.oz-wcui-mini-cart-subtotal {
    color: var(--oz-wcui-text, #d8d8d8);
}

.oz-wcui-item-name {
    color: var(--oz-wcui-text, #d8d8d8);
}

/* Ensure View Cart and Checkout text is correct color */
.oz-wcui-btn-secondary {
    color: var(--oz-wcui-text, #d8d8d8) !important;
}

.oz-wcui-btn-primary {
    color: #ffffff !important;
}

/* Z-index fix: Hide user dropdown icon when cart is open */
.oz-wcui-cart-menu[data-open="true"] ~ .oz-user-account-dropdown,
.oz-wcui-cart-menu[data-open="true"] ~ * .oz-user-account-dropdown,
body.oz-cart-open .oz-user-account-dropdown {
    z-index: 9998 !important;
    pointer-events: none;
}

/* Ensure cart menu stays below navigation menu (nav menu has z-index 99999 when open) */
/* When cart menu is open, it should be above hamburger (9990) but below nav menu when nav is open (99999) */
.oz-wcui-cart-menu {
    z-index: 9990;
}

/* When cart menu is open, raise z-index above hamburger but below nav menu when nav is open */
.oz-wcui-cart-menu[data-open="true"] {
    z-index: 99991;
}

.oz-wcui-mini-cart {
    z-index: 99991 !important;
}

.oz-wcui-backdrop {
    z-index: 99990 !important;
}

/* When cart menu is open, ensure backdrop is above hamburger */
.oz-wcui-cart-menu[data-open="true"] .oz-wcui-backdrop {
    z-index: 99990 !important;
}

.oz-wcui-cart-menu[data-open="true"] .oz-wcui-mini-cart {
    z-index: 99991 !important;
}

/* Elementor compatibility */
.elementor-widget-shortcode .oz-wcui-cart-menu,
.elementor-widget-text-editor .oz-wcui-cart-menu {
    display: inline-flex;
}

/* Reset inherited styles */
.oz-wcui-cart-menu a {
    box-shadow: none;
    text-decoration: none;
}

.oz-wcui-cart-menu button {
    font-family: inherit;
}

/* Loading state */
.oz-wcui-cart-menu[data-loading="true"] .oz-wcui-mini-cart-items {
    opacity: 0.5;
    pointer-events: none;
}

/* Animation for item removal */
.oz-wcui-cart-item.removing {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Empty Cart State - Hide footer (checkout button and subtotal) when cart is empty */
.oz-wcui-cart-menu.oz-wcui-cart-empty .oz-wcui-mini-cart-footer {
    display: none !important;
}

/* Hide user account dropdown when cart menu is open */
body.oz-cart-open .oz-uad,
body.oz-cart-open [data-oz-uad] {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Cart menu works on all pages including checkout - no page-specific blocks */

/* CRITICAL: Ensure cart menu is ALWAYS closed by default on page load */
/* This prevents auto-opening after navigation */
.oz-wcui-cart-menu:not([data-open="true"]) .oz-wcui-mini-cart {
    transform: translateX(100%) !important;
}

.oz-wcui-cart-menu:not([data-open="true"]) .oz-wcui-backdrop {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure body is never stuck in cart-open state on page load */
html:not(.oz-cart-active) body.oz-cart-open {
    overflow: auto !important;
}

/* Force remove blur from body when cart is not actively open */
body:not(.oz-cart-open) {
    filter: none !important;
    backdrop-filter: none !important;
}

/* Ensure cart menu backdrop allows clicks to pass through to close handler */
.oz-wcui-backdrop {
    cursor: pointer;
}

/* CRITICAL: Prevent cart from auto-opening after AJAX navigation */
/* Cart should ONLY open when user explicitly clicks the cart icon */

.oz-wcui-cart-menu:not([data-open="true"]):not([data-oz-cart-initialized]) .oz-wcui-mini-cart {
    transform: translateX(100%) !important;
    visibility: hidden;
}

/* Ensure proper z-index layering for outside click detection */
/* When cart menu is open, it should be above hamburger (9990) but below nav menu when nav is open (99999) */
.oz-wcui-cart-menu[data-open="true"] {
    z-index: 99991;
}

/* Make sure the backdrop covers the entire viewport for click detection */
.oz-wcui-cart-menu[data-open="true"] .oz-wcui-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
}

/* ============================================
   BOGO DEAL STYLING
   ============================================ */

/* BOGO Incentive Message - Positioned in footer, above subtotal */
.oz-wcui-bogo-banner {
    padding: 0;
    margin-bottom: 12px;
}

.oz-wcui-bogo-banner:empty {
    display: none;
    margin: 0;
}

.oz-wcui-bogo-incentive {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(49, 118, 206, 0.12) 0%, rgba(49, 118, 206, 0.05) 100%);
    border: 1px solid rgba(49, 118, 206, 0.25);
    border-radius: 2px;
    font-size: 13px;
    text-align: center;
}

.oz-wcui-bogo-text {
    font-style: italic;
    font-weight: 600;
    color: var(--oz-wcui-primary, #3176ce);
    line-height: 1.4;
}

/* BOGO Achieved state - when user qualifies for deal */
.oz-wcui-bogo-achieved {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.05) 100%);
    border-color: rgba(34, 197, 94, 0.3);
}

.oz-wcui-bogo-achieved .oz-wcui-bogo-text {
    color: #22c55e;
}

/* FREE Badge on cart items */
.oz-wcui-bogo-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oz-wcui-original-price {
    color: var(--oz-wcui-text-muted, #9a9a9a);
    font-size: 13px;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: #d8d8d8;
}

.oz-wcui-free-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--oz-wcui-primary, #3176ce);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 2px;
}

/* Free item highlight */
.oz-wcui-cart-item.oz-wcui-item-free {
    background: rgba(49, 118, 206, 0.05);
    border-radius: 2px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
}

/* Cart page BOGO styling */
.oz-bogo-free-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.oz-bogo-original-price {
    color: #9a9a9a;
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: #d8d8d8;
}

.oz-bogo-free-label {
    display: inline-block;
    padding: 3px 10px;
    background: #3176ce;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 2px;
}
