/**
 * DUCHY Levering Badges Styling
 * Following DUCHY brand guidelines with accessibility considerations
 */

/* Base badge styling */
.duchy-fulfillment-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    margin: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid transparent;
    line-height: 1.2;
}

/* DUCHY badge - Decree Black background, Crown White text */
.duchy-fulfillment-badge.duchy {
    background-color: #1a1a1a; /* Decree Black */
    color: #fafafa; /* Crown White */
}

/* PARTNER badge - Burnt Orange background, Crown White text */
.duchy-fulfillment-badge.partner {
    background-color: #d2691e; /* Burnt Orange */
    color: #fafafa; /* Crown White */
}

/* Hover states for accessibility */
.duchy-fulfillment-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-color: #fafafa;
}

/* Focus states for keyboard navigation (accessibility) */
.duchy-fulfillment-badge:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

/* Screen reader only text for accessibility */
.duchy-badge-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Mixed cart banner styling */
.duchy-mixed-cart-banner {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.duchy-mixed-cart-banner .banner-icon {
    display: inline-block;
    margin-right: 8px;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .duchy-fulfillment-badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* High contrast mode support (accessibility) */
@media (prefers-contrast: high) {
    .duchy-fulfillment-badge.duchy {
        border: 2px solid #fafafa;
    }
    
    .duchy-fulfillment-badge.partner {
        border: 2px solid #fafafa;
    }
}

/* Reduced motion support (accessibility) */
@media (prefers-reduced-motion: reduce) {
    .duchy-fulfillment-badge {
        transition: none;
    }
    
    .duchy-fulfillment-badge:hover {
        transform: none;
    }
}

/* Click feedback animation */
.duchy-badge-clicked {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Mixed cart banner highlight animation */
.duchy-banner-highlight {
    animation: duchy-highlight 3s ease-in-out;
}

@keyframes duchy-highlight {
    0%, 100% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
}

/* Context-specific badge positioning */
.duchy-product-badge-wrapper {
    display: inline-block;
}

.duchy-shop-badge-wrapper {
    text-align: center;
    margin-top: 8px;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .duchy-mixed-cart-banner {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .duchy-fulfillment-badge {
        font-size: 10px;
        padding: 2px 5px;
    }
}

/* Enhanced mixed cart banner styling */
.duchy-enhanced-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #d2691e;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(210, 105, 30, 0.1);
}

.duchy-banner-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 16px;
}

.duchy-banner-header .banner-icon {
    font-size: 20px;
    margin-right: 10px;
}

.duchy-banner-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Delivery breakdown styling */
.duchy-delivery-breakdown {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.duchy-delivery-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid rgba(210, 105, 30, 0.2);
    flex: 1;
    min-width: 200px;
}

.duchy-delivery-info {
    font-size: 13px;
    line-height: 1.3;
}

.duchy-delivery-info strong {
    color: #333;
}

.duchy-delivery-info small {
    color: #666;
}

/* Small badge variant for delivery breakdown */
.duchy-fulfillment-badge.small {
    font-size: 10px;
    padding: 3px 6px;
    min-width: 45px;
    text-align: center;
}

/* Banner actions */
.duchy-banner-actions {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(210, 105, 30, 0.2);
}

.duchy-banner-link {
    color: #d2691e;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.3s ease;
}

.duchy-banner-link:hover {
    color: #1a1a1a;
    text-decoration: underline;
}

.duchy-separate-orders {
    font-style: italic;
    opacity: 0.7;
    cursor: not-allowed;
}

/* Delivery summary in cart totals */
.duchy-delivery-summary th,
.duchy-delivery-summary td {
    padding: 8px 12px;
    border-bottom: 1px solid #e0e0e0;
}

.duchy-delivery-estimate {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 13px;
}

/* Mobile responsiveness for enhanced banner */
@media (max-width: 768px) {
    .duchy-delivery-breakdown {
        flex-direction: column;
        gap: 10px;
    }
    
    .duchy-delivery-item {
        min-width: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .duchy-enhanced-banner {
        padding: 12px 16px;
    }
    
    .duchy-banner-header {
        font-size: 14px;
    }
    
    .duchy-banner-content p {
        font-size: 13px;
    }
}

/* Animation for enhanced banner */
.duchy-enhanced-banner {
    animation: duchy-slide-in 0.5s ease-out;
}

@keyframes duchy-slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    .duchy-enhanced-banner {
        border-width: 3px;
        background: #fff3cd;
    }
    
    .duchy-delivery-item {
        border-width: 2px;
        background-color: #ffffff;
    }
}

/* CSS-based badges using data attributes for cart/checkout */
tr[data-fulfillment="duchy"]::after,
.cart_item[data-fulfillment="duchy"]::after {
    content: "DUCHY";
    background-color: #1a1a1a;
    color: #fafafa;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}

tr[data-fulfillment="partner"]::after,
.cart_item[data-fulfillment="partner"]::after {
    content: "PARTNER";
    background-color: #d2691e;
    color: #fafafa;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 3px;
    margin-left: 8px;
    display: inline-block;
    vertical-align: middle;
}

/* BUG FIXES */

/* Fix admin column width */
.wp-admin table.wp-list-table .column-duchy_fulfillment {
    width: 100px;
    text-align: center;
}

.wp-admin .column-duchy_fulfillment .duchy-fulfillment-badge {
    font-size: 10px;
    padding: 2px 5px;
}


/* Smaller badges for mini-cart/side-cart */
.woocommerce-mini-cart .duchy-fulfillment-badge,
.widget_shopping_cart .duchy-fulfillment-badge {
    font-size: 9px !important;
    padding: 2px 4px !important;
    margin: 2px 0 0 5px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}