/* WooCheckout Side Cart Styles */

/* Cart trigger icon (shortcode & menu) */
.woocheckout-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: relative;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    padding: 4px;
}

.woocheckout-cart-trigger:hover {
    color: var(--woocheckout-primary, #4F46E5);
    text-decoration: none;
}

.woocheckout-cart-trigger .woocheckout-cart-count {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    border-radius: 9px;
    padding: 0 4px;
}

.woocheckout-cart-trigger .woocheckout-cart-total {
    font-size: 13px;
    font-weight: 600;
    margin-left: 4px;
}

.woocheckout-menu-cart-item {
    display: flex !important;
    align-items: center !important;
}

.woocheckout-cart-icon {
    display: block;
}

.woocheckout-cart-icon-custom {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Floating cart button (fixed, bottom-right) */
.woocheckout-floating-cart-btn {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    z-index: 999997;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--woocheckout-btn-bg, var(--woocheckout-primary, #4F46E5)) !important;
    color: #fff !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    text-decoration: none !important;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
}

/* Hidden when cart is empty */
.woocheckout-floating-cart-btn.woocheckout-floating-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

.woocheckout-floating-cart-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    color: #fff !important;
    text-decoration: none !important;
}

.woocheckout-floating-cart-btn .woocheckout-cart-icon {
    color: #fff;
    stroke: #fff;
}

.woocheckout-floating-cart-btn .woocheckout-cart-icon-custom {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

.woocheckout-floating-cart-btn .woocheckout-floating-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    border-radius: 10px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid #fff;
}

/* Overlay */
.woocheckout-side-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.woocheckout-side-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Side Cart Panel */
.woocheckout-side-cart {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.1);
    font-family: var(--woocheckout-font, inherit);
}

.woocheckout-side-cart.open {
    transform: translateX(0);
}

/* Header */
.woocheckout-side-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.woocheckout-side-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 8px;
}

.woocheckout-cart-count {
    background: var(--woocheckout-primary, #4F46E5);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.woocheckout-side-cart-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s;
}

.woocheckout-side-cart-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* Free Shipping Bar */
.woocheckout-shipping-bar {
    padding: 12px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.woocheckout-shipping-bar-message {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.woocheckout-shipping-free {
    color: var(--woocheckout-secondary, #10B981);
    font-weight: 600;
}

.woocheckout-shipping-bar-track {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.woocheckout-shipping-bar-fill {
    height: 100%;
    background: var(--woocheckout-primary, #4F46E5);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.woocheckout-shipping-bar-fill.achieved {
    background: var(--woocheckout-secondary, #10B981);
}

/* Cart Body (scrollable) */
.woocheckout-side-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Empty cart */
.woocheckout-side-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
}

.woocheckout-side-cart-empty p {
    margin-top: 12px;
    color: #9ca3af;
    font-size: 15px;
}

/* Cart Item */
.woocheckout-cart-item {
    display: flex;
    gap: 14px;
    padding: 16px 24px;
    border-bottom: 1px solid #f3f4f6;
    position: relative;
    transition: background 0.2s;
}

.woocheckout-cart-item:hover {
    background: #fafafa;
}

.woocheckout-cart-item-image {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

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

.woocheckout-cart-item-details {
    flex: 1;
    min-width: 0;
}

.woocheckout-cart-item-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
    margin-bottom: 4px;
    line-height: 1.3;
}

.woocheckout-cart-item-name:hover {
    color: var(--woocheckout-primary, #4F46E5);
}

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

.woocheckout-cart-item-meta span {
    display: block;
}

.woocheckout-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

/* Quantity controls */
.woocheckout-cart-item-quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    overflow: hidden;
}

.woocheckout-qty-btn {
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.woocheckout-qty-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.woocheckout-qty-input {
    width: 40px;
    text-align: center;
    border: none;
    border-left: 1px solid #d1d5db;
    border-right: 1px solid #d1d5db;
    padding: 4px 0;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
    appearance: textfield;
}

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

/* Remove button */
.woocheckout-cart-item-remove {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    border-radius: 4px;
    transition: all 0.2s;
}

.woocheckout-cart-item-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* Coupon */
.woocheckout-side-cart-coupon {
    padding: 12px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.woocheckout-coupon-form {
    display: flex;
    gap: 8px;
}

.woocheckout-coupon-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.woocheckout-coupon-input:focus {
    border-color: var(--woocheckout-primary, #4F46E5);
}

.woocheckout-coupon-btn {
    padding: 8px 16px;
    background: var(--woocheckout-primary, #4F46E5);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.woocheckout-coupon-btn:hover {
    opacity: 0.9;
}

.woocheckout-coupon-message {
    margin-top: 6px;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
}

.woocheckout-coupon-message.success {
    background: #ecfdf5;
    color: #065f46;
}

.woocheckout-coupon-message.error {
    background: #fef2f2;
    color: #991b1b;
}

/* Cross-sells */
.woocheckout-side-cart-cross-sells {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.woocheckout-cross-sells-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px;
}

.woocheckout-cross-sells-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.woocheckout-cross-sells-carousel::-webkit-scrollbar {
    display: none;
}

.woocheckout-cross-sell-item {
    flex-shrink: 0;
    width: 120px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    position: relative;
}

.woocheckout-cross-sell-image {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
    margin-bottom: 8px;
}

.woocheckout-cross-sell-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.woocheckout-cross-sell-name {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    display: block;
    line-height: 1.3;
    margin-bottom: 4px;
}

.woocheckout-cross-sell-price {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
}

.woocheckout-cross-sell-add {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.woocheckout-cross-sell-add:hover {
    background: var(--woocheckout-primary, #4F46E5);
    color: #fff;
    border-color: var(--woocheckout-primary, #4F46E5);
}

/* Footer */
.woocheckout-side-cart-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #fff;
}

/* Totals */
.woocheckout-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 14px;
    color: #374151;
}

.woocheckout-total {
    font-size: 16px;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid #e5e7eb;
}

.woocheckout-coupon-code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 4px;
}

.woocheckout-remove-coupon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    color: #9ca3af;
    margin-left: 4px;
    vertical-align: middle;
}

.woocheckout-remove-coupon-btn:hover {
    color: #ef4444;
}

.woocheckout-discount-amount {
    color: var(--woocheckout-secondary, #10B981);
    font-weight: 500;
}

/* Actions */
.woocheckout-side-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

a.woocheckout-checkout-btn,
a.woocheckout-checkout-btn:visited,
a.woocheckout-checkout-btn:hover {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    background-color: var(--woocheckout-btn-bg, var(--woocheckout-primary, #4F46E5)) !important;
    color: var(--woocheckout-btn-text, #ffffff) !important;
    text-decoration: none !important;
    text-align: center;
}

.woocheckout-continue-shopping {
    width: 100%;
    padding: 10px;
    font-size: 13px;
}

/* Bundled / child items (Product Bundles) */
.woocheckout-bundled-items {
    padding-left: 86px;
    margin-top: -8px;
}

.woocheckout-bundled-item {
    font-size: 12px;
    color: #6b7280;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.woocheckout-bundled-item::before {
    content: '└';
    color: #d1d5db;
}

/* MNM: parent cart item wraps to allow children underneath */
.woocheckout-cart-item:has(.woocheckout-mnm-children),
.woocheckout-cart-item.woocheckout-has-mnm-children {
    flex-wrap: wrap;
}

/* MNM child items container */
.woocheckout-mnm-children {
    width: 100%;
    flex-basis: 100%;
    border-top: 1px dashed #e5e7eb;
    margin-top: 12px;
    padding-top: 4px;
}

/* Individual MNM child item */
.woocheckout-mnm-child-item {
    display: flex !important;
    gap: 10px !important;
    padding: 10px 0 10px 16px !important;
    border-bottom: 1px solid #f3f4f6 !important;
    position: relative;
    margin: 0 !important;
}

.woocheckout-mnm-child-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 10px;
    height: 1px;
    background: #d1d5db;
}

.woocheckout-mnm-child-item:last-child {
    border-bottom: none !important;
}

.woocheckout-mnm-child-item .woocheckout-cart-item-image,
.woocheckout-mnm-child-image {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    border-radius: 6px;
}

.woocheckout-mnm-child-item .woocheckout-cart-item-name {
    font-size: 13px;
}

.woocheckout-mnm-child-item .woocheckout-cart-item-price {
    font-size: 13px;
}

.woocheckout-mnm-child-item .woocheckout-cart-item-remove {
    display: none;
}

.woocheckout-mnm-child-item .woocheckout-cart-item-quantity {
    transform: scale(0.9);
    transform-origin: left center;
}

/* MNM / subscription badges */
.woocheckout-mnm-badge,
.woocheckout-bundle-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 2px;
}

.woocheckout-subscription-meta {
    margin-top: 2px;
}

.woocheckout-subscription-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--woocheckout-primary, #4F46E5);
    background: rgba(79, 70, 229, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Frequency switcher */
.woocheckout-frequency-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.woocheckout-frequency-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--woocheckout-primary, #4F46E5);
    white-space: nowrap;
}

.woocheckout-frequency-select {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 24px 3px 8px;
    border: 1px solid var(--woocheckout-primary, #4F46E5);
    border-radius: 6px;
    background: rgba(79, 70, 229, 0.05);
    color: var(--woocheckout-primary, #4F46E5);
    cursor: pointer;
    outline: none;
    appearance: auto;
    -webkit-appearance: menulist-button;
    max-width: 170px;
}

.woocheckout-frequency-select:focus {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* Recurring totals */
.woocheckout-recurring-total {
    color: var(--woocheckout-primary, #4F46E5);
    font-weight: 500;
    font-size: 13px;
}

/* Price period suffix */
.woocheckout-price-period {
    font-weight: 400;
    color: #6b7280;
    font-size: 12px;
}

/* Qty label (non-editable) */
.woocheckout-cart-item-qty-label {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .woocheckout-side-cart {
        width: 100vw;
        max-width: 100vw;
    }

    .woocheckout-cart-item-image {
        width: 60px;
        height: 60px;
    }
}
