/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
 */

/* ==========================================================================
   ISB Store - Cart Drawer Premium D2C Redesign Styles
   ========================================================================== */

/* 1. Drawer Size & Layout Wrappers */
.cart-widget-side {
    --wd-side-hidden-w: 480px;
    border-radius: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

@media (max-width: 991px) {
    .cart-widget-side {
        --wd-side-hidden-w: 400px;
    }
}

@media (max-width: 767px) {
    .cart-widget-side {
        --wd-side-hidden-w: 100%;
    }
}

/* Hide Parent Theme Header */
.cart-widget-side > .wd-heading {
    display: none !important;
}

/* Flex Container Setup */
.cart-widget-side .widget_shopping_cart,
.cart-widget-side .widget_shopping_cart_content {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff;
    overflow: hidden;
}

.d2c-cart-drawer-wrapper {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    overflow: hidden;
    position: relative;
}

/* Scroll Content */
.cart-widget-side .d2c-scroll-body {
    position: relative !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    overflow: hidden;
}

.cart-widget-side .wd-scroll-content {
    position: absolute;
    inset: 0;
    max-height: 100%;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding: 24px !important;
    display: flex;
    flex-direction: column;
}

/* 2. Redesigned Header */
.d2c-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    background: #ffffff;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01);
}

.d2c-cart-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.d2c-cart-count {
    font-size: 16px;
    color: #767676;
    font-weight: 500;
}

.d2c-close-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    color: #767676;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    outline: none;
    width: 40px;
    height: 40px;
    min-height: 40px;
}

.d2c-close-btn:hover {
    color: #111111;
    background: #f5f5f5;
    transform: rotate(90deg);
}

.d2c-close-btn:focus-visible {
    outline: 2px solid var(--wd-primary-color);
}

/* 3. Product Cards */
.d2c-products-wrapper {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.d2c-products-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.d2c-product-card {
    display: flex !important;
    gap: 16px;
    padding: 16px !important;
    background: #ffffff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 12px;
    position: relative;
    transition: all 0.25s ease;
    animation: d2c-fade-in 0.3s ease forwards;
}

.d2c-product-card:hover {
    border-color: #bbb !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.d2c-card-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    aspect-ratio: 1;
    border: 1px solid #f0f0f0;
}

.d2c-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.d2c-card-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.d2c-product-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
    margin: 0 28px 4px 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}

.d2c-product-name a {
    color: inherit;
    text-decoration: none;
}

.d2c-product-name a:hover {
    color: var(--wd-primary-color);
}

.d2c-product-meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 10px;
}

.d2c-product-meta .variation {
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.d2c-product-meta dt, .d2c-product-meta dd {
    margin: 0 !important;
    display: inline;
}

.d2c-product-meta dt {
    font-weight: 600;
}

.d2c-card-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

/* Close action link */
.d2c-remove-item {
    position: absolute !important;
    top: 12px;
    right: 12px;
    font-size: 20px;
    color: #bbb;
    text-decoration: none !important;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
    width: 28px;
    height: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 2;
}

.d2c-remove-item:hover {
    color: #ef4444 !important;
    background: #fee2e2;
}

/* Quantity Pill */
.d2c-quantity-pill {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 100px;
    overflow: hidden;
    padding: 2px;
    width: 92px;
    height: 32px;
    border: 1px solid #e5e5e5;
}

.d2c-qty-btn {
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    cursor: pointer !important;
    user-select: none !important;
    color: #555 !important;
    transition: background 0.2s ease !important;
    background: none !important;
    border: none !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 28px !important;
}

.d2c-qty-btn:hover {
    background: #e5e5e5 !important;
    color: #111111 !important;
}

.d2c-qty-input {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none !important;
    background: transparent !important;
    text-align: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #111111 !important;
    padding: 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield !important;
}

.d2c-qty-input::-webkit-outer-spin-button,
.d2c-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Product Card Price */
.d2c-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #111111;
}

.d2c-product-price ins {
    text-decoration: none;
    color: #e02424;
    font-weight: 700;
}

.d2c-product-price del {
    color: #888888;
    font-weight: 400;
    font-size: 13px;
    margin-right: 6px;
}

/* 4. Milestone / Savings Tracker */
.d2c-milestones-container {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 30px;
    flex-shrink: 0;
    box-shadow: none !important;
}

.d2c-milestones-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.d2c-milestones-title {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
    margin: 0;
    font-family: inherit;
}

.d2c-progress-message {
    font-size: 12px;
    color: #666666;
    line-height: 1.4;
    text-align: right;
}

.d2c-away-price {
    color: #111111;
    font-weight: 700;
}

.d2c-milestone-target {
    color: var(--wd-primary-color);
    font-weight: 700;
}

.d2c-progress-track-wrapper {
    position: relative;
    padding: 12px 12px 10px 12px;
    margin: 10px 0;
}

.d2c-progress-track {
    height: 4px;
    background: #e5e5e5;
    border-radius: 100px;
    position: relative;
}

.d2c-progress-fill {
    height: 100%;
    background: var(--wd-primary-color);
    border-radius: 100px;
    width: 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.d2c-milestone-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.d2c-marker-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #666666;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    user-select: none;
}

/* Unlocked progress states */
.d2c-marker-unlocked .d2c-marker-badge {
    background: var(--wd-primary-color) !important;
    border-color: var(--wd-primary-color) !important;
    color: #ffffff !important;
}

.d2c-milestone-labels-wrapper {
    position: relative;
    height: 32px;
    margin-top: 4px;
    padding: 0 12px;
}

.d2c-milestone-label-item {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    white-space: nowrap;
}

.d2c-milestone-labels-wrapper .d2c-milestone-label-item.d2c-label-last {
    transform: translateX(-100%) !important;
    text-align: right !important;
    align-items: flex-end !important;
}

.d2c-label-name {
    font-size: 11px;
    font-weight: 600;
    color: #777777;
    transition: color 0.3s ease;
}

.d2c-label-threshold {
    font-size: 9px;
    font-weight: 500;
    color: #999999;
    margin-top: 1px;
}

.d2c-label-unlocked .d2c-label-name {
    color: var(--wd-primary-color) !important;
    font-weight: 700 !important;
}

/* Green formatting for discounts in summary */
.d2c-discount-value {
    color: #10b981 !important;
    font-weight: 700 !important;
}

/* 5. You May Also Like */
.d2c-recommendations-container {
    margin-bottom: 24px;
    flex-shrink: 0;
}

.d2c-recommendations-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e1e1e;
    margin: 0 0 14px 0;
    font-family: inherit;
}

.d2c-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.d2c-recommendation-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.d2c-recommendation-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.d2c-rec-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
    aspect-ratio: 1;
    border: 1px solid #f0f0f0;
}

.d2c-rec-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.d2c-rec-info {
    flex: 1;
    min-width: 0;
}

.d2c-rec-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 4px 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}

.d2c-rec-title a {
    color: #1a1a1a;
    text-decoration: none;
}

.d2c-rec-title a:hover {
    color: var(--wd-primary-color);
}

.d2c-rec-price {
    font-size: 13px;
    font-weight: 700;
    color: #111111;
}

.d2c-rec-price del {
    color: #888888;
    font-size: 11px;
    font-weight: 400;
    margin-right: 4px;
}

.d2c-rec-price ins {
    text-decoration: none;
    color: #e02424;
}

.d2c-rec-action {
    flex-shrink: 0;
}

.d2c-rec-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 6px 14px !important;
    background: #ffffff !important;
    color: var(--wd-primary-color) !important;
    border: 1.5px solid var(--wd-primary-color) !important;
    border-radius: 100px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    height: 28px !important;
    line-height: 1 !important;
    text-transform: uppercase !important;
    min-height: unset !important;
    box-shadow: none !important;
    letter-spacing: 0.3px !important;
}

.d2c-rec-btn:hover {
    background: var(--wd-primary-color) !important;
    color: #ffffff !important;
}

/* 6. Summary Block */
.d2c-cart-summary {
    padding: 16px 0;
    border-top: 1px dashed #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    flex-shrink: 0;
}

.d2c-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #4b5563;
}

.d2c-summary-subtotal {
    font-weight: 700;
    color: #111111;
    font-size: 14px;
}

.d2c-summary-value {
    font-weight: 700;
    color: #111111;
}

.d2c-calc-checkout {
    font-style: italic;
    color: #888888;
}

/* 7. Checkout Sticky Footer */
.d2c-cart-footer {
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    padding: 20px 24px;
    flex-shrink: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04);
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.d2c-footer-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.d2c-footer-subtotal-label {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

.d2c-footer-subtotal-value {
    font-size: 18px;
    font-weight: 800;
    color: #111111;
}

.d2c-checkout-btn {
    width: 100% !important;
    height: 48px !important;
    background: var(--wd-primary-color) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 100px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-transform: uppercase !important;
    letter-spacing: 0.8px !important;
    box-shadow: 0 4px 12px rgba(131, 183, 53, 0.2) !important; /* Soft shadow */
}

.d2c-checkout-btn:hover {
    background: #111111 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(17, 17, 17, 0.15) !important;
}

.d2c-checkout-btn:active {
    transform: scale(0.98);
}

/* 8. Empty State layout */
.d2c-empty-cart-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto !important;
}

.d2c-empty-content-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 50px 0;
    flex: 1;
}

.d2c-empty-icon {
    color: #bbbbbb;
    margin-bottom: 20px;
}

.d2c-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    font-family: inherit;
}

.d2c-empty-desc {
    font-size: 14px;
    color: #666666;
    max-width: 300px;
    line-height: 1.5;
    margin: 0 0 24px 0;
}

.d2c-continue-shopping-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 30px !important;
    background: var(--wd-primary-color) !important;
    color: #ffffff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    border-radius: 100px !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    text-transform: uppercase !important;
    height: auto !important;
    letter-spacing: 0.5px !important;
}

.d2c-continue-shopping-btn:hover {
    background: #111111 !important;
    color: #ffffff !important;
}

.d2c-empty-recommendations {
    margin-top: 20px;
    border-top: 1px dashed #e5e5e5;
    padding-top: 24px;
}

/* 9. Spinner animations & fade enters */
@keyframes d2c-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in override compatibility */
.d2c-product-card.wd-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 12px;
    z-index: 5;
}

.d2c-product-card.wd-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--wd-primary-color);
    border-right-color: transparent;
    border-radius: 50%;
    animation: d2c-spin 0.6s linear infinite;
    z-index: 6;
}

@keyframes d2c-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Accessibility outline */
.d2c-checkout-btn:focus-visible,
.d2c-continue-shopping-btn:focus-visible,
.d2c-rec-btn:focus-visible,
.d2c-qty-btn:focus-visible,
.d2c-remove-item:focus-visible {
    outline: 2px solid var(--wd-primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   10. Responsiveness & Touch Targets
   ========================================================================== */

/* Expand touch target sizes to minimum 44px without changing visual dimensions */
.d2c-qty-btn {
    position: relative;
}
.d2c-qty-btn::before {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -8px;
    right: -8px;
    z-index: 10;
}

.d2c-remove-item {
    position: relative;
}
.d2c-remove-item::before {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -8px;
    right: -8px;
    z-index: 10;
}

/* Base adjustment for milestone labels wrap on all screen widths */
.d2c-milestone-label-item {
    white-space: normal !important;
    max-width: 70px;
    line-height: 1.1;
    z-index: 5;
}

.d2c-label-name {
    display: block;
    line-height: 1.2;
}

/* Prevent overlapping on recommendation cards */
.d2c-rec-title {
    max-width: 100%;
}

/* Breakpoint: Desktop (1025px+) */
@media (min-width: 1025px) {
    /* Keep existing desktop rules stable */
}

/* Breakpoint: Tablet & Medium (max-width: 1024px) */
@media (max-width: 1024px) {
    .d2c-milestones-container {
        margin-bottom: 20px;
    }
    .d2c-milestone-label-item {
        max-width: 55px;
    }
    .d2c-label-name {
        font-size: 9px;
    }
    .d2c-label-threshold {
        font-size: 9px;
        white-space: nowrap;
    }
}

/* Breakpoint: Mobile (max-width: 767px) */
@media (max-width: 767px) {
    .cart-widget-side .wd-scroll-content {
        padding: 16px !important;
    }
    .d2c-cart-header {
        padding: 16px !important;
    }
    .d2c-cart-footer {
        padding: 16px !important;
    }
    .d2c-products-wrapper {
        margin-bottom: 18px;
    }
    .d2c-product-card {
        padding: 12px 14px !important;
        gap: 12px;
    }
    .d2c-card-image {
        width: 64px;
        height: 64px;
    }
    .d2c-product-name {
        font-size: 13px;
        margin-right: 20px !important;
    }
    .d2c-quantity-pill {
        width: 82px;
        height: 28px;
        padding: 1px;
    }
    .d2c-qty-btn {
        width: 24px !important;
        height: 24px !important;
        min-height: 24px !important;
        font-size: 14px !important;
    }
    .d2c-qty-input {
        font-size: 12px !important;
    }
    .d2c-product-price {
        font-size: 14px;
    }
    
    /* Recommendations adjustments */
    .d2c-recommendations-container {
        margin-bottom: 18px;
    }
    .d2c-recommendation-card {
        padding: 10px !important;
        gap: 10px;
    }
    .d2c-rec-image {
        width: 48px;
        height: 48px;
    }
    .d2c-rec-title {
        font-size: 12px;
    }
    .d2c-rec-price {
        font-size: 12px;
    }
    .d2c-rec-btn {
        padding: 4px 10px !important;
        font-size: 10px !important;
        height: 26px !important;
    }
    
    /* Summary Block */
    .d2c-summary-row {
        font-size: 12px;
    }
    
    /* Footer */
    .d2c-checkout-btn {
        height: 44px !important;
        font-size: 14px !important;
    }
}

/* Breakpoint: Very Small Mobile Devices (max-width: 375px) */
@media (max-width: 375px) {
    .d2c-product-card {
        padding: 10px !important;
        gap: 10px;
    }
    .d2c-card-image {
        width: 56px;
        height: 56px;
    }
    .d2c-quantity-pill {
        width: 76px;
    }
    .d2c-product-price {
        font-size: 13px;
    }
    .d2c-rec-image {
        width: 40px;
        height: 40px;
    }
    .d2c-rec-btn {
        padding: 3px 8px !important;
        font-size: 9px !important;
        height: 24px !important;
    }
}
