/* =========================================
   PREMIUM DIGITAL MINI-CART (Final Polish)
   ========================================= */

/* 1. Header Cart Icon (Refined) */
.wd-header-cart {
    display: inline-flex;
    align-items: center;
    position: relative;
    color: #111827;
    text-decoration: none;
    margin-right: 20px;
    margin-left: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.wd-header-cart:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.wd-header-cart .dashicons-cart {
    font-size: 24px;
    /* Refined size */
    width: 24px;
    height: 24px;
}

.wd-cart-count {
    position: absolute;
    top: 0px;
    right: -4px;
    background: #111827;
    /* Navy instead of Red for Premium feel */
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 99px;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wd-cart-count:empty {
    display: none;
}


/* 2. Mini-Cart Drawer (Slide-In) */
.wd-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 480px;
    /* Generous width */
    height: 100dvh;
    background: #ffffff;
    z-index: 99999;
    box-shadow: -20px 0 80px rgba(0, 0, 0, 0.2);
    /* Deep luxury shadow */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.4s;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
}

body.cart-is-open .wd-cart-drawer {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}

/* Overlay */
.wd-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.3);
    /* Navy tinted overlay */
    backdrop-filter: blur(2px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

body.cart-is-open .wd-cart-overlay {
    opacity: 1;
    visibility: visible;
}


/* 3. Header (Premium Layout) */
.wd-drawer-header {
    padding: 32px 32px 24px;
    /* More top padding */
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: #fff;
    flex-shrink: 0;
}

.wd-header-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wd-drawer-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    /* Large and confident */
    font-weight: 700;
    color: #111827;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.wd-header-subtitle {
    font-size: 0.85rem;
    color: #6B7280;
    font-weight: 400;
}

.wd-drawer-close {
    background: transparent;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    font-size: 24px;
    color: #9CA3AF;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 20px;
}

.wd-drawer-close:hover {
    background: #F9FAFB;
    color: #111;
    border-color: #D1D5DB;
    transform: rotate(90deg);
}


/* 4. EMAIL COUPON BLOCK (Compact Version) */
.wd-email-coupon-block {
    padding: 16px 24px;
    /* Reduced padding */
    background: #fff;
    border-bottom: 1px solid #F3F4F6;
    flex-shrink: 0;
}

/* Compact Container */
.wd-coupon-initial {
    background: #FAFAFA !important;
    border-radius: 8px !important;
    padding: 16px !important;
    /* Compact */
    border: 1px solid #F3F4F6 !important;
}

.wd-coupon-header {
    margin-bottom: 10px;
    /* Tighter */
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wd-coupon-title {
    font-size: 0.85rem;
    /* Smaller */
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.wd-coupon-subtitle {
    display: none;
    /* Hide subtitle for compactness per request */
}

/* Form Grid */
.wd-coupon-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    width: 100%;
}

.wd-coupon-input {
    width: 100%;
    padding: 0 12px !important;
    border: 1px solid #D1D5DB !important;
    border-radius: 6px !important;
    font-size: 0.85rem;
    background: #fff !important;
    height: 38px !important;
    /* Compact height */
    color: #111 !important;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.wd-coupon-input::placeholder {
    color: #9CA3AF;
}

.wd-coupon-input:focus {
    border-color: #111 !important;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
    /* Soft focus ring */
}

/* Navy Button */
.wd-coupon-btn {
    background: #111827 !important;
    color: #fff !important;
    padding: 0 16px !important;
    height: 38px !important;
    /* Compact height */
    border-radius: 6px !important;
    font-weight: 600;
    border: none !important;
    cursor: pointer;
    font-size: 0.8rem;
    transition: transform 0.1s, background 0.2s;
    white-space: nowrap;
}

.wd-coupon-btn:hover {
    background: #000 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wd-privacy-text {
    font-size: 0.7rem;
    color: #9CA3AF;
    margin: 12px 0 0 0;
    text-align: center;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Success State */
.wd-coupon-success {
    background: #F0FDF4;
    /* Green tint */
    border: 1px solid #DCFCE7;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: slideDownFade 0.4s ease;
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wd-success-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #166534;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.wd-success-msg .dashicons {
    color: #22C55E;
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.wd-applied-pill {
    display: inline-block;
    background: #fff;
    border: 1px dashed #22C55E;
    color: #15803D;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 99px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wd-success-micro {
    font-size: 0.8rem;
    color: #4B5563;
    margin: 0;
}


/* 5. Product List (STRUCTURAL FIX) */
.wd-cart-widget-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/*
   CRITICAL: Use display: contents to effectively "unwrap" the widget divs
   so the list becomes a direct flex child of the container.
   This prevents height collapsing issues.
*/
.wd-cart-widget-container .widget_shopping_cart,
.wd-cart-widget-container .widget_shopping_cart_content {
    display: contents !important;
}

/* The actual list */
.wd-cart-drawer .woocommerce-mini-cart {
    flex: 1 1 auto;
    /* Grow and Shrink */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 32px;
    margin: 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: #E5E7EB transparent;
    min-height: 200px;
    /* Force minimum visibility */
}

/* Separator Shadow for scrolling */
/* Optional: box-shadow to show scroll capability? 
   Clean design prefers simple border. */

.wd-cart-drawer .woocommerce-mini-cart-item {
    display: flex !important;
    padding-left: 0;
    padding-right: 0;
    flex-direction: column;
    justify-content: center;
    min-height: 90px;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #F3F4F6;
    position: relative;
    flex-shrink: 0;
    /* Don't squash items */
}

.wd-cart-drawer .woocommerce-mini-cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0px;
}

.wd-cart-drawer .woocommerce-mini-cart-item img {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0 !important;
    width: 80px !important;
    height: 80px !important;
    float: none !important;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #F3F4F6;
}

.wd-cart-drawer .woocommerce-mini-cart-item a:not(.remove) {
    width: 100%;
    padding-left: 100px !important;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-weight: 600;
    color: #111;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.4;
}

.wd-cart-drawer .quantity {
    display: block;
    color: #6B7280;
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 4px;
}

.wd-cart-drawer .woocommerce-mini-cart-item .remove {
    position: static;
    margin-left: auto;
    color: #9CA3AF;
    background: transparent;
    border: 1px solid #E5E7EB;
    border-radius: 50%;
    font-size: 14px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.wd-cart-drawer .woocommerce-mini-cart-item .remove:hover {
    color: #EF4444;
    border-color: #EF4444;
    background: #FEF2F2;
}


/* 6. Footer Totals & Buttons (Reference Style: Side-by-Side) */
.wd-cart-drawer .woocommerce-mini-cart__total {
    padding: 20px 32px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    margin-top: auto;
    flex-shrink: 0;
    z-index: 10;
}

.wd-cart-drawer .woocommerce-mini-cart__total strong {
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wd-cart-drawer .woocommerce-mini-cart__total .amount {
    font-family: 'Inter', sans-serif;
    /* Clean sans for total like reference */
    font-weight: 700;
    font-size: 1.25rem;
    color: #111;
}

/* Micro-copy No Hidden Fees */
/* Micro-copy No Hidden Fees */
/* Optional: We can't inject specific text easily via CSS unless standard, 
   but footer layout in PHP handles structure well. */

.wd-cart-drawer .woocommerce-mini-cart__buttons {
    padding: 0 32px 24px;
    margin: 0;
    background: #fff;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    /* Checkout slightly larger */
    gap: 12px;
    /* Space between buttons */
}

/* Standard Button Reset */
.wd-cart-drawer .woocommerce-mini-cart__buttons .button {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    height: 52px;
    /* Tall clickable area */
    border-radius: 8px;
    /* Slightly squarer like reference or rounded */
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
}

/* View Cart (Secondary) */
.wd-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout) {
    background: #fff;
    color: #111827;
    border: 1px solid #D1D5DB;
}

.wd-cart-drawer .woocommerce-mini-cart__buttons .button:not(.checkout):hover {
    border-color: #111;
    background: #F9FAFB;
}

/* Checkout (Primary - Navy) */
.wd-cart-drawer .woocommerce-mini-cart__buttons .button.checkout {
    background: #111827;
    color: #fff;
    border: 1px solid #111827;
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.15);
}

.wd-cart-drawer .woocommerce-mini-cart__buttons .button.checkout:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.25);
}

/* Remove Shimmer for cleaner reference look */
.wd-cart-drawer .woocommerce-mini-cart__buttons .button.checkout::before {
    display: none;
}

@keyframes btnShimmer {
    0% {
        left: -100%;
    }

    20% {
        left: 200%;
    }

    100% {
        left: 200%;
    }
}

/* 7. Trust Footer (Clean Digital) */
.wd-trust-badges {
    padding: 16px 32px 32px;
    background: #FAFAFA;
    border-top: 1px solid #F3F4F6;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wd-trust-row {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.wd-trust-row span {
    font-size: 0.75rem;
    color: #6B7280;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.wd-payment-icons {
    opacity: 0.5;
    font-size: 0.7rem;
    color: #9CA3AF;
    font-weight: 400;
    margin-top: 4px;
}

/* Empty State */
.woocommerce-mini-cart__empty-message {
    padding: 40px;
    text-align: center;
    color: #6B7280;
    font-size: 1rem;
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .wd-cart-drawer {
        max-width: 100%;
    }

    .wd-coupon-form {
        grid-template-columns: 1fr;
        /* Stack */
    }

    .wd-coupon-btn {
        width: 100%;
    }

    .wd-drawer-header,
    .wd-email-coupon-block,
    .wd-cart-drawer .woocommerce-mini-cart__total,
    .wd-cart-drawer .woocommerce-mini-cart__buttons {
        padding-left: 20px;
        padding-right: 20px;
    }
}