/**
 * One Elementor - One Menu Cart Widget
 * Mini Cart Dropdown Styles  
 */

/* ========================================
   Menu Cart Wrapper
======================================== */
.oe-menu-cart-wrapper {
    position: relative;
    display: inline-block;
}

/* ========================================
   Cart Toggle (Icon + Count)
======================================== */
.oe-menu-cart-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.oe-menu-cart-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.oe-menu-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.oe-menu-cart-icon i,
.oe-menu-cart-icon svg {
    transition: all 0.3s ease;
}

/* ========================================
   Cart Count Badge
======================================== */
.oe-menu-cart-count {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background-color: #FF6B6B;
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    line-height: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

/* Count Positions */
.oe-count-top-right {
    top: -8px;
    right: -8px;
}

.oe-count-top-left {
    top: -8px;
    left: -8px;
}

.oe-count-bottom-right {
    bottom: -8px;
    right: -8px;
}

.oe-count-bottom-left {
    bottom: -8px;
    left: -8px;
}

/* Count Animation when updated */
@keyframes oeCartCountBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
}

.oe-menu-cart-count.updated {
    animation: oeCartCountBounce 0.5s ease;
}

/* ========================================
   Subtotal
======================================== */
.oe-menu-cart-subtotal {
    font-size: 14px;
    font-weight: 500;
    color: #333333;
    white-space: nowrap;
}

/* ========================================
   Dropdown Container - FIXED FOR HOVER
======================================== */
.oe-menu-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    padding-top: 10px;
    width: 360px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9999;
}

/* Transparent overlay for hover bridge */
.oe-menu-cart-dropdown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
    z-index: 0;
}

/* Inner dropdown content - All visual styles here */
.oe-menu-cart-dropdown-inner {
    background-color: #FFFFFF;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    z-index: 1;
    /* No transition on inner - keep styles stable */
    transition: none;
}

/* Dropdown Arrow */
.oe-menu-cart-dropdown-inner::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #FFFFFF;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.1));
    z-index: 1;
}

/* Keep dropdown visible when hovering wrapper or dropdown itself */
.oe-menu-cart-wrapper:hover .oe-menu-cart-dropdown,
.oe-menu-cart-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Active state for mobile toggle and auto-open */
.oe-menu-cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========================================
   Dropdown Header
======================================== */
.oe-menu-cart-header {
    padding: 12px 15px;
    border-bottom: 1px solid #F0F0F0;
}

.oe-menu-cart-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333333;
}

/* ========================================
   Cart Items List
======================================== */
.oe-menu-cart-items {
    max-height: 320px;
    overflow-y: auto;
    padding: 12px 15px;
}

/* Custom Scrollbar */
.oe-menu-cart-items::-webkit-scrollbar {
    width: 6px;
}

.oe-menu-cart-items::-webkit-scrollbar-track {
    background: #F5F5F5;
    border-radius: 3px;
}

.oe-menu-cart-items::-webkit-scrollbar-thumb {
    background: #CCCCCC;
    border-radius: 3px;
}

.oe-menu-cart-items::-webkit-scrollbar-thumb:hover {
    background: #999999;
}

/* ========================================
   Single Cart Item
======================================== */
.oe-menu-cart-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.oe-menu-cart-item:hover {
    background-color: #F9F9F9;
}

.oe-menu-cart-item + .oe-menu-cart-item {
    margin-top: 8px;
}

/* Cart Item Image */
.oe-menu-cart-item-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    background-color: #F5F5F5;
}

.oe-menu-cart-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.oe-menu-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.oe-menu-cart-item:hover .oe-menu-cart-item-image img {
    transform: scale(1.05);
}

/* Cart Item Content */
.oe-menu-cart-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding-right: 24px;
}

/* Cart Item Title */
.oe-menu-cart-item-title {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: #333333;
}

.oe-menu-cart-item-title a {
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.oe-menu-cart-item-title a:hover {
    color: #FF6B6B;
}

/* Cart Item Price */
.oe-menu-cart-item-price {
    font-size: 13px;
    font-weight: 600;
    color: #FF6B6B;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.oe-menu-cart-item-price .woocommerce-Price-amount {
    color: inherit;
}

/* Quantity badge */
.oe-menu-cart-item-quantity {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background-color: #F0F0F0;
    color: #666666;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1;
}

/* Remove Button */
.oe-menu-cart-item-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background-color: #FF6B6B;
    color: #FFFFFF;
    border-radius: 50%;
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: all 0.3s ease;
    cursor: pointer;
}

.oe-menu-cart-item:hover .oe-menu-cart-item-remove {
    opacity: 1;
}

.oe-menu-cart-item-remove:hover {
    background-color: #FF5252;
    transform: scale(1.1);
}

.oe-menu-cart-item-remove span {
    display: block;
    line-height: 1;
}

/* Removing State */
.oe-menu-cart-item.removing {
    opacity: 0.5;
    pointer-events: none;
}

.oe-menu-cart-item.removing .oe-menu-cart-item-remove {
    animation: oe-spin 0.6s linear infinite;
}

/* ========================================
   Dropdown Footer
======================================== */
.oe-menu-cart-footer {
    padding: 12px 15px;
    border-top: 1px solid #F0F0F0;
    background-color: #FAFAFA;
}

/* Total */
.oe-menu-cart-total {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.oe-menu-cart-total-text {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.oe-menu-cart-total-text .amount {
    font-size: 16px;
    font-weight: 700;
    color: #FF6B6B;
}

/* View Cart Button */
.oe-menu-cart-view-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background-color: #FF6B6B;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.oe-menu-cart-view-btn:hover {
    background-color: #FF5252;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

/* ========================================
   Empty Cart
======================================== */
.oe-menu-cart-empty {
    padding: 40px 20px;
    text-align: center;
}

.oe-menu-cart-empty p {
    margin: 0;
    font-size: 14px;
    color: #999999;
}

/* ========================================
   Animation for new items
======================================== */
@keyframes oeSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.oe-menu-cart-item.new-item {
    animation: oeSlideIn 0.4s ease;
}

/* ========================================
   Responsive Design
======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .oe-menu-cart-dropdown {
        width: 340px;
    }

    .oe-menu-cart-item-image {
        width: 50px;
        height: 50px;
    }
}

/* Mobile - Large (768px and below) */
@media (max-width: 768px) {
    .oe-menu-cart-dropdown {
        position: fixed !important;
        top: 80px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: 400px !important;
        margin: 0 auto !important;
        transform: translateY(-10px) !important;
    }

    .oe-menu-cart-wrapper:hover .oe-menu-cart-dropdown,
    .oe-menu-cart-dropdown:hover,
    .oe-menu-cart-dropdown.active {
        transform: translateY(0) !important;
    }

    .oe-menu-cart-dropdown-inner::before {
        display: none !important;
    }

    .oe-menu-cart-items {
        max-height: 300px;
        padding: 12px;
    }

    .oe-menu-cart-header,
    .oe-menu-cart-footer {
        padding: 12px 15px;
    }

    .oe-menu-cart-item {
        gap: 10px;
        padding: 8px;
    }

    .oe-menu-cart-item-image {
        width: 60px;
        height: 60px;
    }

    .oe-menu-cart-item-title {
        font-size: 13px;
        line-height: 1.4;
    }

    .oe-menu-cart-item-price {
        font-size: 13px;
        font-weight: 700;
    }

    .oe-menu-cart-title {
        font-size: 14px;
        font-weight: 700;
    }

    .oe-menu-cart-view-btn {
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 700;
    }

    .oe-menu-cart-item-remove {
        width: 24px;
        height: 24px;
        font-size: 16px;
        opacity: 1;
    }

    .oe-menu-cart-total-text {
        font-size: 14px;
        font-weight: 600;
    }
}

/* Mobile - Small (480px and below) */
@media (max-width: 480px) {
    .oe-menu-cart-dropdown {
        position: fixed !important;
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
        transform: translateY(-10px) !important;
    }
    
    .oe-menu-cart-wrapper:hover .oe-menu-cart-dropdown,
    .oe-menu-cart-dropdown:hover,
    .oe-menu-cart-dropdown.active {
        transform: translateY(0) !important;
    }

    .oe-menu-cart-dropdown-inner::before {
        display: none !important;
    }

    .oe-menu-cart-toggle {
        gap: 6px;
    }

    .oe-menu-cart-subtotal {
        font-size: 13px;
    }

    .oe-menu-cart-items {
        max-height: 260px;
        padding: 10px;
    }

    .oe-menu-cart-header,
    .oe-menu-cart-footer {
        padding: 10px 12px;
    }

    .oe-menu-cart-item {
        gap: 8px;
        padding: 8px;
    }

    .oe-menu-cart-item-image {
        width: 55px;
        height: 55px;
    }

    .oe-menu-cart-item-title {
        font-size: 12px;
    }

    .oe-menu-cart-item-price {
        font-size: 12px;
    }

    .oe-menu-cart-title {
        font-size: 13px;
    }

    .oe-menu-cart-view-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .oe-menu-cart-item-remove {
        width: 22px;
        height: 22px;
        font-size: 15px;
    }
}

/* Mobile - Extra Small (375px and below) */
@media (max-width: 375px) {
    .oe-menu-cart-dropdown {
        width: calc(100vw - 16px);
        right: auto;
        left: 50%;
    }

    .oe-menu-cart-item-image {
        width: 50px;
        height: 50px;
    }

    .oe-menu-cart-item-title {
        font-size: 11px;
    }

    .oe-menu-cart-item-price {
        font-size: 11px;
    }

    .oe-menu-cart-view-btn {
        padding: 9px 12px;
        font-size: 12px;
    }
}

/* ========================================
   RTL Support
======================================== */
[dir="rtl"] .oe-menu-cart-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .oe-menu-cart-dropdown::before {
    right: auto;
    left: 20px;
}

/* ========================================
   Loading State
======================================== */
.oe-menu-cart-wrapper.loading .oe-menu-cart-icon {
    opacity: 0.6;
}

.oe-menu-cart-wrapper.loading .oe-menu-cart-icon::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #FF6B6B;
    border-top-color: transparent;
    border-radius: 50%;
    animation: oe-spin 0.6s linear infinite;
}

@keyframes oe-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   WooCommerce Compatibility
======================================== */
.oe-menu-cart-item-price .amount {
    font-weight: inherit;
}

.oe-menu-cart-item-price del {
    opacity: 0.7;
    margin-right: 5px;
}

.oe-menu-cart-item-price ins {
    text-decoration: none;
}

/* ========================================
   CRITICAL: Mobile Center Override
======================================== */
@media (max-width: 768px) {
    /* Force fixed position centered on mobile */
    .elementor-widget-one-menu-cart .oe-menu-cart-dropdown,
    .oe-menu-cart-wrapper .oe-menu-cart-dropdown {
        position: fixed !important;
        top: 80px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: 400px !important;
        margin: 0 auto !important;
        transform: translateY(-10px) !important;
    }
    
    .elementor-widget-one-menu-cart .oe-menu-cart-wrapper:hover .oe-menu-cart-dropdown,
    .elementor-widget-one-menu-cart .oe-menu-cart-dropdown:hover,
    .elementor-widget-one-menu-cart .oe-menu-cart-dropdown.active,
    .oe-menu-cart-wrapper:hover .oe-menu-cart-dropdown,
    .oe-menu-cart-dropdown:hover,
    .oe-menu-cart-dropdown.active {
        transform: translateY(0) !important;
    }
    
    /* Hide arrow on mobile */
    .oe-menu-cart-dropdown-inner::before {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .elementor-widget-one-menu-cart .oe-menu-cart-dropdown,
    .oe-menu-cart-wrapper .oe-menu-cart-dropdown {
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;
        max-width: none !important;
    }
}