/**
 * WooCommerce Navigation Integration Styles
 * Styles for header cart, mini cart dropdown, and navigation elements
 * 
 * @package MM_Dispensary
 * @version 1.0.0
 */

/* ===== HEADER CART INTEGRATION ===== */

/* Cart icon with count */
.nav-cart .cart-toggle {
    position: relative;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.nav-cart .cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color, #ff6b35);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    min-width: 20px;
}

.nav-cart .cart-count.hidden {
    display: none;
}

/* Account label for logged-in users */
.nav-account .account-label {
    display: none;
    margin-left: 5px;
    font-size: 12px;
}

@media (min-width: 768px) {
    .nav-account .account-label {
        display: inline;
    }
}

/* ===== MINI CART DROPDOWN ===== */

/* Mini cart container */
.mini-cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.mini-cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mini cart header */
.mini-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-color, #ff6b35);
    color: white;
}

.mini-cart-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mini-cart-close {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.mini-cart-close:hover {
    opacity: 1;
}

/* Mini cart loading state */
.mini-cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    color: #666;
}

.mini-cart-loading .icon-spinner {
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
    font-size: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mini cart empty state */
.mini-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.mini-cart-empty .icon-bag-empty {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.mini-cart-empty p {
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* Mini cart items */
.mini-cart-items {
    max-height: 300px;
    overflow-y: auto;
}

.mini-cart-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.mini-cart-item:hover {
    background-color: #f9f9f9;
}

.mini-cart-item:last-child {
    border-bottom: none;
}

.mini-cart-item-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    flex-shrink: 0;
}

.mini-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.mini-cart-item-details {
    flex: 1;
    min-width: 0;
}

.mini-cart-item-title {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.mini-cart-item-title a {
    color: inherit;
    text-decoration: none;
}

.mini-cart-item-title a:hover {
    color: var(--primary-color, #ff6b35);
}

.mini-cart-item-price {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color, #ff6b35);
    margin-bottom: 3px;
}

.mini-cart-item-quantity {
    font-size: 12px;
    color: #666;
}

.mini-cart-item-remove {
    margin-left: 10px;
    flex-shrink: 0;
}

.mini-cart-item-remove .remove {
    display: block;
    width: 24px;
    height: 24px;
    background: #f0f0f0;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    color: #666;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.2s;
}

.mini-cart-item-remove .remove:hover {
    background: #ff4444;
    color: white;
}

/* Mini cart footer */
.mini-cart-footer {
    padding: 20px;
    border-top: 1px solid #f0f0f0;
    background: #f9f9f9;
}

.mini-cart-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.mini-cart-actions {
    display: flex;
    gap: 10px;
}

.mini-cart-actions .btn {
    flex: 1;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.mini-cart-actions .btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color, #ff6b35);
    color: var(--primary-color, #ff6b35);
}

.mini-cart-actions .btn-outline:hover {
    background: var(--primary-color, #ff6b35);
    color: white;
}

.mini-cart-actions .btn-primary {
    background: var(--primary-color, #ff6b35);
    border: 2px solid var(--primary-color, #ff6b35);
    color: white;
}

.mini-cart-actions .btn-primary:hover {
    background: #e55a2b;
    border-color: #e55a2b;
}

/* ===== CART MESSAGES ===== */

/* Cart message notifications */
.cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.cart-message.show {
    transform: translateX(0);
}

.cart-message-success {
    background: #28a745;
}

.cart-message-error {
    background: #dc3545;
}

/* ===== NAVIGATION INTEGRATION ===== */

/* WooCommerce menu items */
.menu-item .item-link {
    transition: color 0.2s;
}

.menu-item:hover .item-link {
    color: var(--primary-color, #ff6b35);
}

/* Shop and Categories menu items */
.menu-item a[href*="/shop/"],
.menu-item a[href*="/categories/"] {
    position: relative;
}

/*.menu-item a[href*="/shop/"]:after,
.menu-item a[href*="/categories/"]:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color, #ff6b35);
    transition: width 0.3s ease;
}*/

.menu-item a[href*="/shop/"]:hover:after,
.menu-item a[href*="/categories/"]:hover:after {
    width: 100%;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Mobile styles */
@media (max-width: 767px) {
    .mini-cart-dropdown {
        width: calc(100vw - 40px);
        right: -20px;
        max-width: 350px;
    }
    
    .nav-account .account-label {
        display: none;
    }
    
    .mini-cart-item {
        padding: 12px 15px;
    }
    
    .mini-cart-item-image {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }
    
    .mini-cart-header,
    .mini-cart-footer {
        padding: 12px 15px;
    }
    
    .mini-cart-actions {
        flex-direction: column;
        gap: 8px;
    }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
    .mini-cart-dropdown {
        width: 320px;
    }
}

/* Desktop enhancements */
@media (min-width: 1024px) {
    .mini-cart-dropdown {
        width: 380px;
    }
    
    .mini-cart-items {
        max-height: 350px;
    }
}

/* ===== LOADING STATES ===== */

/* Loading spinner for buttons */
.loading {
    position: relative;
    pointer-events: none;
}

.loading:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading .icon {
    opacity: 0;
}

/* ===== ACCESSIBILITY ===== */

/* Focus states */
.nav-cart .cart-toggle:focus,
.mini-cart-close:focus,
.mini-cart-item-remove .remove:focus {
    outline: 2px solid var(--primary-color, #ff6b35);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
