/**
 * WooCommerce Header Integration Styles for PickBox Theme
 * Responsive cart and account icons with dropdown functionality
 */

/* WooCommerce Header Icons Base Styles */
.header-woo-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-account,
.header-cart {
    position: relative;
}

.header-account a,
.header-cart a {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 6px;
}

.header-account a:hover,
.header-cart a:hover {
    background: rgba(0, 122, 112, 0.1);
    color: #007A70;
}

/* Account Icon Styles */
.header-account i {
    font-size: 1.25rem;
    margin-right: 0.25rem;
}

/* Cart Icon Styles */
.header-cart {
    cursor: pointer;
}

.header-cart i {
    font-size: 1.25rem;
    margin-right: 0.25rem;
}

/* Cart Count Badge */
.header-cart .cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    animation: bounceIn 0.3s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Cart Visibility States */
.header-cart.cart-empty {
    display: none;
}

.header-cart.cart-has-items {
    display: flex;
}

.header-cart.cart-has-items .cart-count {
    display: flex;
}

/* Cart Dropdown Styles */
.header-cart-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 500px;
    overflow: hidden;
}

.header-cart-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-cart-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

/* Cart Dropdown Content */
.cart-dropdown-content {
    padding: 1.5rem;
}

/* Cart Items */
.cart-items {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cart-item-image {
    flex-shrink: 0;
    margin-right: 1rem;
}

.cart-item-image img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.cart-item-details {
    flex-grow: 1;
    min-width: 0;
}

.cart-item-name {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
}

.cart-item-name a {
    color: #374151;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-item-name a:hover {
    color: #007A70;
}

.cart-item-quantity {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.cart-item-remove {
    flex-shrink: 0;
    margin-left: 1rem;
}

.cart-item-remove a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #9ca3af;
    font-size: 1.25rem;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.cart-item-remove a:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Cart Footer */
.cart-dropdown-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.cart-total {
    margin-bottom: 1rem;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #374151;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cart-actions .btn {
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s ease;
}

.cart-actions .btn-outline-primary {
    border: 2px solid #007A70;
    color: #007A70;
    background: transparent;
}

.cart-actions .btn-outline-primary:hover {
    background: #007A70;
    color: white;
}

.cart-actions .btn-primary {
    background: #007A70;
    border: 2px solid #007A70;
    color: white;
}

.cart-actions .btn-primary:hover {
    background: #006157;
    border-color: #006157;
}

/* Empty Cart Styles */
.empty-cart {
    text-align: center;
    padding: 2rem 1.5rem;
    color: #6b7280;
}

.empty-cart p {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* Cart Dropdown Overlay */
.cart-dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.cart-dropdown-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-cart-dropdown {
        width: 320px;
    }
}

@media (max-width: 768px) {
    .header-cart-dropdown {
        width: 300px;
        right: -50px;
        max-height: 400px;
    }
    
    .account-text,
    .cart-text {
        display: none !important;
    }
    
    .header-woo-actions {
        gap: 0.5rem;
    }
    
    .header-account a,
    .header-cart a {
        padding: 0.375rem;
    }
    
    .header-account i,
    .header-cart i {
        font-size: 1.125rem;
        margin-right: 0;
    }
}

@media (max-width: 576px) {
    .header-cart-dropdown {
        width: 280px;
        right: -80px;
        left: auto;
        transform-origin: top right;
    }
    
    .cart-dropdown-content {
        padding: 1rem;
    }
    
    .cart-item-image img {
        width: 50px;
        height: 50px;
    }
    
    .header-cart-dropdown::before {
        right: 90px;
    }
}

@media (max-width: 400px) {
    .header-cart-dropdown {
        width: 260px;
        right: -100px;
    }
    
    .header-cart-dropdown::before {
        right: 110px;
    }
}

/* Sticky Header Adjustments */
.header__sticky .header-cart .cart-count {
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    font-size: 9px;
    line-height: 16px;
}

.header__sticky .header-cart-dropdown {
    width: 300px;
}

.header__sticky .header-account i,
.header__sticky .header-cart i {
    font-size: 1rem;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
    .header-cart-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .header-cart-dropdown::before {
        background: #1f2937;
        border-color: #374151;
    }
    
    .cart-item {
        border-color: #374151;
    }
    
    .cart-item-name a {
        color: #f3f4f6;
    }
    
    .cart-item-quantity {
        color: #9ca3af;
    }
    
    .cart-total {
        color: #f3f4f6;
    }
    
    .cart-dropdown-footer {
        border-color: #374151;
    }
    
    .empty-cart {
        color: #9ca3af;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header-cart .cart-count {
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* Print Styles */
@media print {
    .header-woo-actions,
    .header-cart-dropdown,
    .cart-dropdown-overlay {
        display: none !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .header-cart-dropdown,
    .cart-dropdown-overlay,
    .header-account a,
    .header-cart a,
    .cart-count {
        transition: none;
    }
    
    .cart-count {
        animation: none;
    }
}

/* Focus Styles for Accessibility */
.header-account a:focus,
.header-cart a:focus,
.cart-item-name a:focus,
.cart-item-remove a:focus,
.cart-actions .btn:focus {
    outline: 2px solid #007A70;
    outline-offset: 2px;
}

/* Custom Scrollbar for Cart Items */
.cart-items::-webkit-scrollbar {
    width: 6px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
