/**
 * ============================================
 * STICKY ADD TO CART v9.1 CSS
 * 
 * Verbeteringen v9.1:
 * - Smooth prijs animatie (geen "sprong")
 * - Betere visuele feedback bij update
 * ============================================
 */

/* ============================================
   PRODUCT PAGE PRICE UPDATE ANIMATION
   ============================================ */

.summary .price.sk4u-price-updating,
.woocommerce-variation-price .price.sk4u-price-updating,
p.price.sk4u-price-updating {
    opacity: 0.3;
    transform: scale(0.98);
    transition: opacity 0.1s ease-out, transform 0.1s ease-out;
}

.summary .price,
.woocommerce-variation-price .price,
p.price {
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

/* Selected variation badge styling */
.wd-attr-selected {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f5e9;
    color: #03a84e;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.wd-attr-selected svg {
    color: #03a84e;
}

/* ============================================
   BASE STYLES
   ============================================ */

.sticky-add-to-cart {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: bottom 0.3s ease-out;
    padding: 20px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.sticky-add-to-cart.visible {
    bottom: 0;
	z-index: 2147483640;
}

/* ============================================
   MOBILE LAYOUT
   ============================================ */

.sticky-cart--mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.sticky-cart--mobile .sticky-cart__left {
    flex: 1;
    min-width: 0;
}

.sticky-cart--mobile .sticky-cart__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

/* Size display */
.sticky-cart__size {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.sticky-cart__size.has-selection {
    color: #03a84e;
    font-weight: 600;
}

.sticky-cart__size.has-selection svg {
    color: #03a84e;
}

.sticky-cart__size.unavailable {
    color: #e74c3c;
}

.sticky-cart__size.unavailable svg {
    color: #e74c3c;
}

/* Price - Mobile */
.sticky-cart--mobile .sticky-cart__price {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    /* Smooth transition voor prijs update */
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.sticky-cart--mobile .sticky-cart__price.price-updating {
    opacity: 0.3;
    transform: scale(0.95);
}

.sticky-cart--mobile .sticky-cart__price del {
    color: #999;
    font-size: 14px;
    font-weight: 400;
    margin-right: 6px;
}

.sticky-cart--mobile .sticky-cart__price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* Button - Mobile */
.sticky-cart--mobile .sticky-cart__button {
    background: #03a84e;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 140px;
    text-align: center;
}

.sticky-cart--mobile .sticky-cart__button:hover {
    background: #028a3f;
}

.sticky-cart--mobile .sticky-cart__button.no-selection {
    background: #2D5780;
}

.sticky-cart--mobile .sticky-cart__button.no-selection:hover {
    background: #1f3d5c;
}

.sticky-cart--mobile .sticky-cart__button.size-unavailable {
    background: #6c757d;
}

.sticky-cart--mobile .sticky-cart__button.out-of-stock {
    background: #dc3545;
    cursor: not-allowed;
}

.sticky-cart--mobile .sticky-cart__button.added {
    background: #03a84e;
    animation: pulse-success 0.3s ease;
}

/* Shipping - Mobile */
.sticky-cart--mobile .sticky-cart__shipping {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #03a84e;
    font-weight: 500;
}

/* ============================================
   DESKTOP LAYOUT
   ============================================ */

.sticky-cart--desktop {
    padding: 12px 24px;
}

.sticky-cart--desktop .sticky-cart__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 24px;
}

/* Product info - Desktop */
.sticky-cart__product {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    max-width: 300px;
}

.sticky-cart__image {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 4px;
    background: #f5f5f5;
}

.sticky-cart__product-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sticky-cart__product-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-cart--desktop .sticky-cart__size {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
}

/* Size selector - Desktop */
.sticky-cart__selector {
    flex: 1;
    display: flex;
    justify-content: center;
}

.sticky-cart__selected-size {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e8f5e9;
    padding: 8px 16px;
    border-radius: 20px;
    color: #03a84e;
    font-weight: 600;
    font-size: 14px;
}

.sticky-cart__selected-size svg {
    color: #03a84e;
}

.sticky-cart__change-size {
    background: none;
    border: none;
    color: #2D5780;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    margin-left: 8px;
}

.sticky-cart__change-size:hover {
    color: #1f3d5c;
}

.sticky-cart__select-size-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    padding: 10px 20px;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sticky-cart__select-size-btn:hover {
    border-color: #2D5780;
    background: #f5f8fa;
    color: #2D5780;
}

/* Price - Desktop */
.sticky-cart--desktop .sticky-cart__price {
    flex: 0 0 auto;
    min-width: 120px;
    text-align: right;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    /* Smooth transition voor prijs update */
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.sticky-cart--desktop .sticky-cart__price.price-updating {
    opacity: 0.3;
    transform: scale(0.95);
}

.sticky-cart--desktop .sticky-cart__price del {
    color: #999;
    font-size: 14px;
    font-weight: 400;
    display: block;
}

.sticky-cart--desktop .sticky-cart__price ins {
    text-decoration: none;
    color: #e74c3c;
}

.sticky-cart__price-from {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

/* Action area - Desktop */
.sticky-cart__action {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.sticky-cart--desktop .sticky-cart__button {
    background: #03a84e;
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sticky-cart--desktop .sticky-cart__button:hover {
    background: #028a3f;
    transform: translateY(-1px);
}

.sticky-cart--desktop .sticky-cart__button.no-selection {
    background: #2D5780;
}

.sticky-cart--desktop .sticky-cart__button.no-selection:hover {
    background: #1f3d5c;
}

.sticky-cart--desktop .sticky-cart__button.size-unavailable {
    background: #6c757d;
}

.sticky-cart--desktop .sticky-cart__button.out-of-stock {
    background: #dc3545;
    cursor: not-allowed;
}

.sticky-cart--desktop .sticky-cart__button.added {
    background: #03a84e;
    animation: pulse-success 0.3s ease;
}

.sticky-cart--desktop .sticky-cart__shipping {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #03a84e;
    font-weight: 500;
}

/* ============================================
   PULSE ANIMATION FOR UPDATES
   ============================================ */

.sticky-add-to-cart.updated {
    animation: bar-pulse 0.4s ease;
}

@keyframes bar-pulse {
    0% {
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 -2px 30px rgba(3, 168, 78, 0.3);
    }
    100% {
        box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
    }
}

@keyframes pulse-success {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* ============================================
   BOTTOM SHEET OVERLAY
   ============================================ */

.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2147483641;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bottom-sheet-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   TIRE SIZE SELECTOR (BOTTOM SHEET)
   ============================================ */

.tire-size-selector {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    z-index: 2147483642;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    overflow-y: auto;
}

.tire-size-selector.open {
    transform: translateY(0);
}

/* Desktop version - centered modal */
.tire-size-selector--desktop {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
}

.tire-size-selector--desktop.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Header */
.tire-size-selector__header {
    padding: 10px 10px;
    position: relative;
}

.tire-size-selector__handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 12px;
}

.tire-size-selector--desktop .tire-size-selector__handle {
    display: none;
}

.tire-size-selector__title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    text-align: center;
}

.tire-size-selector__close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    border-radius: 50%;
    transition: background 0.2s;
}

.tire-size-selector__close:hover {
    background: #f0f0f0;
}

/* Content */
.tire-size-selector__content {
    padding: 0px 20px 20px 20px;
}

.tire-size-selector__hint {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.tire-size-selector__hint small {
    color: #999;
}

/* Dropdowns */
.tire-size-selector__dropdowns {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.tire-size-selector__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tire-size-selector__label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.tire-size-selector__select {
    /* padding: 14px 16px; */
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    color: #333;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

.tire-size-selector__select:focus {
    outline: none;
    border-color: #2D5780;
    box-shadow: 0 0 0 3px rgba(45, 87, 128, 0.1);
}

.tire-size-selector__select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Submit button */
.tire-size-selector__submit {
    width: 100%;
    padding: 16px;
    background: #03a84e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.tire-size-selector__submit:hover:not(:disabled) {
    background: #028a3f;
}

.tire-size-selector__submit:active:not(:disabled) {
    transform: scale(0.98);
}

.tire-size-selector__submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ============================================
   BODY STATE
   ============================================ */

body.selector-open {
    overflow: hidden;
}

/* ============================================
   RESPONSIVE TWEAKS
   ============================================ */

@media (max-width: 360px) {
    .sticky-cart--mobile .sticky-cart__button {
        padding: 10px 16px;
        font-size: 14px;
        min-width: 120px;
    }
    
    .sticky-cart--mobile .sticky-cart__price {
        font-size: 16px;
    }
}

@media (min-width: 768px) {
    .tire-size-selector__dropdowns {
        flex-direction: row;
        gap: 12px;
    }
    
    .tire-size-selector__field {
        flex: 1;
    }
}


button.tire-size-selector__close {
    padding: 4px 6px;
    position: absolute;
}