/* Cart trigger base */
.sasipea-cart-trigger {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: #fff;
    color: #000;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
}

.sasipea-cart-trigger:hover {
    background: #b8941f;
    transform: scale(1.05);
}

.sasipea-cart-trigger img,
.sasipea-cart-trigger-shortcode img {
    width: 32px;
    height: 32px;
}

.sasipea-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E3A742;
    color: #000;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Shortcode trigger */
.sasipea-cart-trigger-shortcode {
    position: relative;
    display: inline-block;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.sasipea-cart-trigger-shortcode:hover,
.sasipea-cart-trigger-shortcode:active {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.sasipea-cart-trigger-shortcode img,
.sasipea-cart-trigger-shortcode .sasipea-cart-badge {
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Popup overlay and dialog */
.sasipea-cart-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.sasipea-cart-popup-dialog {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 600px;
    background: #E3DDD2;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.sasipea-cart-popup-body {
    padding: 20px;
    height: 100vh;
    overflow-y: auto;
    background-color: #E3DDD2;
    overflow-x: visible;
}

@media (max-width: 768px) {
    .sasipea-cart-popup-body {
        padding-left: 0;
        overflow-x: visible;
    }
    
    .sasipea-cart-items {
        overflow-x: visible;
        padding-left: 20px;
    }
}

.sasipea-cart-popup-show {
    display: flex !important;
    opacity: 1 !important;
}

.sasipea-cart-popup-show .sasipea-cart-popup-dialog {
    transform: translateX(0);
}

.sasipea-cart-popup-active {
    overflow: hidden !important;
}

/* Don't disable scrolling in Elementor edit mode */
.elementor-editor-active .sasipea-cart-popup-active,
.elementor-editor-preview .sasipea-cart-popup-active,
body[class*="elementor"] .sasipea-cart-popup-active {
    overflow: visible !important;
}

.sasipea-cart-popup-closing .sasipea-cart-popup-dialog {
    transform: translateX(100%);
}

.sasipea-cart-popup-closing {
    opacity: 0;
}

@media (max-width: 768px) {
    .sasipea-cart-popup {
        z-index: 999999 !important;
        display: none;
    }
    
    .sasipea-cart-popup-dialog {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        height: 100svh !important;
        box-shadow: none;
        -webkit-transform: translateX(100%) !important;
        transform: translateX(100%) !important;
        position: fixed !important;
        z-index: 1000000 !important;
        visibility: hidden;
    }

    .sasipea-cart-popup-body {
        height: 100svh !important;
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: 0;
        overflow-y: auto;
        overflow-x: visible;
        -webkit-overflow-scrolling: touch;
    }

    .sasipea-cart-popup-show {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .sasipea-cart-popup-show .sasipea-cart-popup-dialog {
        -webkit-transform: translateX(0) !important;
        transform: translateX(0) !important;
        visibility: visible !important;
    }
    
    .sasipea-cart-popup-closing .sasipea-cart-popup-dialog {
        transform: translateX(100%) !important;
    }
}

/* Remove number input arrows */
.sasipea-qty-input::-webkit-outer-spin-button,
.sasipea-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sasipea-qty-input[type=number] {
    -moz-appearance: textfield;
}

/* Quantity selector dimensions */
.sasipea-cart-item .sasipea-qty-wrapper {
    width: 131px;
    height: 44px;
    min-width: 131px;
    min-height: 44px;
    display: flex;
    border: 1px solid #e0a800;
    border-radius: 24px;
    overflow: hidden;
}

.sasipea-cart-item .sasipea-qty-wrapper button {
    width: 40px;
    height: 44px;
    min-width: 40px;
    min-height: 44px;
    background: #fff;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    color: #e0a800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sasipea-cart-item .sasipea-qty-wrapper .sasipea-qty-input {
    width: 51px;
    height: 44px;
    min-width: 51px;
    min-height: 44px;
    text-align: center;
    border: none;
    padding: 5px;
    background-color: #e0a800;
    color: #000;
}

/* Checkout widget specific styles */
.sasipea-checkout-widget .sasipea-cart-item .sasipea-qty-wrapper {
    border-color: #e0a800;
}

.sasipea-checkout-widget .sasipea-cart-item .sasipea-qty-wrapper button {
    color: #e0a800;
}

.sasipea-checkout-widget .sasipea-cart-item .sasipea-qty-wrapper .sasipea-qty-input {
    background-color: #e0a800;
}

.sasipea-checkout-widget .sasipea-remove-item {
    background: #E3A742;
}

/* Popup content layout */
.sasipea-cart-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 0;
    margin-bottom: 20px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #E3DDD2;
    padding-top: 50px;
    padding-bottom: 10px;
}

.sasipea-cart-title {
    margin: 0;
    font-family: 'Red Hat Display', sans-serif;
    font-size: 64px;
    font-weight: 400;
    line-height: 68px;
    letter-spacing: -1px;
    font-variant-numeric: lining-nums tabular-nums;
    color: #000;
    flex: 1;
}

.sasipea-close-popup {
    background: #e0a800;
    border: none;
    cursor: pointer;
    color: #000;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    line-height: 1;
    font-size: 20px;
}

.sasipea-cart-empty {
    text-align: center;
    color: #666;
    margin: 40px 0;
}

.sasipea-cart-item {
    display: flex;
    margin-bottom: 20px;
    padding: 15px;
    background: transparent;
    border-radius: 8px;
}

.sasipea-cart-item-image-wrap {
    margin-right: 15px;
    position: relative;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .sasipea-cart-item-image-wrap {
        margin-right: 20px;
        margin-left: -43px; /* Pilt 70% nähtav: 30% väljas (145px * 0.3 = 43.5px) */
        flex-shrink: 0;
    }
    
    .sasipea-cart-item {
        padding: 10px 0;
        padding-left: 0;
        overflow: visible;
    }
    
    .sasipea-cart-item-image-inner {
        width: 145px;
        height: 194px;
        margin-left: -29px;
    }
    
    .sasipea-cart-item-image-inner img {
        width: 145px;
        height: 194px !important;
    }
}

.sasipea-cart-item-image-inner {
    width: 145px;
    height: 194px;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
}

.sasipea-cart-item-image-inner img {
    width: 145px;
    height: 194px !important;
    object-fit: cover;
}

.sasipea-cart-item-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.sasipea-cart-item-title-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.sasipea-cart-item-title-link:hover {
    text-decoration: underline;
}

.sasipea-cart-item-image-link {
    display: block;
    text-decoration: none;
    position: relative;
}

.sasipea-cart-item-image-link:hover {
    opacity: 0.9;
}

/* Ensure remove button on image doesn't block the link */
.sasipea-cart-item-image-link .sasipea-remove-item-desktop {
    z-index: 20;
}

.sasipea-cart-item-image-inner {
    position: relative;
}

.sasipea-cart-item-image-inner .sasipea-remove-item {
    z-index: 20;
}

.sasipea-remove-item {
    background: #e0a800;
    color: #000;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    z-index: 10;
    pointer-events: auto;
}

.sasipea-remove-item:hover {
    background: #c99800;
}

/* Desktop: X button on image */
.sasipea-remove-item-desktop {
    position: absolute;
    top: 7px;
    left: 7px;
    display: block;
}

.sasipea-remove-item-mobile {
    display: none;
}

/* Mobile: X button next to title */
@media (max-width: 768px) {
    .sasipea-remove-item-desktop {
        display: none;
    }
    
    .sasipea-remove-item-mobile {
        display: flex;
        position: static;
        background: transparent;
        color: #000;
    }
}

.sasipea-cart-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sasipea-cart-item-title {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    flex: 1;
}

.sasipea-cart-item-desc {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #000;
    max-height: 4.2em; /* ~3 lines at 14px with line-height 1.4 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

.sasipea-cart-item-meta {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #999;
}

.sasipea-cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.sasipea-cart-item-price {
    text-align: right;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 18px;
    line-height: 28px;
    font-variant-numeric: lining-nums tabular-nums;
    color: #000;
}

.sasipea-cart-total-section {
    padding: 10px;
}

@media (max-width: 768px) {
    .sasipea-cart-total-section {
        padding: 0px;
    }
}

.sasipea-cart-total-inner {
    border-top: 1px solid #000;
    padding-top: 20px;
    margin-top: 20px;
}

.sasipea-cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sasipea-cart-total-label,
.sasipea-cart-total-value {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 23px;
    line-height: 32px;
    font-variant-numeric: lining-nums tabular-nums;
    color: #000;
}

.sasipea-cart-buttons {
    display: flex;
    gap: 10px;
}

.sasipea-continue-shopping,
.sasipea-checkout {
    flex: 1;
    padding: 12px;
    border-radius: 24px;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 24px;
    font-variant-numeric: lining-nums tabular-nums;
}

.sasipea-continue-shopping {
    background: transparent;
    border: 1px solid #000;
    color: #000;
}

.sasipea-checkout {
    background: #e0a800;
    border: none;
    color: #000;
}

.sasipea-placeholder-image {
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}

.sasipea-excerpt {
    color: #666;
    font-size: 12px;
}

.sasipea-info-text {
    font-size: 12px;
    color: #666;
}

.sasipea-info-text-empty {
    font-size: 12px;
    color: #999;
}

.sasipea-badge {
    background: #B4AE92;
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.sasipea-level-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.sasipea-actions {
    display: flex;
    gap: 10px;
}

.sasipea-btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.sasipea-empty {
    color: #999;
}

.sasipea-sortable-notice {
    margin-bottom: 20px;
    padding: 12px;
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

.sasipea-link {
    color: #B4AE92;
    text-decoration: none;
}

.sasipea-link:hover {
    text-decoration: underline;
}

/* Elementor Template Popup Styles */
.sasipea-elementor-template-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.25);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sasipea-elementor-template-popup-wrapper.sasipea-popup-visible {
    opacity: 1;
    visibility: visible;
}

.sasipea-elementor-template-popup-content {
    background: #E3DDD2;
    width: 600px;
    max-width: 90vw;
    height: 100%;
    overflow-y: auto;
    position: relative;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s ease;
    -webkit-overflow-scrolling: touch;
}

.sasipea-elementor-template-popup-wrapper.sasipea-popup-visible .sasipea-elementor-template-popup-content {
    transform: translateX(0);
}

.sasipea-close-elementor-popup {
    position: absolute;
    top: 72px;
    right: 20px;
    background: #e0a800;
    color: #000;
    border: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: bold;
}

@media (max-width: 768px) {
    .sasipea-close-elementor-popup {
        top: 34px;
    }
}

.sasipea-close-elementor-popup:hover {
    background: #c99800;
}

.sasipea-elementor-template-content {
    padding: 20px;
    min-height: 100%;
}

/* Header styles for Elementor template popup */
.sasipea-elementor-template-popup-content .sasipea-cart-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    margin-bottom: 20px;
    padding: 0 20px;
}

.sasipea-elementor-template-popup-content .sasipea-cart-title {
    margin: 0;
    font-family: 'Red Hat Display', sans-serif;
    font-size: 64px;
    font-weight: 400;
    line-height: 68px;
    letter-spacing: -1px;
    font-variant-numeric: lining-nums tabular-nums;
    color: #000;
    flex: 1;
}

@media (max-width: 768px) {
    .sasipea-elementor-template-popup-content {
        width: 100vw;
        max-width: 100vw;
        height: 100svh;
    }
    
    .sasipea-elementor-template-popup-wrapper {
        justify-content: center;
    }
    
    .sasipea-elementor-template-popup-content .sasipea-cart-title {
        font-size: 48px;
        line-height: 52px;
    }
    
    .sasipea-elementor-template-popup-content .sasipea-cart-header {
        margin-top: 20px;
        padding: 0 20px;
    }
}


