/* Frontend CSS för Shopping Carousel Widget */

.carouse.carousel-item-shopping-widget {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 200px;
    background-color: #f7f7f7;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

/* Hover-effekter endast på desktop */
@media (hover: hover) and (pointer: fine) {
    .carousel-item-shopping-widget:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    }
    
    .carousel-item-shopping-widget:hover .carousel-image-shopping-widget img {
        transform: scale(1.05);
    }
}

.carousel-image-shopping-widget {container {
    font-family: 'Taviraj', serif, Arial, sans-serif;
    margin: 20px 0;
}

/* Shopping Widget Carousel Styles */
.shopping-widget-carousel {
    position: relative;
    max-width: 100%;
    margin: 20px auto;
    font-family: inherit; /* Kommer att överskrivas av inställningar */
    color: #222222; /* Kommer att överskrivas av inställningar */
}

/* Announcement Banner */
.shopping-widget-carousel .announcement {
    text-align: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    border: 1px solid #ddd;
}

.shopping-widget-carousel .announcement .highlight {
    font-weight: bold;
    color: #e57373; /* Kommer att överskrivas av inställningar */
}

/* Carousel Wrapper */
.shopping-widget-carousel .carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Navigation Buttons */
.shopping-widget-carousel .carousel-btn {
    background: #fff;
    border: 2px solid #ddd; /* Kommer att överskrivas av inställningar */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
    flex-shrink: 0;
    z-index: 10;
}

/* Endast desktop hover-effekter */
@media (hover: hover) and (pointer: fine) {
    .shopping-widget-carousel .carousel-btn:hover {
        background: #f0f0f0;
        border-color: #999;
        color: #333;
        transform: scale(1.05);
    }
}

.shopping-widget-carousel .carousel-btn:active {
    transform: scale(0.95);
}

.shopping-widget-carousel .carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shopping-widget-carousel .carousel-btn:disabled:hover {
    transform: none;
    background: #fff;
    border-color: #ddd;
}

/* Carousel Container */
.shopping-widget-carousel .carousel-container {
    flex: 1;
    overflow: hidden;
    border-radius: 12px;
    position: relative;
}

.shopping-widget-carousel .carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    gap: 15px;
}

/* Carousel Items */
.shopping-widget-carousel .carousel-item {
    flex: 0 0 auto;
    background: #f7f7f7; /* Kommer att överskrivas av inställningar */
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
    border: 1px solid #ddd; /* Kommer att överskrivas av inställningar */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

/* Endast desktop hover-effekter */
@media (hover: hover) and (pointer: fine) {
    .shopping-widget-carousel .carousel-item:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    }
}

/* Dynamic width calculation */
.shopping-widget-carousel[data-items-per-row="3"] .carousel-item {
    width: calc((100% - 30px) / 3);
}

.shopping-widget-carousel[data-items-per-row="4"] .carousel-item {
    width: calc((100% - 45px) / 4);
}

.shopping-widget-carousel[data-items-per-row="5"] .carousel-item {
    width: calc((100% - 60px) / 5);
}

.shopping-widget-carousel[data-items-per-row="6"] .carousel-item {
    width: calc((100% - 75px) / 6);
}

.shopping-widget-carousel[data-items-per-row="7"] .carousel-item {
    width: calc((100% - 90px) / 7);
}

.shopping-widget-carousel[data-items-per-row="8"] .carousel-item {
    width: calc((100% - 105px) / 8);
}

.shopping-widget-carousel[data-items-per-row="9"] .carousel-item {
    width: calc((100% - 120px) / 9);
}

.shopping-widget-carousel[data-items-per-row="10"] .carousel-item {
    width: calc((100% - 135px) / 10);
}

/* Image Container */
.shopping-widget-carousel .item-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f9f9f9;
}

.shopping-widget-carousel .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Endast desktop hover-effekter */
@media (hover: hover) and (pointer: fine) {
    .shopping-widget-carousel .carousel-item:hover .item-image img {
        transform: scale(1.05);
    }
}

/* Price Badge (på bild) */
.shopping-widget-carousel .price-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #e57373; /* Kommer att överskrivas av inställningar */
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 5;
}

/* Content Area */
.shopping-widget-carousel .item-content {
    padding: 15px;
    text-align: center;
}

.shopping-widget-carousel .item-title {
    font-size: 14px; /* Kommer att överskrivas av inställningar */
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;
    color: #222; /* Kommer att överskrivas av inställningar */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shopping-widget-carousel .item-price {
    font-size: 16px; /* Kommer att överskrivas av inställningar */
    font-weight: bold;
    color: #e57373; /* Kommer att överskrivas av inställningar */
    margin: 0;
}

.shopping-widget-carousel .price-top {
    margin-bottom: 8px;
}

.shopping-widget-carousel .price-bottom {
    margin-top: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .shopping-widget-carousel[data-items-per-row="8"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="9"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="10"] .carousel-item {
        width: calc((100% - 75px) / 6);
    }
}

@media (max-width: 992px) {
    .shopping-widget-carousel[data-items-per-row="6"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="7"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="8"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="9"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="10"] .carousel-item {
        width: calc((100% - 60px) / 5);
    }
}

@media (max-width: 768px) {
    .shopping-widget-carousel .carousel-wrapper {
        gap: 10px;
    }

    .shopping-widget-carousel .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }

    .shopping-widget-carousel .carousel-track {
        gap: 10px;
    }

    .shopping-widget-carousel[data-items-per-row="4"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="5"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="6"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="7"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="8"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="9"] .carousel-item,
    .shopping-widget-carousel[data-items-per-row="10"] .carousel-item {
        width: calc((100% - 30px) / 4);
    }

    .shopping-widget-carousel .item-image {
        height: 150px;
    }

    .shopping-widget-carousel .item-content {
        padding: 12px;
    }

    .shopping-widget-carousel .announcement {
        font-size: 13px;
        padding: 12px 15px;
    }
}

@media (max-width: 576px) {
    .shopping-widget-carousel .carousel-wrapper {
        gap: 8px;
    }

    .shopping-widget-carousel .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    .shopping-widget-carousel .carousel-track {
        gap: 8px;
    }

    .shopping-widget-carousel .carousel-item {
        width: calc((100% - 16px) / 3);
    }

    .shopping-widget-carousel .item-image {
        height: 120px;
    }

    .shopping-widget-carousel .item-content {
        padding: 10px;
    }

    .shopping-widget-carousel .item-title {
        font-size: 12px;
    }

    .shopping-widget-carousel .item-price {
        font-size: 14px;
    }

    .shopping-widget-carousel .announcement {
        font-size: 12px;
        padding: 10px 12px;
    }
}

@media (max-width: 400px) {
    .shopping-widget-carousel .carousel-item {
        width: calc((100% - 8px) / 2);
    }

    .shopping-widget-carousel .carousel-track {
        gap: 5px;
    }

    .shopping-widget-carousel .carousel-wrapper {
        gap: 5px;
    }
}

.carousel-container-shopping-widget {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    white-space: nowrap;
    width: 100%;
    cursor: grab;
    scroll-behavior: smooth;
    padding: 10px 0;
    gap: 20px;
}

.carousel-container-shopping-widget.active {
    cursor: grabbing;
}

.carousel-container-shopping-widget::-webkit-scrollbar {
    height: 8px;
}

.carousel-container-shopping-widget::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.carousel-container-shopping-widget::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.carousel-container-shopping-widget a {
    text-decoration: none;
    color: inherit;
}

.carousel-item-shopping-widget {
    flex: 0 0 auto;
    scroll-snap-align: start;
    width: 200px;
    background-color: #f7f7f7;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

/* Hover-effekter endast på desktop */
@media (hover: hover) and (pointer: fine) {
    .carousel-item-shopping-widget:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    }
    
    .carousel-item-shopping-widget:hover .carousel-image-shopping-widget img {
        transform: scale(1.05);
    }
}

.carousel-image-shopping-widget {
    width: 200px;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.carousel-image-shopping-widget img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    color: #999;
    font-size: 14px;
}

.carousel-content-shopping-widget {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.carousel-title-shopping-widget {
    text-align: center;
    margin-bottom: 8px;
}

.carousel-title-shopping-widget span {
    color: #222;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.3;
    display: block;
}

.carousel-price-shopping-widget {
    text-align: center;
    margin-top: 8px;
}

.carousel-price-shopping-widget span {
    color: #e57373;
    font-weight: bold;
    font-size: 16px;
}

.carousel-disclaimer {
    text-align: center;
    font-size: 12px;
    color: #666;
    margin-top: 15px;
    font-style: italic;
}

/* Responsiv design */
@media (max-width: 768px) {
    .carousel-container-shopping-widget {
        gap: 15px;
    }
    
    .carousel-item-shopping-widget {
        width: 160px;
    }
    
    .carousel-image-shopping-widget {
        width: 160px;
        height: 160px;
    }
    
    .carousel-announcement {
        font-size: 16px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .carousel-item-shopping-widget {
        width: 140px;
    }
    
    .carousel-image-shopping-widget {
        width: 140px;
        height: 140px;
    }
    
    .carousel-announcement {
        font-size: 14px;
        padding: 10px;
    }
    
    .carousel-content-shopping-widget {
        padding: 10px;
    }
}

/* Tillgänglighet */
.carousel-item-shopping-widget:focus-within {
    outline: 2px solid #e57373;
    outline-offset: 2px;
}

/* Smooth loading animation */
.carousel-shopping-widget-container {
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}
