/**
 * ST Mini Cart Widget Styles
 * Ersetzt PowerPack Mini Cart mit Songtastisch Design
 * 
 * @package Songtastisch
 * @version 1.0.0
 * @author Sven Schöning
 */

/* === ST MINI CART WIDGET === */

.st-mini-cart-widget {
    display: inline-block;
    position: relative;
}

/* Elementor Alignment Classes */
.elementor-align-left .st-mini-cart-widget {
    text-align: left;
}

.elementor-align-center .st-mini-cart-widget {
    text-align: center;
}

.elementor-align-right .st-mini-cart-widget {
    text-align: right;
}

/* Responsive Alignment */
@media (max-width: 1024px) {
    .elementor-tablet-align-left .st-mini-cart-widget {
        text-align: left;
    }
    
    .elementor-tablet-align-center .st-mini-cart-widget {
        text-align: center;
    }
    
    .elementor-tablet-align-right .st-mini-cart-widget {
        text-align: right;
    }
}

@media (max-width: 767px) {
    .elementor-mobile-align-left .st-mini-cart-widget {
        text-align: left;
    }
    
    .elementor-mobile-align-center .st-mini-cart-widget {
        text-align: center;
    }
    
    .elementor-mobile-align-right .st-mini-cart-widget {
        text-align: right;
    }
}

.st-mini-cart-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.st-mini-cart-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.st-mini-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.st-mini-cart-icon i,
.st-mini-cart-icon svg {
    transition: all 0.3s ease;
}

/* === CART COUNTER === */

.st-cart-counter {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    /* Entferne feste Größen - diese werden von Elementor Backend überschrieben */
    /* min-width: 18px;
    height: 18px;
    line-height: 18px; */
    border-radius: 50%;
    background-color: #e74c3c;
    color: #ffffff;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Counter Positionen */
.st-cart-counter.position-top-right {
    top: -8px;
    right: -8px;
}

.st-cart-counter.position-top-left {
    top: -8px;
    left: -8px;
}

.st-cart-counter.position-bottom-right {
    bottom: -8px;
    right: -8px;
}

.st-cart-counter.position-bottom-left {
    bottom: -8px;
    left: -8px;
}

.st-cart-counter.position-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Counter States */
.st-cart-counter.empty,
.st-cart-counter[data-count="0"]:not(.st-show-when-empty) {
    opacity: 0 !important;
    transform: scale(0.8) !important;
}

/* Explizite Regel für st-show-when-empty bei data-count="0" */
.st-cart-counter.st-show-when-empty[data-count="0"] {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* Center position mit st-show-when-empty */
.st-cart-counter.position-center.st-show-when-empty[data-count="0"] {
    opacity: 1 !important;
    transform: translate(-50%, -50%) scale(1) !important;
}

.st-cart-counter.has-items,
.st-cart-counter:not([data-count="0"]),
.st-cart-counter.st-show-when-empty {
    opacity: 1;
    transform: scale(1);
}

/* Spezifische Behandlung für center position */
.st-cart-counter.position-center.has-items,
.st-cart-counter.position-center:not([data-count="0"]),
.st-cart-counter.position-center.st-show-when-empty {
    transform: translate(-50%, -50%) scale(1);
}

/* Animationen - nur beim Hover, nicht beim Load */
/* .st-cart-bounce Animation entfernt - kein Pop-Up beim Seitenladen */

/* === RESPONSIVE DESIGN === */

@media (max-width: 768px) {
    .st-mini-cart-icon {
        font-size: 20px;
    }
    
    .st-cart-counter {
        font-size: 10px;
        /* Entferne feste Mobile-Größen - Elementor Backend hat Vorrang */
        /* min-width: 16px;
        height: 16px;
        line-height: 16px; */
    }
    
    .st-cart-counter.position-top-right,
    .st-cart-counter.position-top-left {
        top: -6px;
    }
    
    .st-cart-counter.position-top-right,
    .st-cart-counter.position-bottom-right {
        right: -6px;
    }
    
    .st-cart-counter.position-top-left,
    .st-cart-counter.position-bottom-left {
        left: -6px;
    }
    
    .st-cart-counter.position-bottom-right,
    .st-cart-counter.position-bottom-left {
        bottom: -6px;
    }
}

/* === HOVER EFFECTS === */

.st-mini-cart-container:hover .st-cart-counter {
    animation: st-cart-pulse 1s ease infinite;
}

@keyframes st-cart-pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 4px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* === ELEMENTOR EDITOR PREVIEW === */

.elementor-editor .st-mini-cart-widget {
    pointer-events: none;
}

.elementor-editor .st-cart-counter {
    opacity: 1 !important;
    transform: scale(1) !important;
}

/* === THEME COMPATIBILITY === */

/* Astra Theme */
.ast-header-cart .st-mini-cart-widget {
    display: inline-block;
}

/* OceanWP */
.oceanwp-cart .st-mini-cart-widget {
    display: inline-block;
}

/* Storefront */
.storefront-handheld-footer-bar .st-mini-cart-widget {
    display: inline-block;
}

/* GeneratePress */
.main-navigation .st-mini-cart-widget {
    display: inline-block;
}

/* === ACCESSIBILITY === */

.st-mini-cart-container:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.st-mini-cart-container:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .st-mini-cart-container,
    .st-mini-cart-icon,
    .st-cart-counter {
        transition: none;
    }
    
    .st-cart-counter.updated,
    .st-mini-cart-container:hover .st-cart-counter {
        animation: none;
    }
}

/* === RTL SUPPORT === */

[dir="rtl"] .st-cart-counter.position-top-right {
    left: -8px;
    right: auto;
}

[dir="rtl"] .st-cart-counter.position-top-left {
    right: -8px;
    left: auto;
}

[dir="rtl"] .st-cart-counter.position-bottom-right {
    left: -8px;
    right: auto;
}

[dir="rtl"] .st-cart-counter.position-bottom-left {
    right: -8px;
    left: auto;
}

/* === HIGH CONTRAST MODE === */

@media (prefers-contrast: high) {
    .st-cart-counter {
        border: 2px solid currentColor;
    }
}

/* === NOTICE STYLES === */

.st-mini-cart-notice {
    padding: 8px 12px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
    font-size: 14px;
    text-align: center;
}
