/*
 * Header Cart Styles for GrandPrix Theme
 * Author: Claude Code
 * Description: Styles for WooCommerce dropdown cart in header
 */

/* ==========================================================================
   Header Cart Container
   ========================================================================== */

.mkdf-shopping-cart-holder {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin: 0 15px 0 0;
}

.mkdf-shopping-cart-inner {
    position: relative;
}

/* ==========================================================================
   Cart Icon & Opener
   ========================================================================== */

.mkdf-sc-opener {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #000;
    font-size: 16px;
    line-height: 1;
    transition: all 0.3s ease;
    position: relative;
    padding: 8px;
    border-radius: 4px;
}

.mkdf-sc-opener:hover {
    color: #ed1d24;
    background-color: rgba(237, 29, 36, 0.1);
}

.mkdf-sc-opener-icon {
    display: inline-block;
    font-size: 20px;
    line-height: 1;
    margin-right: 5px;
}

.mkdf-sc-opener-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    background: #ed1d24;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 0 4px;
    line-height: 1;
}

/* Hide count when cart is empty */
.mkdf-sc-opener-count:empty,
.mkdf-sc-opener-count[data-count="0"] {
    display: none;
}

/* ==========================================================================
   Cart Dropdown
   ========================================================================== */

.mkdf-sc-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 10px;
}

/* Desktop hover behavior */
@media (min-width: 769px) {
    .mkdf-shopping-cart-holder:not(.mkdf-mobile-cart):hover .mkdf-sc-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* JavaScript-controlled visibility */
.mkdf-shopping-cart-holder.mkdf-cart-opened .mkdf-sc-dropdown,
.mkdf-sc-dropdown.mkdf-visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    .mkdf-shopping-cart-holder.mkdf-mobile-cart .mkdf-sc-dropdown {
        position: fixed;
        top: 60px !important;
        right: 10px;
        left: 10px;
        width: auto;
        z-index: 9999;
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* Force proper styling on all pages */
.mkdf-sc-dropdown {
    background: #fff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Ensure dropdown is never visible by default */
.mkdf-sc-dropdown:not(.mkdf-visible) {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
}

/* Fix z-index issues on specific pages */
.single-product .mkdf-sc-dropdown,
.woocommerce-page .mkdf-sc-dropdown,
.woocommerce-cart .mkdf-sc-dropdown,
.woocommerce-checkout .mkdf-sc-dropdown {
    z-index: 99999 !important;
}

.mkdf-sc-dropdown-inner {
    padding: 20px;
}

/* ==========================================================================
   Cart Items Loop
   ========================================================================== */

.mkdf-sc-product-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.mkdf-sc-product-list::-webkit-scrollbar {
    width: 4px;
}

.mkdf-sc-product-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.mkdf-sc-product-list::-webkit-scrollbar-thumb {
    background: #ed1d24;
    border-radius: 2px;
}

.mkdf-sc-product-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.mkdf-sc-product-item:last-child {
    border-bottom: none;
}

.mkdf-sc-product-image {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    margin-right: 10px;
    border-radius: 4px;
    overflow: hidden;
}

.mkdf-sc-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mkdf-sc-product-details {
    flex: 1;
    min-width: 0;
}

.mkdf-sc-product-title {
    font-size: 13px;
    font-weight: 500;
    color: #000;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mkdf-sc-product-title:hover {
    color: #ed1d24;
}

.mkdf-sc-product-price {
    font-size: 12px;
    color: #666;
    font-weight: 400;
}

.mkdf-sc-product-remove {
    flex-shrink: 0;
    margin-left: 10px;
}

.mkdf-sc-product-remove a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #f5f5f5;
    color: #999;
    text-decoration: none;
    border-radius: 50%;
    font-size: 12px;
    transition: all 0.3s ease;
}

.mkdf-sc-product-remove a:hover {
    background: #ed1d24;
    color: #fff;
}

/* ==========================================================================
   Cart Totals
   ========================================================================== */

.mkdf-sc-order-details {
    padding: 15px 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 15px;
}

.mkdf-sc-order-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 14px;
    color: #000;
}

/* ==========================================================================
   Cart Buttons
   ========================================================================== */

.mkdf-sc-buttons {
    display: flex;
    gap: 10px;
}

.mkdf-sc-cart-button,
.mkdf-sc-checkout-button {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    transition: all 0.3s ease;
    line-height: 1;
}

.mkdf-sc-cart-button {
    background: transparent;
    color: #000;
    border: 1px solid #e5e5e5;
}

.mkdf-sc-cart-button:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.mkdf-sc-checkout-button {
    background: #ed1d24;
    color: #fff;
    border: 1px solid #ed1d24;
}

.mkdf-sc-checkout-button:hover {
    background: #d41a21;
    border-color: #d41a21;
}

/* ==========================================================================
   Empty Cart
   ========================================================================== */

.mkdf-sc-empty-cart {
    text-align: center;
    padding: 20px 0;
}

.mkdf-sc-empty-cart-message {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.mkdf-sc-shop-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: #ed1d24;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mkdf-sc-shop-button:hover {
    background: #d41a21;
    color: #fff;
}

/* ==========================================================================
   Mobile Header Cart
   ========================================================================== */

.mkdf-mobile-cart-holder {
    display: inline-block;
    margin-right: 10px;
}

@media (max-width: 768px) {
    .mkdf-sc-dropdown {
        width: 280px;
        right: -20px;
    }
    
    .mkdf-sc-dropdown-inner {
        padding: 15px;
    }
    
    .mkdf-mobile-cart-holder .mkdf-shopping-cart-holder {
        margin: 0;
    }
    
    .mkdf-sc-opener {
        padding: 6px;
    }
    
    .mkdf-sc-opener-icon {
        font-size: 18px;
    }
    
    .mkdf-sc-opener-count {
        min-width: 16px;
        height: 16px;
        font-size: 10px;
        top: 1px;
        right: 1px;
    }
}

@media (max-width: 480px) {
    .mkdf-sc-dropdown {
        width: calc(100vw - 40px);
        right: -100px;
    }
    
    .mkdf-sc-buttons {
        flex-direction: column;
    }
    
    .mkdf-sc-product-item {
        padding: 8px 0;
    }
    
    .mkdf-sc-product-image {
        width: 40px;
        height: 40px;
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.mkdf-sc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.mkdf-sc-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* ==========================================================================
   Animation for count updates
   ========================================================================== */

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.mkdf-sc-opener-count.updated {
    animation: bounceIn 0.4s ease;
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .mkdf-sc-dropdown {
        border: 2px solid #000;
    }
    
    .mkdf-sc-opener:hover {
        background: #000;
        color: #fff;
    }
    
    .mkdf-sc-checkout-button,
    .mkdf-sc-shop-button {
        background: #000;
        border-color: #000;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .mkdf-sc-opener,
    .mkdf-sc-dropdown,
    .mkdf-sc-cart-button,
    .mkdf-sc-checkout-button,
    .mkdf-sc-shop-button,
    .mkdf-sc-product-remove a {
        transition: none;
    }
    
    .mkdf-sc-opener-count.updated {
        animation: none;
    }
}