/**
 * Frontend styles for Tkaniny WooCommerce
 */

/* Fabric Selector on Product Page */
.tkaniny-selector-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #FAFAFF;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.tkaniny-selector-wrapper h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.tkaniny-selected-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.tkaniny-selected-text {
    margin: 0;
    font-size: 1.1em;
}

/* New display with thumbnail - nowy układ */
.tkaniny-selected-display {
    padding: 20px;
    background: white;
    border: 2px solid #2a3392;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(42, 51, 146, 0.1);
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    display: block;
    clear: both;
}

/* Grupa tkanin na górze z lewej */
.tkaniny-group-header {
    margin-bottom: 12px;
}

.tkaniny-info-value-bold {
    font-weight: 700;
    color: #2a3392;
    font-size: 1.2em;
}

/* Linia podziału */
.tkaniny-divider {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 12px 0;
}

/* Rząd z miniaturką i szczegółami */
.tkaniny-content-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 12px;
}

.tkaniny-selected-thumbnail {
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.3s;
}

.tkaniny-selected-thumbnail:hover {
    transform: scale(1.05);
}

.tkaniny-selected-thumbnail img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    display: block;
}

.tkaniny-selected-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* gap: 3px; */
    justify-content: center;
}

.tkaniny-info-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.5;
    margin: 3px 0;
}

.tkaniny-info-label {
    font-weight: 600;
    color: #666;
    font-size: 0.95em;
}

.tkaniny-info-value {
    font-weight: 500;
    color: #333;
    font-size: 1em;
}

/* Przycisk na dole - musi być wewnątrz boksa */
.tkaniny-change-btn {
    width: 100% !important;
    margin: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
    position: relative !important;
    float: none !important;
    clear: both !important;
}

.tkaniny-open-modal {
    padding: 10px 20px;
    background: #2a3392;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
    margin: 0 !important;
}

.tkaniny-open-modal:hover {
    background: #232b7c;
}

@media (max-width: 600px) {
    .tkaniny-content-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .tkaniny-selected-details {
        align-items: center;
    }

    .tkaniny-info-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .tkaniny-group-header {
        text-align: center;
    }
}

/* Simple Lightbox */
.tkaniny-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999999;
    overflow: hidden;
}

.tkaniny-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.tkaniny-lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px 20px;
    box-sizing: border-box;
    z-index: 1;
    overflow: hidden;
}

.tkaniny-lightbox-image,
img.tkaniny-lightbox-image {
    max-width: 98vw !important;
    max-height: 98vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: auto;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.tkaniny-lightbox-close {
    position: absolute;
    top: 10px;
    right: 25px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 2em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.tkaniny-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Gallery lightbox now uses Fancybox/PhotoSwipe - no custom styles needed */

/* Cart Display - Thumbnail on left (200px), details on right */
.tkaniny-cart-display {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 0 !important;
    margin: 0 !important;
}

.tkaniny-cart-thumbnail-col {
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
}

/* Fix WooCommerce cart item variations default margins and padding */
dd.variation,
dl.variation dd,
.woocommerce-cart-form__cart-item dd.variation,
.cart_item dd.variation,
dl.variation,
.woocommerce table.shop_table dl.variation,
.woocommerce-page table.shop_table dl.variation {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.tkaniny-cart-thumbnail-col img,
.tkaniny-cart-display img.tkaniny-cart-lightbox-trigger,
dl.variation dd .tkaniny-cart-thumbnail-col img {
    max-width: 120px !important;
    width: 120px !important;
    height: 120px !important;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    display: block !important;
    cursor: pointer;
    transition: all 0.3s;
}

.tkaniny-cart-thumbnail-col img:hover {
    border-color: #2a3392;
    box-shadow: 0 4px 12px rgba(42, 51, 146, 0.2);
}

.tkaniny-cart-details-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 5px;
}

.tkaniny-cart-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.6;
    font-size: 14px;
}

.tkaniny-cart-label {
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    min-width: 100px;
}

.tkaniny-cart-value {
    font-weight: 400;
    color: #555;
}

/* Responsive cart display */
@media (max-width: 600px) {
    .tkaniny-cart-display {
        flex-direction: column;
        gap: 15px;
    }

    .tkaniny-cart-thumbnail-col img {
        max-width: 150px;
    }
}

/* Modal Styles */
.tkaniny-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tkaniny-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.tkaniny-modal-content {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    max-height: 900px;
    background: white;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.tkaniny-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #eee;
    flex-shrink: 0;
}

.tkaniny-modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.tkaniny-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tkaniny-search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.tkaniny-search-toggle:hover {
    background: #f0f0f0;
    color: #2a3392;
}

.tkaniny-search-toggle.active {
    background: #2a3392;
    color: white;
}

.tkaniny-modal-close {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.tkaniny-modal-close:hover {
    background: #f0f0f0;
}

.tkaniny-back-btn {
    background: none;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    color: #2a3392;
    padding: 8px 15px;
    border-radius: 4px;
    transition: background 0.3s;
}

.tkaniny-back-btn:hover {
    background: #f0f0f0;
}

.tkaniny-modal-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 30px;
    position: relative;
}

/* Subgroups accordion style - niebieskie szpalty */
.tkaniny-subgroups-accordion {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tkaniny-subgroup-accordion-item {
    background: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.tkaniny-subgroup-header {
    background: #2a3392;
    color: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

.tkaniny-subgroup-header:hover {
    background: #232b7c;
}

.tkaniny-subgroup-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tkaniny-subgroup-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 14px;
    font-weight: bold;
}

.tkaniny-subgroup-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.tkaniny-subgroup-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: white;
}

.tkaniny-subgroup-price {
    font-size: 14px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.tkaniny-subgroup-body {
    padding: 25px;
    background: white;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.tkaniny-subgroup-body.collapsed {
    max-height: 0;
    padding: 0 25px;
}

.tkaniny-show-more-wrapper {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.tkaniny-show-more-btn {
    padding: 12px 30px;
    background: #f0f0f0;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s;
}

.tkaniny-show-more-btn:hover {
    background: #2a3392;
    color: white;
    border-color: #2a3392;
}

.tkaniny-item.hidden {
    display: none;
}

/* Global search filter - integrated as filter group */
.tkaniny-search-filter-group {
    /* Same styles as other filter groups */
}

.tkaniny-global-search-wrapper {
    padding: 10px 0;
}

.tkaniny-global-search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #2a3392;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s;
    background: #fff;
}

.tkaniny-global-search-input:focus {
    outline: none;
    border-color: #232b7c;
    box-shadow: 0 0 0 3px rgba(42, 51, 146, 0.1);
}

/* Old global search (deprecated - kept for backwards compatibility) */
.tkaniny-global-search {
    display: none;
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
    animation: slideDown 0.4s ease;
}

.tkaniny-global-search.expanded {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Filter Section */
.tkaniny-filters-section {
    margin-bottom: 25px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.tkaniny-filter-group {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    height: fit-content;
}

.tkaniny-filter-group:last-of-type {
    margin-bottom: 0;
}

.tkaniny-filter-group-header {
    background: #2a3392;
    color: white;
    padding: 12px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background 0.3s;
}

.tkaniny-filter-group-header:hover {
    background: #232b7c;
}

.tkaniny-filter-group-header h4 {
    margin: 0;
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    flex: 1;
}

.tkaniny-filter-group-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.tkaniny-filter-group-icon svg {
    width: 20px;
    height: 20px;
    color: white;
    stroke: white;
    fill: none;
}

.tkaniny-filter-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 12px;
    font-weight: bold;
}

.tkaniny-filter-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.tkaniny-filter-group-body {
    padding: 15px 20px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.tkaniny-filter-group-body.collapsed {
    max-height: 0;
    padding: 0 20px;
}

.tkaniny-filter-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tkaniny-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 5px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.tkaniny-filter-option:hover {
    background: #e8f4f8;
    border-color: #2a3392;
}

.tkaniny-filter-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.tkaniny-filter-option .filter-name {
    font-size: 14px;
    color: #333;
    flex: 1;
}

.tkaniny-filter-option input[type="checkbox"]:checked + .filter-name {
    font-weight: 600;
    color: #2a3392;
}

.tkaniny-filter-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    grid-column: 1 / -1;
    margin-top: 8px;
}

.tkaniny-apply-filters,
.tkaniny-clear-filters {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s;
}

.tkaniny-apply-filters {
    background: #2a3392;
    color: white;
}

.tkaniny-apply-filters:hover {
    background: #232b7c;
}

.tkaniny-clear-filters {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.tkaniny-clear-filters:hover {
    background: #e8e8e8;
    color: #333;
}

/* Old Filters - Legacy */
.tkaniny-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tkaniny-search-input,
.tkaniny-filter-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    flex: 1;
    min-width: 200px;
}

/* Fabric Grid */
.tkaniny-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

.tkaniny-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    cursor: pointer;
}

.tkaniny-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border-color: #2a3392;
}

.tkaniny-item-image {
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f5f5f5;
}

.tkaniny-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tkaniny-item-info {
    padding: 10px;
}

.tkaniny-item-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.95em;
}

.tkaniny-producer {
    color: #666;
    font-size: 0.85em;
    margin: 3px 0 8px 0;
}

.tkaniny-view-details {
    width: 100%;
    padding: 8px 15px;
    background: #2a3392;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background 0.3s;
    margin-bottom: 5px;
}

.tkaniny-view-details:hover {
    background: #232b7c;
}

/* Fabric Details */
.tkaniny-details-content {
    max-width: 900px;
}

/* Header layout - title and producer on left, logo on right */
.tkaniny-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.tkaniny-header-text {
    flex: 1;
}

.tkaniny-details-container h2 {
    font-size: 1.4em; /* Reduced by 30% from 2em */
    margin: 0 0 8px 0;
}

.tkaniny-producer-name {
    margin: 0;
    font-size: 0.95em;
    color: #666;
}

.tkaniny-producer-name a {
    color: #2a3392;
    text-decoration: none;
    font-weight: 600;
}

.tkaniny-producer-name a:hover {
    text-decoration: underline;
}

.tkaniny-header-logo {
    flex-shrink: 0;
    margin-left: 20px;
}

.tkaniny-header-logo .producer-logo-compact {
    max-width: 100px;
    max-height: 100px;
    height: auto;
    object-fit: contain;
}

.tkaniny-details-container h3 {
    font-size: 1.05em; /* Reduced by 30% from 1.5em */
    margin-top: 20px; /* Reduced from 30px */
    margin-bottom: 10px; /* Reduced from 15px */
    border-bottom: 2px solid #eee;
    padding-bottom: 7px; /* Reduced from 10px */
}

/* Usuń linię pod nagłówkiem "Dostępne Kolory / Warianty" */
.tkaniny-colors h3 {
    border-bottom: none;
    padding-bottom: 0;
}

/* Old producer info - keep for backwards compatibility */
.tkaniny-producer-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.tkaniny-producer-info .producer-logo {
    max-width: 80px;
    height: auto;
}

.tkaniny-producer-info a {
    color: #2a3392;
    text-decoration: none;
    font-weight: 600;
}

.tkaniny-producer-info a:hover {
    text-decoration: underline;
}

.tkaniny-description {
    margin-bottom: 20px; /* Reduced from 30px */
    line-height: 1.6; /* Reduced from 1.8 */
    font-size: 0.9em; /* Reduced by ~10% */
}

.tkaniny-description p {
    margin: 8px 0; /* Reduced vertical spacing */
}

/* Colors Grid */
.tkaniny-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.tkaniny-color-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: border-color 0.3s, transform 0.3s;
}

.tkaniny-color-item:hover {
    border-color: #2a3392;
    transform: translateY(-3px);
}

.tkaniny-color-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.tkaniny-color-item p {
    margin: 10px 0;
    font-weight: 600;
}

.tkaniny-select-color,
.tkaniny-select-fabric {
    width: 100%;
    padding: 10px 15px;
    background: #2a3392;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.tkaniny-select-color:hover,
.tkaniny-select-fabric:hover {
    background: #232b7c;
}

.tkaniny-no-colors {
    text-align: center;
    padding: 40px 20px;
}

/* Attributes Table */
.tkaniny-attributes-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.tkaniny-attributes-table th,
.tkaniny-attributes-table td {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.tkaniny-attributes-table th {
    background: #f5f5f5;
    font-weight: 600;
    width: 40%;
}

/* Shortcode Styles */
.tkaniny-shortcode-wrapper {
    margin: 30px 0;
}

.tkaniny-shortcode-wrapper details {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #f9f9f9;
}

.tkaniny-shortcode-wrapper summary {
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    padding: 10px;
    margin: -15px;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 8px;
    transition: background 0.3s;
}

.tkaniny-shortcode-wrapper summary:hover {
    background: #f0f0f0;
}

.tkaniny-shortcode-grid {
    display: grid;
    gap: 20px;
    margin-top: 15px;
}

.tkaniny-shortcode-item {
    text-align: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
    transition: transform 0.3s;
}

.tkaniny-shortcode-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.tkaniny-shortcode-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.tkaniny-shortcode-item p {
    margin: 0;
    font-size: 0.9em;
}

/* Responsive */
@media (max-width: 1200px) {
    .tkaniny-filters-section {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .tkaniny-filters-section {
        grid-template-columns: repeat(2, 1fr);
    }

    .tkaniny-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .tkaniny-modal-content {
        width: 95%;
        height: 95%;
        margin: 2.5% auto;
    }

    .tkaniny-modal-header {
        padding: 15px 20px;
    }

    .tkaniny-modal-header h2 {
        font-size: 1.4em;
    }

    .tkaniny-modal-body {
        padding: 20px;
    }

    .tkaniny-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .tkaniny-colors-grid {
        grid-template-columns: 1fr;
    }

    .tkaniny-filters {
        flex-direction: column;
    }

    .tkaniny-filters-section {
        grid-template-columns: 1fr;
    }

    .tkaniny-selected-info {
        flex-direction: column;
        align-items: stretch;
    }

    .tkaniny-open-modal {
        width: 100%;
    }
}

/* Fabric Selection Preview */
.tkaniny-selection-preview {
    background: #f0f7ff;
    border-top: 3px solid #2a3392;
    padding: 20px 30px;
    flex-shrink: 0;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tkaniny-selection-preview h3 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: #2a3392;
    font-weight: 600;
}

.tkaniny-preview-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.tkaniny-preview-thumbnail {
    flex-shrink: 0;
}

.tkaniny-preview-thumbnail img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #2a3392;
}

.tkaniny-preview-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.tkaniny-preview-name {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.tkaniny-confirm-selection {
    padding: 12px 30px;
    background: #28a745 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background 0.3s;
    white-space: nowrap;
    text-decoration: none !important;
    display: inline-block;
    line-height: normal;
}

.tkaniny-confirm-selection:hover {
    background: #218838 !important;
    color: white !important;
}

.tkaniny-confirm-selection:focus {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .tkaniny-preview-content {
        flex-direction: column;
        text-align: center;
    }

    .tkaniny-preview-info {
        flex-direction: column;
        width: 100%;
    }

    .tkaniny-confirm-selection {
        width: 100%;
    }
}

/* ========================================
   SINGLE FABRIC PAGE STYLES
   ======================================== */

/* Breadcrumbs - centered variant for tkanina pages */
.breadcrumbs-bar.breadcrumbs-tkanina {
    padding: 8px 0;
}

.breadcrumbs-bar.breadcrumbs-tkanina .breadcrumbs-container.breadcrumbs-centered {
    justify-content: center;
    align-items: center;
}

.breadcrumbs-bar.breadcrumbs-tkanina .breadcrumbs-container.breadcrumbs-centered .woocommerce-breadcrumb {
    text-align: center;
}

/* Wrapper & Container */
.tkanina-single-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
}

.tkanina-single-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    background: #fff;
}

/* Main Content Layout - Force full width, no sidebars */
.tkanina-single-content {
    margin-bottom: 40px;
    width: 100% !important;
    max-width: 100% !important;
    grid-column: 1 / -1 !important; /* If theme uses CSS Grid */
}

/* Force single-column layout for single fabric pages */
.single-tkanina .tkanina-single-wrapper,
.single-tkanina .tkanina-single-container,
.single-tkanina .tkanina-single-content {
    display: block !important;
    width: 100% !important;
}

/* Ensure all sections within content are full-width, no columns */
.tkanina-single-content .tkanina-single-description,
.tkanina-single-content .tkanina-single-colors,
.tkanina-single-content .tkanina-single-specs,
.tkanina-single-content .tkanina-single-properties {
    width: 100% !important;
    max-width: 100% !important;
    float: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Header */
.tkanina-single-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 0;
    border-bottom: none;
    gap: 20px;
}

.tkanina-header-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-top: 20px;
}

.tkanina-single-title {
    margin: 0;
    font-size: 2.2em;
    color: #222;
    font-weight: 700;
    line-height: 1.2;
}

.tkanina-producer-name {
    margin: 8px 0 0 0;
    font-size: 1em;
    color: #666;
    line-height: 1.4;
}

.tkanina-producer-link {
    color: #2A3392;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.tkanina-producer-link:hover {
    color: #18184b;
    text-decoration: underline;
}

.tkanina-header-logo {
    flex-shrink: 0;
    margin-left: 30px;
    display: flex;
    align-items: center;
}

.producer-single-logo {
    max-width: 100%;
    max-height: 100px;
    height: auto;
    width: auto;
    object-fit: contain;
}

/* Description */
.tkanina-single-description {
    margin-bottom: 30px;
}

.tkanina-single-description h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.tkanina-single-description p {
    line-height: 1.8;
    color: #555;
    margin-bottom: 15px;
}

/* Colors Grid */
.tkanina-single-colors {
    margin-bottom: 30px;
}

.tkanina-single-colors h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.tkanina-colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.tkanina-color-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
}

.tkanina-color-item:hover {
    border-color: #2a3392;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.tkanina-color-link {
    display: block;
}

.tkanina-color-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Make fabric images clickable on single fabric page */
.tkanina-fabric-lightbox-trigger {
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.tkanina-fabric-lightbox-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(42, 51, 146, 0.3);
}

.tkanina-color-name {
    padding: 12px;
    text-align: center;
    font-weight: 600;
    background: #f9f9f9;
    margin: 0;
}

/* Technical Specifications */
.tkanina-single-specs {
    margin-bottom: 30px;
}

.tkanina-single-specs h2 {
    font-size: 1.5em;
    color: #333;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 7px;
    border-bottom: 2px solid #e0e0e0;
}

.tkanina-specs-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tkanina-specs-table th,
.tkanina-specs-table td {
    padding: 12px 15px 12px 20px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.tkanina-specs-table th {
    background: #2a3392;
    color: white;
    font-weight: 600;
    width: 40%;
}

.tkanina-specs-table td {
    background: #fafafa;
}

.tkanina-specs-table tr:hover td {
    background: #f5f5f5;
}

/* New Section: Filters LEFT (60%) + Action Buttons RIGHT (40%) */
.tkanina-filters-actions-section {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

.tkanina-filters-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.tkanina-actions-column {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.tkanina-properties-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 2px;
}

.tkanina-property-tag {
    display: inline-block;
    padding: 8px 16px;
    background: #2A3392;
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
}

/* Old Properties Section - Keep for backwards compatibility */
.tkanina-single-properties {
    margin-bottom: 15px;
}

.tkanina-single-properties h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Related Products */
.tkanina-related-products {
    margin: 50px 0;
    padding: 40px 0;
    border-top: 3px solid #e0e0e0;
}

.tkanina-related-products h2 {
    font-size: 1.8em;
    color: #222;
    margin-bottom: 30px;
    text-align: center;
}

.tkanina-products-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.tkanina-product-item {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 8px;
    overflow: visible;
    transition: box-shadow 0.2s, transform 0.2s;
}

.tkanina-product-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.tkanina-product-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.tkanina-product-item img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 4/3;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.tkanina-product-item h3 {
    font-size: 16px;
    font-weight: 400;
    margin: 10px 12px;
    line-height: 1.3;
    color: #333;
    text-align: center;
}

.tkanina-product-item .price {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin: 8px 12px 12px 12px;
    display: block;
    text-align: center;
}

/* Pagination for Products */
.tkanina-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    padding: 20px 0;
}

.tkanina-pagination-prev,
.tkanina-pagination-next {
    padding: 10px 18px;
    background: #2A3392;
    color: white;
    text-decoration: none;
    border-radius: 0;
    font-weight: 700;
    font-size: 0.95em;
    transition: all 0.2s;
    border: 1px solid #2A3392;
}

.tkanina-pagination-prev:hover,
.tkanina-pagination-next:hover {
    background: #18184b;
    border-color: #18184b;
}

.tkanina-pagination-prev.disabled,
.tkanina-pagination-next.disabled {
    background: #e0e0e0;
    color: #999;
    border-color: #e0e0e0;
    cursor: not-allowed;
    opacity: 0.6;
}

.tkanina-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tkanina-pagination-number {
    display: inline-block;
    padding: 8px 14px;
    background: white;
    color: #232323;
    text-decoration: none;
    border: 1px solid #eee;
    border-radius: 0;
    font-weight: 700;
    font-size: 0.95em;
    min-width: 42px;
    text-align: center;
    transition: all 0.2s;
}

.tkanina-pagination-number:hover {
    background: #2A3392;
    color: white;
    border-color: #2A3392;
}

.tkanina-pagination-number.active {
    background: #2A3392;
    color: white;
    border-color: #2A3392;
}

.tkanina-pagination-dots {
    color: #666;
    font-weight: 600;
    padding: 0 5px;
}

/* Back Link */
.tkanina-back-link {
    margin: 40px 0;
    text-align: center;
}

.tkanina-back-link .button {
    display: inline-block;
    padding: 12px 30px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid #ddd;
}

.tkanina-back-link .button:hover {
    background: #2A3392;
    color: white;
    border-color: #2A3392;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tkanina-filters-actions-section {
        grid-template-columns: 50% 50%;
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .tkanina-single-header {
        flex-direction: column;
    }

    .tkanina-header-logo {
        margin-left: 0;
        margin-top: 20px;
    }

    .tkanina-filters-actions-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tkanina-action-buttons {
        flex-direction: column;
    }

    .tkanina-action-button {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 1100px) {
    .tkanina-products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 18px !important;
    }
}

@media (max-width: 900px) {
    .tkanina-products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    .tkanina-single-title {
        font-size: 1.6em;
    }

    .tkanina-colors-grid {
        grid-template-columns: 1fr;
    }

    .tkanina-products-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .tkanina-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .tkanina-pagination-prev,
    .tkanina-pagination-next {
        padding: 8px 14px;
        font-size: 0.9em;
    }

    .tkanina-pagination-number {
        padding: 6px 10px;
        font-size: 0.9em;
        min-width: 36px;
    }

    .tkanina-pagination-numbers {
        gap: 6px;
    }
}

/* ========================================
   HEADER WITH ACTION BUTTONS
   ======================================== */

.tkanina-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.tkanina-action-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.tkanina-action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex: 1;
    min-width: 180px;
    box-sizing: border-box;
}

.tkanina-action-button:hover {
    background: #e0e0e0;
    border-color: #ccc;
    color: #000;
    text-decoration: none;
}

.tkanina-action-button:active {
    transform: scale(0.98);
}

.tkanina-action-button:disabled {
    background: #f9f9f9;
    border-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.tkanina-action-button .button-icon {
    font-size: 1.1em;
    line-height: 1;
}

.tkanina-action-button .button-text {
    line-height: 1;
}

.tkanina-info-card-button {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.tkanina-info-card-button:hover {
    background: #5a6268;
    border-color: #5a6268;
    color: white;
}

.tkanina-sample-button {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.tkanina-sample-button:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
}

/* Hide icon from sample button */
.tkanina-sample-button .button-icon {
    display: none;
}

@media (max-width: 900px) {
    .tkanina-single-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tkanina-header-right {
        align-items: center;
    }

    .tkanina-action-buttons {
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .tkanina-action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .tkanina-action-button {
        width: 100%;
    }
}

/* ========================================
   TWO COLUMN LAYOUT - SPECS LEFT, GALLERY RIGHT
   ======================================== */

.tkanina-two-column-layout {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

.tkanina-column-left {
    min-width: 0;
}

.tkanina-column-right {
    min-width: 0;
}

/* Ensure both H2 headers are perfectly aligned */
.tkanina-two-column-layout h2 {
    font-size: 1.5em;
    color: #333;
    margin: 0 0 20px 0;
    padding: 0 0 7px 0;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
    line-height: 1.3;
}

@media (max-width: 900px) {
    .tkanina-two-column-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ========================================
   SPECIFICATIONS TABLE - IMPROVED STYLING
   ======================================== */

.tkanina-single-specs {
    padding-left: 0;
    margin-bottom: 0;
}

.tkanina-specs-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-top: 15px;
}

.tkanina-specs-table th,
.tkanina-specs-table td {
    padding: 12px 15px 12px 20px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.tkanina-specs-table th {
    background: #f5f5f5;
    color: #333;
    font-weight: 600;
    width: 35%;
    font-size: 0.95em;
}

.tkanina-specs-table td {
    background: #fafafa;
    color: #555;
    font-size: 0.95em;
}

.tkanina-specs-table tr:hover td {
    background: #f0f0f0;
}

/* ========================================
   PRODUCT GALLERY - SINGLE IMAGE + THUMBNAILS
   ======================================== */

.tkanina-product-gallery {
    margin-bottom: 30px;
}

.tkanina-product-gallery h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 7px;
    border-bottom: 2px solid #e0e0e0;
    margin-top: 0;
}

/* Main Gallery Image - Single Large Image */
.tkanina-gallery-main-image {
    width: 100%;
    margin-bottom: 15px;
}

.tkanina-main-image-link {
    display: block;
    width: 100%;
}

.tkanina-main-gallery-img {
    width: 100%;
    max-width: 700px;
    border: 1px solid #ebebeb;
    border-radius: 5px;
    cursor: zoom-in;
    display: block;
    transition: transform 0.2s;
}

.tkanina-main-gallery-img:hover {
    transform: scale(1.02);
}

/* Thumbnail Slider - Based on WooCommerce */
.tkanina-gallery-thumbnails-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    max-width: 700px;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

.tkanina-thumbs-arrow {
    background: #fff;
    border: 1px solid #000000;
    font-size: 18px;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: background 0.2s;
    color: #000000;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 2px 2px 5px 2px;
}

.tkanina-thumbs-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.tkanina-thumbs-arrow:hover:not(:disabled) {
    background: #f5f5f5;
}

.tkanina-thumbs-arrow[style*="visibility: hidden"] {
    display: none;
}

.tkanina-thumbs-viewport {
    overflow: hidden;
    width: 650px;
    max-width: 100%;
    position: relative;
    display: block;
}

.tkanina-thumbs-track {
    display: flex;
    gap: 6px;
    transition: transform 0.3s cubic-bezier(.77,0,.18,1);
    will-change: transform;
}

.tkanina-thumb-link {
    display: block;
    flex: 0 0 126px;
    width: 126px;
    height: 126px;
    border-radius: 10px;
    overflow: hidden;
    box-sizing: border-box;
}

.tkanina-thumb-link img {
    width: 126px !important;
    height: 126px !important;
    object-fit: cover;
    border: 2px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: border 0.18s;
    background: #fff;
    box-sizing: border-box;
    display: block;
}

.tkanina-thumb-link img:hover,
.tkanina-thumb-link.active img {
    border-color: #2A3392;
}

/* Responsive Design */
@media (max-width: 900px) {
    .tkanina-main-gallery-img,
    .tkanina-gallery-thumbnails-slider,
    .tkanina-thumbs-viewport {
        max-width: 92vw;
        width: 92vw;
    }

    .tkanina-thumb-link,
    .tkanina-thumb-link img {
        width: 64px !important;
        height: 64px !important;
        flex: 0 0 64px;
        border-radius: 8px;
    }

    .tkanina-thumbs-arrow {
        width: 20px;
        height: 20px;
        font-size: 14px;
    }
}

@media (max-width: 600px) {
    .tkanina-thumb-link,
    .tkanina-thumb-link img {
        width: 56px !important;
        height: 56px !important;
        flex: 0 0 56px;
    }
}

/* ========================================
   PRELOADER / LOADING SPINNER
   ======================================== */

/* Overlay preloadera - wyświetla się podczas ładowania */
.tkaniny-modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    gap: 20px;
}

/* Animowane kółko ładowania */
.tkaniny-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #2a3392;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tekst pod spinnerem */
.tkaniny-loading-text {
    color: #2a3392;
    font-size: 1.1em;
    font-weight: 600;
    text-align: center;
}

/* Ukryj preloader gdy nie jest potrzebny */
.tkaniny-modal-loading.hidden {
    display: none;
}

/* ========================================
   MODAL SEARCH TOGGLE BUTTON (ARCHIVE STYLE)
   ======================================== */

/* Search toggle button in modal - matches archive page design */
.tkaniny-modal-search-toggle {
    width: 54px;
    height: 44px;
    background: #2a3392; /* Blue background like archive page */
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.tkaniny-modal-search-toggle:hover {
    background: #232b7c; /* Darker blue on hover */
}

.tkaniny-modal-search-toggle.active {
    background: #232b7c; /* Darker blue when active */
}

.tkaniny-modal-search-toggle svg {
    width: 20px;
    height: 20px;
}

