/**
 * WooFood Modern Mini Cart Styles
 * 
 * Modern, responsive mini cart with multiple style variations
 */

/* ====================================
   MINI CART WRAPPER
   ==================================== */

.woofood-mini-cart-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.woofood-mini-cart-wrapper.modern {
    background: #ffffff;
}
y
.woofood-mini-cart-wrapper.classic {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 4px;
}

.woofood-mini-cart-wrapper.minimal {
    background: #ffffff;
    border: none;
    border-left: 4px solid var(--woofood-primary-color, #ff6b35);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ====================================
   HEADER SECTION
   ==================================== */

.woofood-mini-cart-header {
    padding: 16px 20px;
    background: var(--woofood-primary-color, #ff6b35);
    color: var(--woofood-header-text-color, #ffffff);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.woofood-mini-cart-wrapper.classic .woofood-mini-cart-header {
    background: #343a40;
    border-radius: 0;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-header {
    background: transparent;
    color: var(--woofood-text-color, #333333);
    border-bottom: 1px solid #e5e7eb;
}

.woofood-mini-cart-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.woofood-cart-count {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.woofood-mini-cart-wrapper.minimal .woofood-cart-count {
    background: var(--woofood-primary-color, #ff6b35);
    color: white;
}

.woofood-cart-toggle {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.woofood-cart-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.woofood-cart-toggle .toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.woofood-cart-toggle[aria-expanded="false"] .toggle-icon {
    transform: rotate(180deg);
}

/* ====================================
   CONTENT SECTION
   ==================================== */

.woofood-mini-cart-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.woofood-mini-cart-wrapper.collapsible .woofood-mini-cart-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.woofood-mini-cart-items {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-items {
    padding: 16px;
}

/* ====================================
   INDIVIDUAL CART ITEMS
   ==================================== */

.woofood-mini-cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    align-items: flex-start;
    flex-wrap: wrap;
}

.woofood-mini-cart-item:last-child {
    border-bottom: none;
}

.woofood-mini-cart-item:hover {
    background: #f8fafc;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-item {
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-item:hover {
    background: #f9fafb;
}

/* Item Thumbnail */
.item-thumbnail {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
}

.item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.item-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Item Details */
.item-details {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--woofood-text-color, #374151);
}

.item-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.item-name a:hover {
    color: var(--woofood-primary-color, #ff6b35);
}

.item-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.meta-item {
    display: flex;
    gap: 4px;
    margin-bottom: 2px;
}

.meta-key {
    font-weight: 500;
}

.item-price-quantity {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* Quantity Controls */
.item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border-radius: 6px;
    padding: 4px;
}

.quantity-btn {
    background: var(--woofood-primary-color, #ff6b35);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    line-height: 1;
}

.quantity-btn:hover {
    background: var(--woofood-accent-color, #e74c3c);
}

.quantity-number {
    font-weight: 500;
    font-size: 14px;
    min-width: 20px;
    text-align: center;
    color: var(--woofood-text-color, #374151);
}

.item-price {
    font-weight: 600;
    color: var(--woofood-secondary-color, #cc8800);
    font-size: 14px;
}

/* Remove Button */
.item-remove {
    flex-shrink: 0;
}

.remove-item {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.remove-item:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

/* ====================================
   SUBTOTAL SECTION
   ==================================== */

.woofood-mini-cart-subtotal {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-subtotal {
    background: transparent;
    border-top: 1px solid #e5e7eb;
    padding: 16px;
}

.subtotal-row,
.tax-row,
.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.total-row {
    margin-bottom: 0;
    padding-top: 8px;
    border-top: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 16px;
}

.subtotal-label,
.tax-label,
.total-label {
    color: var(--woofood-text-color, #374151);
}

.subtotal-amount,
.tax-amount,
.total-amount {
    font-weight: 600;
    color: var(--woofood-secondary-color, #cc8800);
}

.total-amount {
    color: var(--woofood-primary-color, #ff6b35);
    font-size: 18px;
}

/* ====================================
   ACTION BUTTONS
   ==================================== */

.woofood-mini-cart-actions {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    background: #ffffff;
}

.woofood-mini-cart-wrapper.minimal .woofood-mini-cart-actions {
    padding: 16px;
}

.woofood-cart-button {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: inline-block;
}

.woofood-cart-button.view-cart {
    background: transparent;
    color: var(--woofood-primary-color, #ff6b35);
    border: 2px solid var(--woofood-primary-color, #ff6b35);
}

.woofood-cart-button.view-cart:hover {
    background: var(--woofood-primary-color, #ff6b35);
    color: white;
}

.woofood-cart-button.checkout {
    background: var(--woofood-primary-color, #ff6b35);
    color: white;
    border: 2px solid var(--woofood-primary-color, #ff6b35);
}

.woofood-cart-button.checkout:hover {
    background: var(--woofood-accent-color, #e74c3c);
    border-color: var(--woofood-accent-color, #e74c3c);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* ====================================
   EMPTY CART STATE
   ==================================== */

.woofood-mini-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-cart-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-message {
    font-size: 16px;
    margin-bottom: 20px;
    color: var(--woofood-text-color, #374151);
}

.woofood-cart-button.continue-shopping {
    background: var(--woofood-primary-color, #ff6b35);
    color: white;
    border: none;
    padding: 12px 24px;
    display: inline-block;
    margin: 0 auto;
}

.woofood-cart-button.continue-shopping:hover {
    background: var(--woofood-accent-color, #e74c3c);
    transform: translateY(-2px);
}

/* ====================================
   ERROR STATE
   ==================================== */

.woofood-mini-cart-error {
    padding: 20px;
    text-align: center;
    color: #dc2626;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-weight: 500;
}

/* ====================================
   LOADING STATES
   ==================================== */

.woofood-mini-cart-loading {
    opacity: 0.6;
    pointer-events: none;
}

.woofood-mini-cart-loading .woofood-mini-cart-items::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid var(--woofood-primary-color, #ff6b35);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Sticky Cart Styles - Mobile Only */
@media (max-width: 768px) {
    .woofood-mini-cart-wrapper.sticky-cart {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        transform: translateY(0);
        transition: transform 0.3s ease;
    }

    .woofood-mini-cart-wrapper.sticky-cart.hidden {
        transform: translateY(100%);
    }

    /* Sticky Cart Bar */
    .woofood-sticky-cart-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: var(--woofood-primary-color, #ff6b35);
        color: white;
        cursor: pointer;
        transition: background 0.3s ease;
    }

    .woofood-sticky-cart-bar:hover {
        background: var(--woofood-accent-color, #e55a2b);
    }

    .sticky-cart-summary {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .sticky-cart-summary .cart-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sticky-cart-summary .cart-count {
        font-size: 14px;
        font-weight: 500;
        opacity: 0.9;
        white-space: nowrap;
        display: none;
        line-height: 1.2;
    }

    .sticky-cart-summary .cart-total {
        font-size: 18px;
        font-weight: 700;
        display: block;
        line-height: 1.2;
    }
}

/* Desktop - Regular display for sticky carts */
@media (min-width: 769px) {
    .woofood-mini-cart-wrapper.sticky-cart {
        position: static;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
    }
    
    .woofood-sticky-cart-bar {
        display: none;
    }
    
    .woofood-sticky-cart-content {
        display: block !important;
    }
    
    .sticky-cart-header {
        display: none;
    }
    
    .sticky-cart-close {
        display: none;
    }
    
    /* Ensure regular header shows with primary color */
    .woofood-mini-cart-wrapper.sticky-cart .woofood-mini-cart-header {
        display: flex;
        background: var(--woofood-primary-color, #ff6b35);
        color: var(--woofood-header-text-color, #ffffff);
    }
    
    /* Hide collapsible button on desktop sticky carts unless specifically set as collapsible */
    .woofood-mini-cart-wrapper.sticky-cart:not(.collapsible) .woofood-cart-toggle {
        display: none;
    }
}

.sticky-cart-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.woofood-sticky-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.woofood-sticky-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.woofood-sticky-toggle .toggle-icon {
    transition: transform 0.3s ease;
}

.woofood-sticky-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(180deg);
}

.continue-shopping-sticky {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.continue-shopping-sticky:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Sticky Cart Content */
.woofood-sticky-cart-content {
    background: white;
    max-height: 70vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sticky-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--woofood-primary-color, #ff6b35);
        color: var(--woofood-header-text-color, #ffffff);

    border-bottom: 1px solid #e2e8f0;
}

.sticky-cart-header .woofood-mini-cart-title {
     color: var(--woofood-header-text-color, #ffffff);

    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.sticky-cart-close {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;

    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sticky-cart-close:hover {
    background: #fecaca;
    transform: scale(1.1);
}

/* Sticky Cart Actions */
.woofood-mini-cart-actions.sticky-actions {
    padding: 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
}

.woofood-mini-cart-actions.sticky-actions .woofood-cart-button {
    flex: 1;
    text-align: center;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.woofood-mini-cart-actions.sticky-actions .woofood-cart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mobile Optimizations for Sticky Cart */
@media (max-width: 768px) {
    .woofood-sticky-cart-bar {
        padding: 12px 16px;
    }
    
    .sticky-cart-summary .cart-icon {
        font-size: 20px;
    }
    
    .sticky-cart-summary .cart-total {
        font-size: 16px;
    }
    
    .woofood-sticky-toggle,
    .continue-shopping-sticky {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .woofood-sticky-cart-content {
        max-height: 60vh;
    }
    
    .sticky-cart-header {
        padding: 12px 16px;
    }
    
    .sticky-cart-header .woofood-mini-cart-title {
        font-size: 16px;
    }
    
    .woofood-mini-cart-actions.sticky-actions {
        padding: 16px;
        flex-direction: column;
    }
    
    .woofood-mini-cart-actions.sticky-actions .woofood-cart-button {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Responsive adjustments for sticky cart items */
@media (max-width: 480px) {
    .woofood-sticky-cart-bar {
        padding: 10px 12px;
    }
    
    .sticky-cart-summary {
        gap: 8px;
    }
    
    .sticky-cart-summary .cart-count {
        font-size: 12px;
    }
    
    .sticky-cart-summary .cart-total {
        font-size: 14px;
    }
    
    .woofood-sticky-cart-content .woofood-mini-cart-item {
        padding: 8px 12px;
    }
    
    .woofood-sticky-cart-content .item-thumbnail {
        width: 40px;
        height: 40px;
    }
}

/* Dark mode support for sticky cart */
@media (prefers-color-scheme: dark) {
    .woofood-mini-cart-wrapper.sticky-cart {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .woofood-sticky-cart-content {
        background: #1f2937;
    }
    
    .sticky-cart-header {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .sticky-cart-header .woofood-mini-cart-title {
        color: #f9fafb;
    }
    
    .woofood-mini-cart-actions.sticky-actions {
        background: #374151;
        border-color: #4b5563;
    }
}

/* Ensure sticky cart doesn't interfere with other elements */
body.has-sticky-cart {
    padding-bottom: 80px;
}

/* Animation for cart updates */
.woofood-mini-cart-wrapper.sticky-cart.updating .woofood-sticky-cart-bar {
    opacity: 0.7;
    pointer-events: none;
}

.woofood-mini-cart-wrapper.sticky-cart.updating .sticky-cart-summary .cart-icon {
    animation: spin 1s linear infinite;
}

/* ====================================
   RESPONSIVE DESIGN
   ==================================== */

@media (max-width: 768px) {
    .woofood-mini-cart-wrapper {
        margin-bottom: 16px;
    }
    
    .woofood-mini-cart-header {
        padding: 12px 16px;
    }
    
    .woofood-mini-cart-title {
        font-size: 16px;
    }
    
    .woofood-mini-cart-items {
        padding: 8px;
    }
    
    .woofood-mini-cart-item {
        padding: 8px;
        gap: 8px;
    }
    
    .item-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    .item-name {
        font-size: 13px;
    }
    
    .item-meta {
        font-size: 11px;
    }
    
    .item-price {
        font-size: 13px;
    }
    
    .woofood-mini-cart-subtotal,
    .woofood-mini-cart-actions {
        padding: 12px 16px;
    }
    
    .woofood-cart-button {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .woofood-mini-cart-actions {
        flex-direction: column;
    }
    
    .total-amount {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .woofood-mini-cart-header {
        padding: 10px 12px;
    }
    
    .woofood-mini-cart-items {
        padding: 6px;
        max-height: 300px;
    }
    
    .woofood-mini-cart-item {
        padding: 6px;
    }
    
    .item-price-quantity {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ====================================
   WIDGET SPECIFIC STYLES
   ==================================== */

.widget .woofood-mini-cart-wrapper {
    margin-bottom: 0;
}

.widget .woofood-mini-cart-header {
    padding: 12px 16px;
}

.widget .woofood-mini-cart-title {
    font-size: 16px;
}

.widget .woofood-mini-cart-items {
    max-height: 300px;
}

/* ====================================
   BLOCK EDITOR SPECIFIC STYLES
   ==================================== */

.wp-block-woofood-mini-cart {
    margin: 20px 0;
}

.wp-block-woofood-mini-cart .woofood-mini-cart-wrapper {
    margin-bottom: 0;
}

/* ====================================
   ACCESSIBILITY
   ==================================== */

.woofood-cart-toggle:focus,
.quantity-btn:focus,
.remove-item:focus,
.woofood-cart-button:focus {
    outline: 2px solid var(--woofood-primary-color, #ff6b35);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .woofood-mini-cart-wrapper {
        border: 2px solid;
    }
    
    .woofood-mini-cart-item {
        border-bottom: 1px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .woofood-mini-cart-wrapper.modern {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .woofood-mini-cart-wrapper.classic {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .woofood-mini-cart-item:hover {
        background: #374151;
    }
    
    .woofood-mini-cart-subtotal {
        background: #111827;
        border-top-color: #374151;
    }
    
    .item-quantity {
        background: #374151;
    }
    
    .quantity-number {
        color: #f9fafb;
    }
    
    .item-name {
        color: #f9fafb;
    }
}
