/**
 * ColorStories Product News - Frontend Styles ze Swiper.js
 * Zgodne z wymaganiami feedbacku klienta
 *
 * @package ColorStories_Product_News
 */

/* ==========================================================================
   Sekcja główna
   ========================================================================== */

.cs-news {
    margin: 0 0 40px;
    padding: 30px 20px;
    background-color: #DACFC1; /* Beżowe tło zgodne ze screenshotami */
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Zapobiega poziomemu scrollowi */
}

.cs-news__container {
    max-width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Nagłówek sekcji
   ========================================================================== */

.cs-news__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.cs-news__title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #323332; /* Ciemny kolor zgodnie z feedbackiem */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cs-news__count {
    font-size: 14px;
    color: #666;
    background-color: rgba(255,255,255,0.6);
    padding: 5px 15px;
    border-radius: 20px;
}

/* ==========================================================================
   Swiper container
   ========================================================================== */

.cs-news__swiper {
    position: relative;
    overflow: hidden;
    margin: 0 -20px; /* Kompensacja paddingu dla pełnej szerokości na mobile */
    padding: 0 20px;
}

@media (min-width: 768px) {
    .cs-news__swiper {
        margin: 0;
        padding: 0;
    }
}

.cs-news__products {
    margin-bottom: 30px;
}

/* ==========================================================================
   Pojedynczy produkt (slide)
   ========================================================================== */

.cs-news__item {
    height: auto;
}

/* Ukryty element - używane przy ładowaniu więcej */
.cs-news__item--hidden {
    display: none !important;
}

.cs-news__inner {
    background-color: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Brak border-radius zgodnie z feedbackiem */
    transition: box-shadow 0.3s ease;
}

.cs-news__inner:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Obrazek produktu - kwadratowy format
   ========================================================================== */

.cs-news__image-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #f6f6f6;
    padding-bottom: 100%; /* Kwadratowy aspect ratio */
}

.cs-news__image-link {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cs-news__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover dla pełnego wypełnienia */
}

/* ==========================================================================
   Etykiety - USUNIĘTE zgodnie z feedbackiem
   ========================================================================== */

/* Badge nowości usunięty zgodnie z feedbackiem */
.cs-news__badge-wrapper,
.cs-news__new-badge {
    display: none !important;
}

.cs-news__sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-block;
    background-color: #e22d2d;
    color: #fff;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    z-index: 1;
}

/* ==========================================================================
   Akcje produktu - kompatybilność z WoodMart
   ========================================================================== */

.cs-news__actions {
    padding: 10px 15px;
    background-color: transparent;
    margin-top: -1px; /* Przykleja do obrazka */
}

/* Wsparcie dla przycisku WoodMart */
.cs-news__actions .wd-add-btn,
.cs-news__actions .wd-add-btn-replace {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Selektor ilości WoodMart */
.cs-news__actions .quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(0,0,0,0.1);
    background: #fff;
    border-radius: 0;
    overflow: hidden;
}

.cs-news__actions .quantity input[type="button"],
.cs-news__actions .quantity .btn {
    width: 30px;
    height: 35px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    transition: background-color 0.2s;
}

.cs-news__actions .quantity input[type="button"]:hover {
    background-color: #f5f5f5;
}

.cs-news__actions .quantity .qty {
    width: 40px;
    height: 35px;
    text-align: center;
    border: none;
    border-left: 1px solid rgba(0,0,0,0.1);
    border-right: 1px solid rgba(0,0,0,0.1);
    font-size: 14px;
    -moz-appearance: textfield;
}

.cs-news__actions .quantity .qty::-webkit-outer-spin-button,
.cs-news__actions .quantity .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Przycisk dodaj do koszyka */
.cs-news__actions .button,
.cs-news__actions .add_to_cart_button {
    flex: 1;
    padding: 10px 15px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    color: #fff;
    background-color: #333;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.cs-news__actions .button:hover,
.cs-news__actions .add_to_cart_button:hover {
    background-color: #555;
    color: #fff;
}

/* Ikona ładowania WoodMart */
.cs-news__actions .wd-loader:after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: wd-rotate 0.8s linear infinite;
}

@keyframes wd-rotate {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Zawartość produktu
   ========================================================================== */

.cs-news__content {
    padding: 15px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #3A3A39; /* Ciemne tło jak na screenshocie */
}

.cs-news__product-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
}

.cs-news__product-title a {
    color: #fff; /* Biały tekst na ciemnym tle */
    text-decoration: none;
}

.cs-news__product-title a:hover {
    text-decoration: underline;
}

/* Style dla tagów HTML w nazwach produktów */
.cs-news__product-title em,
.cs-news__product-title i {
    font-style: italic;
    font-weight: 300;
    opacity: 0.9;
}

.cs-news__product-title strong,
.cs-news__product-title b {
    font-weight: 700;
}

/* Cena */
.cs-news__price {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff; /* Biała cena zgodnie z feedbackiem */
}

.cs-news__price del {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    margin-right: 5px;
    font-size: 14px;
}

.cs-news__price ins {
    text-decoration: none;
    color: #ffffff;
}

.cs-news__rating {
    margin-top: auto;
    font-size: 12px;
}

.cs-news__rating .star-rating {
    font-size: 12px;
    margin: 0 auto;
}

/* ==========================================================================
   Nawigacja Swiper - strzałki
   ========================================================================== */

.cs-news__nav {
    /* Reset domyślnych stylów Swiper */
    width: 40px;
    height: 40px;
    margin-top: 0;
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.cs-news__nav:after {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.cs-news__nav:hover {
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.cs-news__nav.swiper-button-disabled {
    opacity: 0.3;
}

/* Pozycjonowanie strzałek na mobile */
@media (max-width: 767px) {
    .cs-news__nav {
        width: 35px;
        height: 35px;
    }
    
    .cs-news__nav:after {
        font-size: 14px;
    }
    
    .cs-news__nav--prev {
        left: 10px;
    }
    
    .cs-news__nav--next {
        right: 10px;
    }
}

/* ==========================================================================
   Paginacja Swiper - dots
   ========================================================================== */

.cs-news__pagination {
    position: relative;
    text-align: center;
    margin-top: 20px;
}

.cs-news__pagination .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.2);
    opacity: 1;
    transition: all 0.3s ease;
}

.cs-news__pagination .swiper-pagination-bullet-active {
    background-color: #333;
    width: 24px;
    border-radius: 4px;
}

/* Ukryj paginację na desktop */
@media (min-width: 768px) {
    .cs-news__pagination {
        display: none;
    }
}

/* ==========================================================================
   Footer sekcji i przycisk "Zobacz więcej"
   ========================================================================== */

.cs-news__footer {
    text-align: center;
    margin-top: 20px;
}

.cs-news__more-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #333;
    background-color: transparent;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Brak border-radius */
}

.cs-news__more-button:hover {
    color: #fff;
    background-color: #333;
}

.cs-news__more-count {
    font-size: 12px;
    opacity: 0.7;
}

/* ==========================================================================
   Loading spinner
   ========================================================================== */

.cs-news__loading {
    display: none;
}

.cs-news__more-button.is-loading .cs-news__loading {
    display: inline-block;
}

.cs-news__more-button.is-loading .cs-news__more-text,
.cs-news__more-button.is-loading .cs-news__more-count {
    display: none;
}

.cs-news__spinner {
    animation: cs-news-spin 1s linear infinite;
}

@keyframes cs-news-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Animacje wejścia
   ========================================================================== */

.cs-news__item.cs-news--fade-in {
    animation: cs-news-fade-in 0.5s ease forwards;
    opacity: 0;
}

@keyframes cs-news-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Komunikaty błędów
   ========================================================================== */

.cs-news__error {
    padding: 15px;
    background-color: #f44336;
    color: white;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
}

/* ==========================================================================
   Poprawki dla edge cases
   ========================================================================== */

/* Zapewnienie widoczności przycisku dodaj do koszyka dla wszystkich produktów */
.cs-news__item .cs-news__actions {
    opacity: 1;
    transform: none;
    position: static;
}

/* Naprawienie kolorów dla różnych typów produktów */
.cs-news__item .product_type_variable,
.cs-news__item .product_type_grouped,
.cs-news__item .product_type_external,
.cs-news__item .add_to_cart_button {
    background-color: #333;
    color: #fff;
}

/* Wsparcie dla produktów bez obrazków */
.cs-news__image--placeholder {
    background-color: #f0f0f0;
}

/* ==========================================================================
   Responsywność
   ========================================================================== */

@media (max-width: 767px) {
    .cs-news {
        padding: 20px 0;
    }
    
    .cs-news__container {
        padding: 0 15px;
    }
    
    .cs-news__header {
        flex-direction: row;
        gap: 10px;
        padding: 0 15px;
    }
    
    .cs-news__title {
        font-size: 14px;
        color: #323332;
    }
    
    /* Zmniejszenie przerwy między obrazkiem a tekstem */
    .cs-news__content {
        padding: 10px;
    }
}
