/**
 * Frontend Styles
 * 
 * Styles for layouts displayed on the front-end.
 * 
 * @package KramitBuilder
 * @since   1.0.0
 */

/* Wrapper - Base styles, inline styles control breakout behavior */
.kramit-builder-wrapper {
    position: relative;
    overflow: visible;
    clear: both;
    width: 100%;
    display: flex;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Layout Container */
.kramit-builder-layout {
    position: relative;
    width: 100%;
    min-height: 400px;
    margin: 0 auto;
    overflow: visible;
    isolation: isolate;
    display: block;
    clear: both;
    box-sizing: border-box;
}

/* Responsive behavior - widgets scale via percentages automatically */
/* No max-width constraints = full viewport width on all devices */

/* Individual Widgets */
.kramit-widget {
    box-sizing: border-box;
}

/* Widget content containers should fill wrapper height */
.kramit-widget > div:first-child {
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* CTA widget specific - ensure background fills */
.kramit-widget-cta .kramit-cta-widget {
    min-height: 100%;
    height: 100%;
}

/* Widgets in flow templates use natural document flow */
.kramit-product-template .kramit-widget {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
}

/* Allow content widgets to expand */
.kramit-widget-product-grid,
.kramit-widget-category-list {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Ensure child elements don't get clipped */
.kramit-widget-product-grid > *,
.kramit-widget-category-list > * {
    overflow: visible !important;
}

/* Ensure images scale within their containers */
.kramit-widget img {
    max-width: 100%;
    height: auto;
}

/* Text Widget */
.kramit-text-widget {
    line-height: 1.6;
    padding: 0;
}

/* Heading Widget */
.kramit-heading-widget {
    padding: 0;
}

/* Button Widget */
.kramit-button-widget {
    padding: 0;
}

.kramit-button-widget a {
    display: inline-block;
    text-decoration: none;
    transition: all 0.3s ease;
}

/* Image Widget - Images fill the container */
.kramit-image-widget {
    padding: 0;
    width: 100%;
    height: 100%;
}

.kramit-image-widget img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Carousel Widget */
.kramit-widget-carousel {
    overflow: hidden;
}

/* The actual carousel container */
.kramit-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    /* overflow:clip enforces a hard clip boundary that applies even to
       GPU-composited children (will-change:transform on the track).
       overflow:hidden can fail to clip composited layers in Firefox. */
    overflow: clip;
    /* pan-y: vertical scroll stays with the browser, horizontal swipe is
       handled by JS pointer events. Prevents Android Chrome from firing
       pointercancel mid-swipe which causes snap-back jank. */
    touch-action: pan-y;
}

.kramit-carousel-slides {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    /* No will-change: transform — GPU layer promotion prevents the parent's
       overflow:clip from clipping the track in Firefox. Normal layer ensures
       the parent clip boundary is always honoured. */
}

.kramit-carousel-slide {
    flex: 0 0 100%;    /* flex-basis:100% resolves against container width —
                          unlike min-width:100% this cannot be pushed wider
                          by content (images larger than the container). */
    max-width: 100%;   /* hard cap so no image can expand the slide */
    overflow: hidden;
    position: relative;
    height: 100%;
}

.kramit-carousel-slide.active {
    /* State class retained for dot tracking only */
}

.kramit-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kramit-carousel-content {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 20px;
    border-radius: 4px;
}

.kramit-carousel-arrows {
    position: absolute;
    top: 50%;
    width: 100%;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    pointer-events: none;
}

.kramit-carousel-arrow {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    pointer-events: all;
    transition: background 0.3s;
}

.kramit-carousel-arrow:hover {
    background: rgba(0, 0, 0, 0.8);
}

.kramit-carousel-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.kramit-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}

.kramit-carousel-dot.active {
    background: rgba(255, 255, 255, 1);
}

/* Responsive */
@media (max-width: 768px) {
    .kramit-carousel-content {
        padding: 15px;
        bottom: 10px;
        left: 10px;
        right: 10px;
    }
}

/* Premium Widget Notice */
.kramit-premium-widget-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    text-align: center;
}

.kramit-premium-notice-content {
    max-width: 400px;
}

.kramit-premium-widget-notice .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
}

.kramit-premium-widget-notice h3 {
    margin: 0 0 10px 0;
    color: #fff;
}

.kramit-premium-widget-notice p {
    margin: 0 0 20px 0;
}

.kramit-upgrade-button {
    display: inline-block;
    padding: 12px 24px;
    background: #fff;
    color: #667eea;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.2s;
}

.kramit-upgrade-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Advanced Slider Styles */
.kramit-slider-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.kramit-slider {
    position: relative;
    width: 100%;
    overflow: clip;
}

.kramit-slider-track {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    /* No will-change: transform — same reason as carousel track above. */
}

.kramit-slide {
    flex: 0 0 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kramit-slide.active {
    /* State class retained for dot tracking only */
}

.kramit-slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.kramit-slide-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #fff;
    padding: 40px;
    max-width: 800px;
}

.kramit-slide-title {
    font-size: 48px;
    font-weight: bold;
    margin: 0 0 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.kramit-slide-description {
    font-size: 20px;
    margin: 0 0 30px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.kramit-slide-button {
    display: inline-block;
    padding: 15px 40px;
    background: #667eea;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.kramit-slide-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.kramit-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kramit-slider-arrow:hover {
    background: rgba(255, 255, 255, 0.5);
}

.kramit-slider-prev {
    left: 20px;
}

.kramit-slider-next {
    right: 20px;
}

.kramit-slider-arrow .dashicons {
    color: #fff;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.kramit-slider-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 10px;
}

.kramit-slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s;
    padding: 0;
}

.kramit-slider-dot.active,
.kramit-slider-dot:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .kramit-slide-title {
        font-size: 32px;
    }
    
    .kramit-slide-description {
        font-size: 16px;
    }
    
    .kramit-slide-button {
        padding: 12px 30px;
        font-size: 14px;
    }
    
    .kramit-slider-arrow {
        width: 40px;
        height: 40px;
    }
    
    .kramit-slider-prev {
        left: 10px;
    }
    
    .kramit-slider-next {
        right: 10px;
    }
}

/* Small Desktop / Large Tablet (1024px - 1200px) */
@media (max-width: 1200px) and (min-width: 1025px) {
    /* Only convert to flexbox for layouts with product filter + grid combo */
    .kramit-builder-layout.has-product-filter {
        display: flex !important;
        flex-wrap: wrap !important;
        min-height: auto !important;
    }
    
    .kramit-builder-layout.has-product-filter .kramit-widget {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        flex-shrink: 0;
    }
    
    /* Filter sidebar */
    .kramit-widget-product-filter {
        width: 22% !important;
        min-width: 220px;
        margin-right: 25px;
    }
    
    /* Product grid takes remaining space */
    .kramit-widget-product-grid {
        width: calc(78% - 25px) !important;
        flex: 1;
    }
    
    /* Reduce columns slightly */
    .kramit-product-grid.columns-5,
    .kramit-product-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Tablet Layout (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 769px) {
    /* Only convert to flexbox for layouts with product filter + grid combo */
    .kramit-builder-layout.has-product-filter {
        display: flex !important;
        flex-wrap: wrap !important;
        min-height: auto !important;
    }
    
    .kramit-builder-layout.has-product-filter .kramit-widget {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        flex-shrink: 0;
    }
    
    /* Filter sidebar takes ~25% on tablet */
    .kramit-widget-product-filter {
        width: 25% !important;
        min-width: 200px;
        margin-right: 20px;
    }
    
    /* Product grid takes remaining space */
    .kramit-widget-product-grid {
        width: calc(75% - 20px) !important;
        flex: 1;
    }
    
    /* Reduce product grid to 2-3 columns on tablet */
    .kramit-product-grid.columns-4,
    .kramit-product-grid.columns-5,
    .kramit-product-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .kramit-product-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile Layout - Stack widgets vertically */
@media (max-width: 768px) {
    /* Only convert to flexbox for layouts with product filter + grid combo */
    .kramit-builder-layout.has-product-filter {
        display: flex !important;
        flex-direction: column !important;
        min-height: auto !important;
    }
    
    .kramit-builder-layout.has-product-filter .kramit-widget {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        margin-bottom: 20px;
    }
    
    /* Product filter mobile toggle */
    .kramit-widget-product-filter {
        order: -1; /* Put filter first on mobile */
    }
    
    .kramit-product-filter {
        position: relative;
    }
    
    .kramit-filter-toggle {
        display: block;
        width: 100%;
        padding: 12px 20px;
        background: #0073aa;
        color: #fff;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        font-weight: 600;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .kramit-filter-toggle::before {
        content: "☰ ";
    }
    
    .kramit-product-filter .product-filter-form {
        display: none;
        padding: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 5px;
    }
    
    .kramit-product-filter.filter-open .product-filter-form {
        display: block;
    }
    
    /* Product grid 2 columns on larger phones */
    .kramit-product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
}

/* Small mobile devices - single column */
@media (max-width: 480px) {
    .kramit-builder-layout .kramit-widget {
        margin-bottom: 15px;
    }
    
    .kramit-product-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .kramit-product-item {
        margin: 0 5px;
    }
}

/* =========================================
   Responsive Visibility
   ========================================= */

/* Desktop - above 1024px */
@media (min-width: 1025px) {
    .kramit-hide-desktop {
        display: none !important;
    }
}

/* Tablet - 768px to 1024px */
@media (min-width: 768px) and (max-width: 1024px) {
    .kramit-hide-tablet {
        display: none !important;
    }
}

/* Mobile - below 768px */
@media (max-width: 767px) {
    .kramit-hide-mobile {
        display: none !important;
    }
}

/* =========================================
   Entrance Animations
   ========================================= */

.kramit-animated {
    animation-duration: var(--kramit-animation-duration, 1s);
    animation-delay: var(--kramit-animation-delay, 0s);
    animation-fill-mode: both;
    /* Paused until JS IntersectionObserver gates it into view.
       animation-fill-mode:both holds elements in their 'from' state
       (typically opacity:0) so nothing flashes before animating. */
    animation-play-state: paused;
}

/* Fade Animations */
@keyframes kramitFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes kramitFadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitFadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitFadeInLeft {
    from {
        opacity: 0;
        transform: translate3d(-40px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitFadeInRight {
    from {
        opacity: 0;
        transform: translate3d(40px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.kramit-animation-fadeIn { animation-name: kramitFadeIn; }
.kramit-animation-fadeInUp { animation-name: kramitFadeInUp; }
.kramit-animation-fadeInDown { animation-name: kramitFadeInDown; }
.kramit-animation-fadeInLeft { animation-name: kramitFadeInLeft; }
.kramit-animation-fadeInRight { animation-name: kramitFadeInRight; }

/* Slide Animations */
@keyframes kramitSlideInUp {
    from {
        transform: translate3d(0, 100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitSlideInDown {
    from {
        transform: translate3d(0, -100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitSlideInLeft {
    from {
        transform: translate3d(-100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitSlideInRight {
    from {
        transform: translate3d(100%, 0, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

.kramit-animation-slideInUp { animation-name: kramitSlideInUp; }
.kramit-animation-slideInDown { animation-name: kramitSlideInDown; }
.kramit-animation-slideInLeft { animation-name: kramitSlideInLeft; }
.kramit-animation-slideInRight { animation-name: kramitSlideInRight; }

/* Zoom Animations */
@keyframes kramitZoomIn {
    from {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    50% {
        opacity: 1;
    }
}

@keyframes kramitZoomInUp {
    from {
        opacity: 0;
        /* Was 1000px — a 1000px texture trashes mobile GPU memory.
           60vh is visually identical and caps the composited layer size. */
        transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 60vh, 0);
    }
    to {
        opacity: 1;
        transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    }
}

@keyframes kramitZoomInDown {
    from {
        opacity: 0;
        transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -60vh, 0);
    }
    to {
        opacity: 1;
        transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    }
}

.kramit-animation-zoomIn { animation-name: kramitZoomIn; }
.kramit-animation-zoomInUp { animation-name: kramitZoomInUp; }
.kramit-animation-zoomInDown { animation-name: kramitZoomInDown; }

/* Bounce Animations */
@keyframes kramitBounce {
    from, 20%, 53%, 80%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -30px, 0);
    }
    70% {
        animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06);
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes kramitBounceIn {
    from, 20%, 40%, 60%, 80%, to {
        animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
    }
    0% {
        opacity: 0;
        transform: scale3d(0.3, 0.3, 0.3);
    }
    20% {
        transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
        transform: scale3d(0.9, 0.9, 0.9);
    }
    60% {
        opacity: 1;
        transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
        transform: scale3d(0.97, 0.97, 0.97);
    }
    to {
        opacity: 1;
        transform: scale3d(1, 1, 1);
    }
}

@keyframes kramitBounceInUp {
    from {
        opacity: 0;
        /* Was 3000px — forced the browser to allocate a 3000px tall GPU texture.
           100vh is the maximum visible distance; visually indistinguishable. */
        transform: translate3d(0, 100vh, 0);
    }
    60% {
        opacity: 1;
        transform: translate3d(0, -20px, 0);
    }
    75% {
        transform: translate3d(0, 10px, 0);
    }
    90% {
        transform: translate3d(0, -5px, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

@keyframes kramitBounceInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -100vh, 0);
    }
    60% {
        opacity: 1;
        transform: translate3d(0, 25px, 0);
    }
    75% {
        transform: translate3d(0, -10px, 0);
    }
    90% {
        transform: translate3d(0, 5px, 0);
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

.kramit-animation-bounce { animation-name: kramitBounce; }
.kramit-animation-bounceIn { animation-name: kramitBounceIn; }
.kramit-animation-bounceInUp { animation-name: kramitBounceInUp; }
.kramit-animation-bounceInDown { animation-name: kramitBounceInDown; }

/* Rotate Animations */
@keyframes kramitRotateIn {
    from {
        transform-origin: center;
        transform: rotate3d(0, 0, 1, -200deg);
        opacity: 0;
    }
    to {
        transform-origin: center;
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

@keyframes kramitFlipInX {
    from {
        transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        animation-timing-function: ease-in;
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        animation-timing-function: ease-in;
    }
    60% {
        transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
    }
    to {
        transform: perspective(400px);
    }
}

@keyframes kramitFlipInY {
    from {
        transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
        animation-timing-function: ease-in;
        opacity: 0;
    }
    40% {
        transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
        animation-timing-function: ease-in;
    }
    60% {
        transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
        opacity: 1;
    }
    80% {
        transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
    }
    to {
        transform: perspective(400px);
    }
}

.kramit-animation-rotateIn { animation-name: kramitRotateIn; }
.kramit-animation-flipInX { animation-name: kramitFlipInX; }
.kramit-animation-flipInY { animation-name: kramitFlipInY; }


/* ==========================================================================
   WooCommerce Product Template Widgets
   ========================================================================== */

/* Product Template Container */
.kramit-product-template {
    display: block;
    position: relative;
}

.kramit-product-template .kramit-builder-layout {
    position: relative;
}

/* Add to Cart Widget - ensure proper spacing */
.kramit-add-to-cart {
    padding: 6px 0;
    clear: both;
}

/* Out-of-stock state needs less padding (no cart form, just notify button) */
.kramit-add-to-cart.out-of-stock-state {
    padding: 2px 0;
}

.kramit-add-to-cart .cart,
.kramit-add-to-cart form.cart {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.kramit-add-to-cart .quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.kramit-add-to-cart .quantity input,
.kramit-add-to-cart .quantity-input {
    width: 70px;
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.kramit-add-to-cart .add-to-cart-button,
.kramit-add-to-cart .single_add_to_cart_button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.kramit-add-to-cart .product-price {
    margin-bottom: 8px;
}

/* Product Meta Widget - proper spacing and line height */
.kramit-product-meta {
    padding: 6px 0;
    line-height: 1.6;
    clear: both;
}

.kramit-product-meta .meta-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.kramit-product-meta .meta-item {
    margin-bottom: 4px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.kramit-product-meta .meta-item:last-child {
    margin-bottom: 0;
}

.kramit-product-meta .meta-label {
    font-weight: 600;
}

.kramit-product-meta a {
    text-decoration: none;
    transition: color 0.2s ease;
}

.kramit-product-meta a:hover {
    text-decoration: underline;
}

/* Product Title Widget */
.kramit-product-title {
    padding: 10px 0;
    margin-bottom: 10px;
}

.kramit-product-title h1,
.kramit-product-title h2 {
    margin: 0;
    padding: 0;
    line-height: 1.3;
}

/* Product Price Widget */
.kramit-product-price {
    padding: 10px 0;
    margin-bottom: 10px;
}

.kramit-product-price .price {
    font-size: inherit;
    margin: 0;
}

.kramit-product-price del {
    opacity: 0.6;
    margin-right: 8px;
}

.kramit-product-price ins {
    text-decoration: none;
}

/* Product Short Description Widget */
.kramit-product-short-description {
    padding: 15px 0;
    margin-bottom: 10px;
    line-height: 1.6;
}

.kramit-product-short-description p {
    margin: 0 0 10px 0;
}

.kramit-product-short-description p:last-child {
    margin-bottom: 0;
}

/* Product Rating Widget */
.kramit-product-rating {
    padding: 10px 0;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kramit-product-rating .star-rating {
    font-size: inherit;
}

/* Product Gallery Widget */
.kramit-product-gallery {
    padding: 10px 0;
}

.kramit-product-gallery .woocommerce-product-gallery {
    margin: 0;
}

/* Product Tabs Widget */
.kramit-product-tabs {
    padding: 20px 0;
    margin-top: 20px;
}

/* Product Stock Widget */
.kramit-product-stock {
    padding: 10px 0;
    margin-bottom: 10px;
}

/* Ensure widgets don't overlap in product templates */
.kramit-product-template .kramit-widget {
    z-index: 1;
}

/* Override absolute positioning issues for key product widgets */
.kramit-product-template .kramit-widget[class*="product-meta"],
.kramit-product-template .kramit-widget[class*="add-to-cart"] {
    overflow: visible !important;
}

/* Responsive adjustments for product template */
@media (max-width: 768px) {
    .kramit-add-to-cart .cart,
    .kramit-add-to-cart form.cart {
        flex-direction: column;
        align-items: stretch;
    }
    
    .kramit-add-to-cart .quantity-wrapper {
        margin-bottom: 10px;
    }
    
    .kramit-add-to-cart .quantity input,
    .kramit-add-to-cart .quantity-input {
        width: 100%;
    }
    
    .kramit-add-to-cart .add-to-cart-button,
    .kramit-add-to-cart .single_add_to_cart_button {
        width: 100%;
    }
    
    .kramit-product-meta .meta-item {
        flex-direction: column;
        gap: 2px;
    }
}

/* ==========================================================================
   Product Grid - Title Truncation
   High specificity to override theme styles (e.g., Flatsome)
   ========================================================================== */

.kramit-product-grid .kramit-product-item .kramit-product-content h3.kramit-product-title,
.kramit-product-grid .kramit-product-content h3.kramit-product-title,
h3.kramit-product-title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.3em !important;
    min-height: 2.6em !important;
    max-height: 2.6em !important;
    height: 2.6em !important;
    margin: 0 0 8px 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    word-break: break-word !important;
    position: relative !important;
    z-index: 10 !important;
    background: #fff !important;
}

.kramit-product-grid .kramit-product-item .kramit-product-content h3.kramit-product-title a,
.kramit-product-grid .kramit-product-content h3.kramit-product-title a,
h3.kramit-product-title a {
    display: inline !important;
    color: #333 !important;
    text-decoration: none !important;
    -webkit-box-decoration-break: clone !important;
    box-decoration-break: clone !important;
}

.kramit-product-grid .kramit-product-item .kramit-product-content h3.kramit-product-title a:hover,
h3.kramit-product-title a:hover {
    color: #0066cc !important;
}

/* Price section - tighter spacing */
.kramit-product-grid .kramit-product-item .kramit-product-content .kramit-product-footer,
.kramit-product-content .kramit-product-footer {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    clear: both !important;
}

.kramit-product-grid .kramit-product-item .kramit-product-content .kramit-product-price,
.kramit-product-content .kramit-product-price {
    position: relative !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
}

/* =====================================================
   FULL WIDTH BREAKOUT
   Allows widgets to break out of the container to span 
   the full viewport width (edge-to-edge).
   ===================================================== */

/* Full width widgets break out of container */
.kramit-widget.kramit-full-width {
    width: 100vw !important;
    max-width: none !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Full width in product templates (flow mode) */
.kramit-product-template .kramit-full-width {
    position: relative !important;
    width: 100vw !important;
    left: 50% !important;
    right: auto !important;
    margin-left: -50vw !important;
    transform: none !important;
}

/* Ensure content inside full-width widgets stays centered if desired */
.kramit-full-width .kramit-carousel,
.kramit-full-width .kramit-slider {
    width: 100% !important;
    max-width: none !important;
}

/* ============================================
   Widget Effects & Animations
   ============================================ */

/* Box Shadow Presets */
.kramit-shadow-small {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.kramit-shadow-medium {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.kramit-shadow-large {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 10px rgba(0, 0, 0, 0.08);
}

.kramit-shadow-xl {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.kramit-shadow-glow {
    box-shadow: 0 0 20px rgba(34, 113, 177, 0.4), 0 0 40px rgba(34, 113, 177, 0.2);
}

.kramit-shadow-inset {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Hover Effects */
.kramit-hover-grow {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-grow:hover {
    transform: scale(1.05);
}

.kramit-hover-shrink {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-shrink:hover {
    transform: scale(0.95);
}

.kramit-hover-pulse {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-pulse:hover {
    animation: kramit-pulse-once 0.5s ease;
}

@keyframes kramit-pulse-once {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.kramit-hover-float {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-float:hover {
    transform: translateY(-8px);
}

.kramit-hover-sink {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-sink:hover {
    transform: translateY(4px);
}

/* Hover Shadow Effects — ::before opacity technique.
   The shadow lives on a ::before pseudo-element that is always painted.
   On hover we transition only its opacity, which is compositor-only
   and never triggers a repaint — unlike transitioning box-shadow directly. */
.kramit-hover-shadow-grow {
    position: relative;
    isolation: isolate;
}
.kramit-hover-shadow-grow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2), 0 4px 10px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transition: opacity var(--kramit-hover-duration, 0.3s) ease;
    pointer-events: none;
    z-index: -1;
}
.kramit-hover-shadow-grow:hover::before {
    opacity: 1;
}

.kramit-hover-shadow-glow {
    position: relative;
    isolation: isolate;
}
.kramit-hover-shadow-glow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 30px rgba(34, 113, 177, 0.5), 0 0 60px rgba(34, 113, 177, 0.3);
    opacity: 0;
    transition: opacity var(--kramit-hover-duration, 0.3s) ease;
    pointer-events: none;
    z-index: -1;
}
.kramit-hover-shadow-glow:hover::before {
    opacity: 1;
}

.kramit-hover-shadow-lift {
    position: relative;
    isolation: isolate;
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-shadow-lift::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transition: opacity var(--kramit-hover-duration, 0.3s) ease;
    pointer-events: none;
    z-index: -1;
}
.kramit-hover-shadow-lift:hover {
    transform: translateY(-5px);
}
.kramit-hover-shadow-lift:hover::before {
    opacity: 1;
}

.kramit-hover-border-fade {
    transition: border-color var(--kramit-hover-duration, 0.3s) ease;
    border: 2px solid transparent;
}
.kramit-hover-border-fade:hover {
    border-color: #2271b1;
}

.kramit-hover-underline-grow {
    position: relative;
}
.kramit-hover-underline-grow::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #2271b1;
    transition: width var(--kramit-hover-duration, 0.3s) ease, left var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-underline-grow:hover::after {
    width: 100%;
    left: 0;
}

.kramit-hover-wobble {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-wobble:hover {
    animation: kramit-wobble 0.8s ease;
}

@keyframes kramit-wobble {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(-5deg); }
    30% { transform: rotate(4deg); }
    45% { transform: rotate(-3deg); }
    60% { transform: rotate(2deg); }
    75% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

.kramit-hover-buzz {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-buzz:hover {
    animation: kramit-buzz 0.4s linear;
}

@keyframes kramit-buzz {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

.kramit-hover-rotate-slight {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-rotate-slight:hover {
    transform: rotate(3deg);
}

.kramit-hover-skew {
    transition: transform var(--kramit-hover-duration, 0.3s) ease;
}
.kramit-hover-skew:hover {
    transform: skewX(-3deg);
}

/* Continuous Loop Animations */
.kramit-loop-pulse {
    animation: kramit-loop-pulse var(--kramit-loop-speed, 2s) ease infinite;
}

@keyframes kramit-loop-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.kramit-loop-bounce {
    animation: kramit-loop-bounce var(--kramit-loop-speed, 2s) ease infinite;
}

@keyframes kramit-loop-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-15px); }
    60% { transform: translateY(-8px); }
}

.kramit-loop-shake {
    animation: kramit-loop-shake var(--kramit-loop-speed, 2s) linear infinite;
}

/* Single-play burst used by JS-driven interval timing (initShakeIntervals) */
.kramit-shake-burst {
    animation: kramit-loop-shake var(--kramit-loop-speed, 0.5s) linear !important;
}

@keyframes kramit-loop-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(calc(-1 * var(--kramit-loop-intensity, 2px))); }
    20%, 40%, 60%, 80% { transform: translateX(var(--kramit-loop-intensity, 2px)); }
}

.kramit-loop-swing {
    animation: kramit-loop-swing var(--kramit-loop-speed, 2s) ease-in-out infinite;
    transform-origin: top center;
}

@keyframes kramit-loop-swing {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(10deg); }
    40% { transform: rotate(-8deg); }
    60% { transform: rotate(5deg); }
    80% { transform: rotate(-3deg); }
}

.kramit-loop-float {
    animation: kramit-loop-float var(--kramit-loop-speed, 2s) ease-in-out infinite;
}

@keyframes kramit-loop-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.kramit-loop-glow {
    animation: kramit-loop-glow var(--kramit-loop-speed, 2s) ease-in-out infinite;
}

@keyframes kramit-loop-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(34, 113, 177, 0.3); }
    50% { box-shadow: 0 0 25px rgba(34, 113, 177, 0.6), 0 0 50px rgba(34, 113, 177, 0.3); }
}

.kramit-loop-heartbeat {
    animation: kramit-loop-heartbeat var(--kramit-loop-speed, 2s) ease-in-out infinite;
}

@keyframes kramit-loop-heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* =========================================
   Logo Carousel Responsive
   ========================================= */
.kramit-logo-carousel-widget {
    width: 100%;
    overflow: hidden;
}

.kramit-logos-track {
    display: flex;
    transition: transform 0.5s ease;
}

.kramit-logo-item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kramit-logo-item img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Logo carousel tablet */
@media (max-width: 1024px) {
    .kramit-logo-carousel-widget .kramit-logo-item {
        flex: 0 0 calc(33.333% - 20px) !important;
    }
}

/* Logo carousel mobile */
@media (max-width: 640px) {
    .kramit-logo-carousel-widget .kramit-logo-item {
        flex: 0 0 calc(50% - 10px) !important;
    }
    
    .kramit-logo-carousel-widget .kramit-logos-arrow {
        display: none !important;
    }
}

/* =========================================
   Enhanced Mobile/Tablet Stacking
   ========================================= */

/* Ensure widgets don't overlap on smaller screens */
@media (max-width: 1024px) {
    .kramit-builder-layout {
        overflow: visible !important;
    }
    
    /* Ensure all widgets have proper box model */
    .kramit-builder-layout .kramit-widget {
        box-sizing: border-box !important;
        max-width: 100% !important;
    }
    
    /* Images scale properly */
    .kramit-widget img {
        max-width: 100%;
        height: auto;
    }
    
    /* Text scales properly */
    .kramit-heading-widget h1,
    .kramit-heading-widget h2,
    .kramit-heading-widget h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Portrait phone specific */
@media (max-width: 480px) {
    .kramit-builder-layout .kramit-widget {
        left: 5px !important;
        width: calc(100% - 10px) !important;
    }
    
    /* Smaller padding on mobile */
    .kramit-text-widget,
    .kramit-heading-widget,
    .kramit-button-widget {
        padding: 10px;
    }
    
    /* CTA adjustments */
    .kramit-cta-widget {
        padding: 20px 15px !important;
    }
    
    .kramit-cta-widget h2 {
        font-size: 24px !important;
    }
    
    .kramit-cta-widget p {
        font-size: 14px !important;
    }
}

/* Landscape phone (wider viewport, shorter height).
   pointer:coarse scopes this to actual touch devices so desktop browsers
   with devtools docked at the bottom do not trigger a mobile-style reflow. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    .kramit-builder-layout .kramit-widget {
        left: 10px !important;
        width: calc(100% - 20px) !important;
    }
    
    /* Reduce widget heights in landscape to fit */
    .kramit-slide,
    .kramit-carousel-slide {
        max-height: 60vh;
    }
}

/* =========================================
   Reduced Motion
   Respects the OS/browser "reduce motion" accessibility preference (WCAG 2.1).
   Entrance animations are disabled and elements are made immediately visible.
   Loop and hover animations are suppressed to a minimum.
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    /* Entrance animations — make elements visible immediately, no motion */
    .kramit-animated {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    /* Continuous loop animations */
    .kramit-loop-pulse,
    .kramit-loop-bounce,
    .kramit-loop-shake,
    .kramit-loop-swing,
    .kramit-loop-float,
    .kramit-loop-glow,
    .kramit-loop-heartbeat {
        animation: none !important;
    }

    /* Hover animations that trigger keyframe sequences */
    .kramit-hover-wobble:hover,
    .kramit-hover-buzz:hover,
    .kramit-hover-pulse:hover {
        animation: none !important;
    }

    /* Suppress carousel and slider transitions */
    .kramit-carousel-slides,
    .kramit-slider-track,
    .kramit-logos-track {
        transition: none !important;
    }
}

/* ==========================================================================
   Kramit Custom Cart Layouts
   ========================================================================== */

/* ── Shared: button ─────────────────────────────────────────────────────── */
.kramit-cart-custom .kramit-btn {
    display: inline-block;
    text-decoration: none;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 11px 20px;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    transition: opacity 0.2s ease;
    background: var(--kramit-btn-bg, #0073aa);
    color: var(--kramit-btn-txt, #ffffff);
}
.kramit-cart-custom .kramit-btn:hover { opacity: 0.85; }

/* ── Shared: empty state ────────────────────────────────────────────────── */
.kramit-cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.kramit-cart-empty svg {
    display: block;
    margin: 0 auto 20px;
    color: #ccc;
}
.kramit-cart-empty p {
    font-size: 16px;
    margin: 0 0 20px;
}

/* ── Shared: heading ────────────────────────────────────────────────────── */
.kramit-cart-heading {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--kramit-border, #e0e0e0);
}

/* ── Shared: qty stepper ────────────────────────────────────────────────── */
.kramit-qty-wrap {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--kramit-border, #e0e0e0);
    border-radius: 4px;
    overflow: hidden;
    height: 30px;
    flex-shrink: 0;
}
.kramit-qty-wrap button.kramit-qty-minus,
.kramit-qty-wrap button.kramit-qty-plus {
    width: 26px !important;
    min-width: 26px !important;
    max-width: 26px !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    background: var(--kramit-qty-bg, #f0f0f0) !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    font-size: 15px !important;
    line-height: 30px !important;
    color: var(--kramit-qty-txt, #333333) !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: filter 0.15s !important;
    text-shadow: none !important;
    flex-shrink: 0 !important;
}
.kramit-qty-wrap button.kramit-qty-minus:hover,
.kramit-qty-wrap button.kramit-qty-plus:hover {
    filter: brightness(0.9) !important;
}
.kramit-qty-wrap button.kramit-qty-minus::before,
.kramit-qty-wrap button.kramit-qty-minus::after,
.kramit-qty-wrap button.kramit-qty-plus::before,
.kramit-qty-wrap button.kramit-qty-plus::after {
    display: none !important;
    content: none !important;
}
.kramit-qty-wrap .kramit-qty-input {
    width: 34px !important;
    min-width: 34px !important;
    height: 30px !important;
    border: none !important;
    border-left: 1px solid var(--kramit-border, #e0e0e0) !important;
    border-right: 1px solid var(--kramit-border, #e0e0e0) !important;
    text-align: center !important;
    font-size: 13px !important;
    -moz-appearance: textfield !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex-shrink: 0;
    display: block;
}
.kramit-qty-wrap .kramit-qty-input::-webkit-inner-spin-button,
.kramit-qty-wrap .kramit-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Shared: trash/remove button ────────────────────────────────────────── */
.kramit-cart-remove {
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    color: var(--kramit-remove-clr, #cc0000) !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background 0.2s !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
}
.kramit-cart-remove::before,
.kramit-cart-remove::after {
    display: none !important;
    content: none !important;
}
.kramit-cart-remove:hover {
    background: rgba(0,0,0,0.06) !important;
    border-radius: 4px !important;
}

/* ── Shared: item card — list mode ──────────────────────────────────────── */
.kramit-cart-card--list {
    display: flex;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--kramit-border, #e0e0e0);
    position: relative;
    transition: opacity 0.2s;
}
.kramit-cart-card--list .kramit-cart-card__image-link {
    flex: 0 0 90px;
}
.kramit-cart-card--list .kramit-cart-card__image-link img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.kramit-cart-card--list .kramit-cart-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.kramit-cart-card--list .kramit-cart-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}
.kramit-cart-card__name {
    font-weight: 600;
    font-size: 14px;
    color: inherit;
    text-decoration: none;
    line-height: 1.4;
}
.kramit-cart-card__name:hover { text-decoration: underline; }
.kramit-cart-card__meta {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}
.kramit-cart-card__meta dl, .kramit-cart-card__meta dt, .kramit-cart-card__meta dd {
    display: inline;
    margin: 0;
}
.kramit-cart-card__price {
    font-size: 13px;
    color: #666;
}
.kramit-cart-card__price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
}
.kramit-cart-card__subtotal {
    font-weight: 700;
    font-size: 15px;
    margin-left: auto;
}

/* ── Shared: item card — grid mode ──────────────────────────────────────── */
.kramit-cart-card--grid {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--kramit-border, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.2s;
    background: #fff;
}
.kramit-cart-card--grid:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.kramit-cart-card--grid .kramit-cart-card__image-link { display: block; }
.kramit-cart-card--grid .kramit-cart-card__image-link img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}
.kramit-cart-card--grid .kramit-cart-card__body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.kramit-cart-card--grid .kramit-cart-card__price { font-size: 13px; color: #666; }
.kramit-cart-card--grid .kramit-cart-card__qty-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--kramit-border, #e0e0e0);
}
.kramit-cart-card--grid .kramit-cart-card__subtotal {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}
.kramit-cart-remove--corner {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    background: rgba(255,255,255,0.92) !important;
    border-radius: 4px !important;
    width: 26px !important;
    height: 26px !important;
    min-width: 26px !important;
    min-height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    z-index: 1 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12) !important;
}
.kramit-cart-remove--corner:hover {
    background: #fff !important;
    color: #e53935 !important;
}

/* ── Shared: remove animation ───────────────────────────────────────────── */
.kramit-cart-card--removing {
    opacity: 0.35;
    pointer-events: none;
}
.kramit-cart-card--gone {
    opacity: 0;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
}

/* ── Shared: order summary panel ────────────────────────────────────────── */
.kramit-cart-totals-panel {
    background: #f9f9f9;
    border: 1px solid var(--kramit-border, #e0e0e0);
    border-radius: 8px;
    padding: 24px;
}
.kramit-cart-totals-heading {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--kramit-border, #e0e0e0);
}
.kramit-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--kramit-border, #e0e0e0);
}
.kramit-totals-row:last-of-type { border-bottom: none; }
.kramit-totals-row--total {
    font-weight: 700;
    font-size: 16px;
    padding-top: 14px;
    margin-top: 4px;
    border-top: 2px solid var(--kramit-border, #e0e0e0);
    border-bottom: none;
}
.kramit-coupon-form {
    display: flex;
    gap: 8px;
    margin: 18px 0 0;
}
.kramit-coupon-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--kramit-border, #e0e0e0);
    border-radius: 4px;
    font-size: 13px;
}
.kramit-coupon-btn {
    padding: 8px 14px;
    font-size: 13px;
    white-space: nowrap;
}
.kramit-checkout-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 14px;
    font-size: 15px;
    border-radius: 6px;
    margin-top: 18px;
}
.kramit-continue-shopping {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: #777;
    text-decoration: none;
}
.kramit-continue-shopping:hover { text-decoration: underline; }

/* ── Layout: Two Column ─────────────────────────────────────────────────── */
.kramit-cart-two-column {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}
.kramit-cart-two-column .kramit-cart-items-col { flex: 1; min-width: 0; }
.kramit-cart-two-column .kramit-cart-totals-col {
    flex: 0 0 320px;
    position: sticky;
    top: 20px;
}

/* ── Layout: Panel ──────────────────────────────────────────────────────── */
.kramit-cart-panel {
    border: 1px solid var(--kramit-border, #e0e0e0);
    border-radius: 10px;
    overflow: hidden;
}
.kramit-cart-panel .kramit-panel-header {
    padding: 20px 24px 0;
}
.kramit-cart-panel .kramit-panel-items {
    padding: 0 24px;
}
.kramit-cart-panel .kramit-panel-footer {
    padding: 0 24px 24px;
    margin-top: 8px;
}
.kramit-cart-panel .kramit-cart-totals-panel {
    background: #fff;
    border: none;
    border-top: 2px solid var(--kramit-border, #e0e0e0);
    border-radius: 0;
    padding: 20px 0 0;
}

/* ── Layout: Image Grid ─────────────────────────────────────────────────── */
.kramit-cart-grid-layout .kramit-cart-grid-wrap {
    display: flex;
    align-items: flex-start;
    gap: 40px;
}
.kramit-cart-grid-layout .kramit-cart-items-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat( var(--kramit-cart-cols, 3), 1fr );
    gap: 16px;
    min-width: 0;
}
.kramit-cart-grid-layout .kramit-cart-totals-col {
    flex: 0 0 300px;
    position: sticky;
    top: 20px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .kramit-cart-two-column {
        flex-direction: column;
        gap: 30px;
    }
    .kramit-cart-two-column .kramit-cart-totals-col {
        flex: none;
        width: 100%;
        position: static;
    }
    .kramit-cart-grid-layout .kramit-cart-grid-wrap {
        flex-direction: column;
        gap: 30px;
    }
    .kramit-cart-grid-layout .kramit-cart-totals-col {
        flex: none;
        width: 100%;
        position: static;
    }
    .kramit-cart-grid-layout .kramit-cart-items-grid {
        grid-template-columns: repeat( var(--kramit-cart-cols-tablet, 2), 1fr );
    }
}
@media (max-width: 540px) {
    .kramit-cart-card--list {
        gap: 10px;
    }
    .kramit-cart-card--list .kramit-cart-card__image-link { flex: 0 0 70px; }
    .kramit-cart-card--list .kramit-cart-card__image-link img { width: 70px; height: 70px; }
    .kramit-cart-card__subtotal { font-size: 14px; }
    .kramit-cart-grid-layout .kramit-cart-items-grid {
        grid-template-columns: 1fr 1fr;
    }
    .kramit-cart-panel { border-radius: 6px; }
    .kramit-cart-panel .kramit-panel-header,
    .kramit-cart-panel .kramit-panel-items,
    .kramit-cart-panel .kramit-panel-footer { padding-left: 16px; padding-right: 16px; }
}
}