/**
 * Pesteczka - Zaawansowany Konfigurator Tapicerek i Tkanin
 * Frontend CSS (Wzór: Centrum Krzeseł)
 * @author Pesteczka <kontakt@pesteczka.com>
 * @copyright pesteczka.com
 */

/* 1. Kontener główny akordeonu */
body#product #content .product-block.block-same-columns > .pst-upholstery-wrapper,
.quickview .product-block.block-same-columns > .pst-upholstery-wrapper,
.pst-upholstery-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    margin-top: 1rem !important;
    margin-bottom: 1.5rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    font-family: inherit;
    box-sizing: border-box;
}

.pst-param-container {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.pst-param-container:hover {
    border-color: #cbd5e1;
}

/* 2. Belka wyboru (Trigger Bar) */
.pst-param-trigger {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px;
    background: #ffffff;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.pst-param-trigger:hover {
    background: #f8fafc;
}

.pst-trigger-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pst-trigger-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pst-trigger-selected-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.pst-trigger-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.pst-trigger-surcharge {
    font-size: 13px;
    font-weight: 600;
    color: #e11d48;
}

.pst-trigger-thumb-wrap {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pst-trigger-thumb {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pst-trigger-chevron {
    width: 20px;
    height: 20px;
    color: #94a3b8;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.pst-trigger-chevron.rotate-180 {
    transform: rotate(180deg);
}

/* 3. Wnętrze panelu po rozwinięciu */
.pst-param-panel {
    border-top: 1px solid #f1f5f9;
    padding: 16px 18px 20px 18px;
    background: #ffffff;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.pst-param-panel.collapsed {
    display: none;
}

/* 4. Filtry grup cenowych na górze panelu */
.pst-groups-filter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.pst-filter-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pst-filter-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #0f172a;
}

.pst-filter-btn.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.pst-filter-price {
    font-weight: 500;
    opacity: 0.85;
}

/* 5. Sekcja pojedynczej tkaniny / kolekcji */
.pst-fabric-section {
    margin-top: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
    width: 100%;
    box-sizing: border-box;
}

.pst-fabric-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.pst-fabric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
    width: 100%;
}

.pst-fabric-title-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pst-fabric-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.pst-spec-link {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    text-decoration: underline;
    text-underline-offset: 3px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pst-spec-link:hover {
    color: #0f172a;
}

.pst-fabric-price-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    white-space: nowrap;
}

.pst-fabric-group-badge {
    font-size: 11px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 4px;
}

.pst-fabric-price {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

/* 6. Siatka próbników (Swatches Grid) */
.pst-swatches-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .pst-swatches-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
}

@media (min-width: 768px) {
    .pst-swatches-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 10px;
    }
}

@media (min-width: 992px) {
    .pst-swatches-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 10px;
    }
}

.pst-swatch-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #ffffff;
    border: 1px solid transparent;
    padding: 4px 4px 6px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    box-sizing: border-box;
}

.pst-swatch-btn:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.pst-swatch-btn.active {
    border-color: #e11d48;
    background: #fff1f2;
    box-shadow: 0 0 0 1px #e11d48;
}

.pst-swatch-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease;
}

.pst-swatch-btn:hover .pst-swatch-thumb {
    transform: scale(1.05);
}

.pst-swatch-check {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #e11d48;
    color: #ffffff;
    border-radius: 50%;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
}

.pst-swatch-btn.active .pst-swatch-check {
    display: block;
}

.pst-swatch-code {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    margin-top: 5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 52px;
}

.pst-swatch-btn.active .pst-swatch-code {
    color: #e11d48;
    font-weight: 700;
}

/* 7. Podsumowanie na dole panelu */
.pst-bottom-summary {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.pst-bottom-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pst-bottom-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.pst-bottom-info {
    display: flex;
    flex-direction: column;
}

.pst-bottom-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
}

.pst-bottom-title {
    font-size: 13px;
    color: #0f172a;
}

.pst-bottom-price-tag {
    font-size: 14px;
    font-weight: 700;
    color: #e11d48;
    white-space: nowrap;
}

/* 8. Modal Specyfikacji */
.pst-spec-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.pst-spec-modal .modal-header {
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
}

.pst-spec-modal .modal-header .btn-close,
.pst-spec-modal .modal-header .close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
}

.pst-spec-modal .table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}

.pst-spec-modal .table td {
    font-size: 13px;
    color: #0f172a;
    vertical-align: middle;
}

/* Ukryj stary natywny blok wyboru tapicerki PrestaShop */
.product-variants-item.pst-upholstery-hidden {
    display: none !important;
}
