/**
 * FabricLab Product Page Styles
 * @version 1.1.0
 */

/* === Pattern Preview Button === */
.fl-pattern-preview-button {
    text-align: center;
    margin: 15px 0 10px 0;
}

.fl-pattern-fullscreen-btn {
    background-color: #ee7f51;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.fl-pattern-fullscreen-btn:hover {
    background-color: #df6a39;
}

/* === Pattern Modal === */
.fl-pattern-modal {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    flex-direction: column;
}

.fl-pattern-modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    color: #fff;
}

/* Info bar */
.fl-pattern-info {
    background-color: rgba(238, 127, 81, 0.9);
    color: #fff;
    padding: 14px 50px 14px 50px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Close button */
.fl-pattern-close {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    padding: 0 8px;
    transition: color 0.2s;
}

.fl-pattern-close:hover {
    color: #f97316;
}

/* Canvas container */
.fl-pattern-canvas-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.fl-pattern-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loader */
.fl-pattern-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #9ca3af;
}

/* Controls bar */
.fl-pattern-controls {
    padding: 12px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    text-align: center;
    flex-shrink: 0;
}

.fl-pattern-controls label {
    font-size: 14px;
    color: #d1d5db;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.fl-pattern-controls input[type="range"] {
    width: 220px;
    vertical-align: middle;
    cursor: pointer;
}

/* ==========================================================================
   Product Meta
   ========================================================================== */

.fl-product-meta {
    margin: 20px 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 14px;
    color: var(--theme-color-text, #4b5563);
    border: 1px solid #f0f0f0;
    background-color: #f5f5f5;
    border-radius: 10px;
}

/* Heading — pomarańczowa linia pod spodem, duży odstęp od góry */
.fl-product-meta__heading {
    font-size: 15px;
    font-weight: 600;
    color: var(--theme-color-text_dark, #1f2937);
    margin: 20px 0 10px 0 !important;
    padding: 0 0 8px 0 !important;
    line-height: 1.4;
    border-bottom: 1px solid #ee7f51;
}

/* Pierwszy heading w kontenerze — bez margin-top */
.fl-product-meta > .fl-product-meta__heading:first-child,
.fl-feature-icons-wrapper > .fl-product-meta__heading:first-child {
    margin-top: 0 !important;
}

/* Feature icons wrapper */
.fl-feature-icons-wrapper {
    margin: 20px 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: 14px;
    color: var(--theme-color-text, #4b5563);
    border: 1px solid #f0f0f0;
    background-color: #f5f5f5;
    border-radius: 10px;
}

/* Tabela meta (SKU, kategoria — pod sobą, wyrównane kolumny) */
.fl-product-meta__table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
}

.fl-product-meta__item td {
    padding: 6px 0;
    vertical-align: baseline;
    line-height: 1.5;
    border: none;
    background: none !important;
}

.fl-product-meta__table tr + tr td {
    border-top: 1px dashed #c9cdd3;
}

.fl-product-meta__label {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
    padding-right: 12px !important;
    width: 1%;
}

.fl-product-meta__value {
    color: var(--theme-color-text_dark, #374151);
}

.fl-product-meta__value a {
    color: var(--theme-color-text, #6b7280);
    text-decoration: none;
    transition: color 0.2s;
}

.fl-product-meta__value a:hover {
    color: var(--theme-color-text_link, #4f46e5);
}

.fl-product-meta__divider {
    border: none !important;
    border-top: 1px dashed #c9cdd3 !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* Tags row */
.fl-product-meta__tags-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fl-product-meta__tags-row > .fl-product-meta__label {
    font-weight: 500;
    color: #6b7280;
}

.fl-product-meta__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ==========================================================================
   Material Design Chips (tagi)
   ========================================================================== */

.fl-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    line-height: 1.4;
    white-space: nowrap;
}

.fl-chip:hover {
    background: #e0e7ff;
    border-color: #818cf8;
    color: #4338ca;
}

.fl-chip__icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
}

.fl-chip:hover .fl-chip__icon {
    opacity: 1;
}

/* ==========================================================================
   Feature Icons (ikonki z opisem)
   ========================================================================== */

.fl-feature-icons {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    margin: 0;
}

.fl-feature-icons__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 12px 0;
}

.fl-feature-icons__icon {
    width: 32px;
    height: 32px;
    color: var(--theme-color-text_link, #4f46e5);
    flex-shrink: 0;
}

.fl-feature-icons__icon svg {
    width: 100%;
    height: 100%;
}

.fl-feature-icons__text {
    font-size: 13px;
    font-weight: 500;
    color: var(--theme-color-text, #4b5563);
    line-height: 1.3;
}

/* ==========================================================================
   Delivery Time (czas realizacji)
   Wyróżniony boks z pomarańczowym akcentem — przyciąga uwagę klienta.
   ========================================================================== */

.fl-delivery-time-wrapper {
    margin: 20px 0;
    padding: 18px 20px;
    font-size: 14px;
    color: #4b5563;
    border: 1px solid #f0f0f0;
    background-color: #ffffff;
    border-radius: 10px;
}

/* Pierwszy heading w kontenerze — bez margin-top (jak w meta i feature-icons) */
.fl-delivery-time-wrapper > .fl-product-meta__heading:first-child {
    margin-top: 0 !important;
}

.fl-delivery-time__body {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-top: 4px;
}

.fl-delivery-time__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #fed7aa;
    border-radius: 50%;
    color: #f97316;
    line-height: 1;
}

.fl-delivery-time__icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.fl-delivery-time__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fl-delivery-time__highlight {
    font-size: 18px;
    font-weight: 700;
    color: #f97316;
    line-height: 1.2;
    margin: 2px 0 0 0;
}

.fl-delivery-time__description {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin: 6px 0 0 0;
}

/* Mobile: kompaktowy układ — ikona mniejsza, mniejszy padding */
@media (max-width: 600px) {
    .fl-delivery-time-wrapper {
        padding: 14px 16px;
        gap: 12px;
    }

    .fl-delivery-time__icon {
        width: 38px;
        height: 38px;
    }

    .fl-delivery-time__icon svg {
        width: 19px;
        height: 19px;
    }

    .fl-delivery-time__highlight {
        font-size: 16px;
    }
}

/* ==========================================================================
   Mobile: elementy galerii pod konfiguratorem/podsumowaniem
   Na mobile JS nie przenosi do div.images — elementy zostają po summary.
   ========================================================================== */

/* Gallery element wrappers — transparent, no extra spacing */
.fl-gallery-el {
    display: contents;
}

/* Kontener galerii na mobile/tablet — pełna szerokość, wyjście z float context.
   Na desktop (>1023px) JS przenosi elementy do div.images i usuwa kontener,
   więc te reguły nie przeszkadzają. */
.fl-gallery-elements {
    clear: both;
    width: 100%;
}

/* Mobile/tablet: jednokolumnowy layout produktu.
   Printy float layout (images 45% float:left + summary 55% float:right)
   musi zostać nadpisany na mobile, bo bez elementu .fl-mobile-preview-button
   (którego nie ma dla paneli — tylko wzory) floaty nie są przerywane i
   summary ucieka w prawo obok zdjęcia.
   Breakpoint 1023px = Printy single-column transition. */
@media (max-width: 1023px) {
    .woocommerce div.product div.images,
    .woocommerce-page div.product div.images {
        float: none !important;
        width: 100% !important;
    }

    .woocommerce div.product div.summary,
    .woocommerce-page div.product div.summary {
        float: none !important;
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* ==========================================================================
   WAPF Text Swatches — desktop 5 kolumn, mobile 3 kolumny
   ========================================================================== */

.wapf-swatch-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wapf-swatch--text {
    flex: 0 0 calc(20% - 8px);
    max-width: calc(20% - 8px);
    width: auto !important;
    min-width: 0;
    box-sizing: border-box;
    margin: 0 !important;
}

@media (max-width: 767px) {
    .wapf-swatch--text {
        flex: 0 0 calc(33.333% - 7px);
        max-width: calc(33.333% - 7px);
    }
}

/* Zaznaczony text swatch — białe tło zamiast domyślnego #353c4e */
.wapf-swatch--text.wapf-checked {
    background: #fff !important;
    color: #353c4e !important;
    border-color: #008d7e !important;
}

/* Mobile preview button — ukryty na desktop, widoczny na mobile */
.fl-mobile-preview-button {
    display: none;
}

/* Tytuł przeniesiony przez JS nad galerię na mobile */
.fl-mobile-title {
    display: none;
}

@media (max-width: 767px) {

    /* ─── Mobile: tytuł produktu NAD galerią ────────────────────── */
    /* JS przenosi h1.product_title do wrappera .fl-mobile-title PRZED div.images.
       Oryginalny h1 w .summary jest ukrywany. */
    .fl-mobile-title {
        display: block;
        width: 100%;
        clear: both;
    }

    .fl-mobile-title .product_title {
        margin: 0 0 10px 0;
    }

    /* Ukryj oryginalny tytuł w summary na mobile (JS przenosi go nad galerię) */
    .woocommerce div.product.fl-mobile-title-moved div.summary .product_title,
    .woocommerce div.product.fl-mobile-title-moved .entry-summary .product_title {
        display: none !important;
    }

    /* Przycisk preview — tuż pod galerią, 10px wyżej */
    .fl-mobile-preview-button {
        display: block;
        width: 100%;
        margin: -15px 0 10px 0;
    }

    .fl-product-meta {
        margin: 20px 0;
    }

    .fl-feature-icons {
        margin: 20px 0;
    }

    /* ─── Podobne produkty — 2 kolumny na mobile z marginesem 10px ─ */
    .woocommerce.single-product .related ul.products,
    .woocommerce.single-product .upsells ul.products {
        margin-right: -10px !important;
    }

    .woocommerce.single-product .related ul.products li.product,
    .woocommerce.single-product .upsells ul.products li.product {
        width: 50% !important;
        padding-right: 10px !important;
        padding-bottom: 20px !important;
    }

}

/* Nadpisanie Printy max-width:479px — utrzymanie 2 kolumn zamiast 1 */
@media (max-width: 479px) {
    .woocommerce.single-product .related ul.products li.product,
    .woocommerce.single-product .upsells ul.products li.product {
        width: 50% !important;
        padding-right: 10px !important;
    }
}
