/* ============================================
   PRODUCTS STYLES - Category & Detail Pages
   ============================================ */

/* ============================================
   CATEGORY PAGE
   ============================================ */

.category-container {
    padding: 40px 0;
}

.category-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
}

/* Sidebar Filters */
.category-sidebar {
    position: sticky;
    top: 140px;
    height: fit-content;
}

.filters-container {
    border-right: 1px solid var(--color-border);
    padding-right: 30px;
}

.filter-title {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 25px;
    font-weight: var(--font-weight-semibold);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-panel-toggle-icon {
    display: none;
    transition: transform 0.3s ease;
}

.filter-group {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-heading {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: color var(--transition-speed);
}

.filter-heading:hover {
    color: var(--color-link-hover);
}

.filter-toggle-icon {
    transition: transform var(--transition-speed);
    flex-shrink: 0;
}

.filter-group.open .filter-toggle-icon {
    transform: rotate(0deg);
}

.filter-group:not(.open) .filter-toggle-icon {
    transform: rotate(-90deg);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.filter-group:not(.open) .filter-options {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
}

.filter-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.filter-option span {
    transition: color var(--transition-speed);
}

.filter-option:hover span {
    color: var(--color-primary);
}

.filter-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-clear-filters {
    background: var(--color-primary);
    color: white;
    padding: 12px 20px;
    text-align: center;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: var(--font-weight-semibold);
    border: 1px solid var(--color-primary);
    transition: all var(--transition-speed);
}

.btn-clear-filters:hover {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: white;
}

/* Category Main */
.category-main {
    min-width: 0;
}

.category-header {
    margin-bottom: 40px;
}

.category-title {
    font-size: 28px;
    font-weight: var(--font-weight-light);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-description {
    font-size: 14px;
    color: var(--color-text-light);
    margin-bottom: 20px;
    line-height: 1.8;
}

.category-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.toolbar-filter-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text);
    position: relative;
}

.filter-icon {
    color: var(--color-primary);
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--color-primary);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: var(--font-weight-semibold);
}

.toolbar-amount {
    font-size: 13px;
    color: var(--color-text-light);
}

.toolbar-sorter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.toolbar-sorter select {
    border: 1px solid var(--color-border);
    padding: 8px 30px 8px 12px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.product-item {
    position: relative;
}

.product-item-inner {
    position: relative;
}

.product-item-link {
    display: block;
}

.product-item-photo {
    position: relative;
    overflow: hidden;
    background: var(--color-bg-light);
    aspect-ratio: 2/3;
    margin-bottom: 15px;
}

.product-image-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-speed);
}

.product-image-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.product-item:hover .product-image-hover {
    opacity: 1;
}

.product-item:hover .product-image-photo {
    opacity: 0;
}

.product-item-details {
    text-align: center;
}

.product-item-name {
    font-size: 13px;
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.product-item-description {
    font-size: 12px;
    color: var(--color-text-light);
    line-height: 1.5;
}

.product-item-wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 2;
}

.product-item:hover .product-item-wishlist {
    opacity: 1;
}

.product-item-wishlist.active {
    opacity: 1;
}

.product-item-wishlist svg {
    transition: all var(--transition-speed);
}

.product-item-wishlist:hover {
    transform: scale(1.1);
}

.product-item-wishlist.active svg {
    fill: var(--color-primary);
    stroke: var(--color-primary);
}

.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-light);
}

/* Pagination */
.pagination-container {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--color-border);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.page-link.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.page-link:hover:not(.active) {
    background: var(--color-bg-light);
}

/* ============================================
   PRODUCT DETAIL PAGE
   ============================================ */

.product-detail-container {
    padding: 40px 0;
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   PRODUCT GALLERY WITH SWIPER
   Thumbnails on LEFT (desktop), horizontal on mobile
   ============================================ */

.product-gallery {
    position: sticky;
    top: 140px;
    height: fit-content;
    display: flex;
    gap: 20px;
    overflow: hidden;  /* FIX: Prevent horizontal overflow */
}

/* Thumbnails Wrapper (LEFT side on desktop) */
.gallery-thumbs-wrapper {
    flex-shrink: 0;
    width: 100px;
}

.gallery-thumbs {
    height: 600px; /* Max height for vertical scroll */
    overflow: hidden;
}

.gallery-thumbs .swiper-slide {
    width: 100%;
    height: auto;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-speed);
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
}

.gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--color-primary, #333);
}

.gallery-thumbs .swiper-slide:hover {
    opacity: 1;
}

.gallery-thumbs .thumb-inner {
    position: relative;
    width: 100%;
    padding-bottom: 140%; /* Aspect ratio for portrait thumbnails */
    overflow: hidden;
    background: #f5f5f5;
}

.gallery-thumbs .thumb-inner img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video thumbnail indicator */
.gallery-thumbs .thumb-video .video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.gallery-thumbs .thumb-video .video-play-icon svg {
    width: 16px;
    height: 16px;
    margin-left: 2px;
}

/* Main Gallery Wrapper (RIGHT side) */
.gallery-main-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;  /* FIX: Allow flex item to shrink below content size */
    overflow: hidden;  /* FIX: Prevent overflow */
}

.gallery-main {
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.gallery-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    min-height: 400px;
    max-height: 700px;  /* Limit maximum height */
}

.gallery-main .slide-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;  /* FIX: Clip content that overflows */
}

.gallery-main-image {
    max-width: 100%;  /* Never wider than container */
    max-height: 700px;  /* Limit image height */
    width: auto;  /* Natural width */
    height: auto;  /* Natural height */
    display: block;
    object-fit: contain;  /* Maintain aspect ratio */
}

/* Video Slides */
.gallery-main .slide-video {
    background: #f5f5f5; /* Szare tło (jak reszta galerii) zamiast czarnego */
}

.gallery-main .gallery-video {
    max-width: 100%;
    max-height: 600px;
    display: block;
    margin: 0 auto;
}

/* Vertical Video (Portrait - 9:16) */
.gallery-main .slide-inner.video-vertical .gallery-video {
    max-width: 400px; /* Limit width for vertical videos */
    width: auto;
    height: auto;
}

/* Horizontal Video (Landscape - 16:9) */
.gallery-main .slide-inner.video-horizontal .gallery-video {
    width: 100%;
    height: auto;
}

/* Swiper Navigation Buttons */
.gallery-main .swiper-button-next,
.gallery-main .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.gallery-main .swiper-button-next:hover,
.gallery-main .swiper-button-prev:hover {
    background: rgba(0, 0, 0, 0.8);
}

.gallery-main .swiper-button-next:after,
.gallery-main .swiper-button-prev:after {
    font-size: 20px;
}

/* Pagination (Mobile only) */
.gallery-main .swiper-pagination {
    bottom: 10px !important;
}

.gallery-main .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #fff;
    opacity: 0.5;
}

.gallery-main .swiper-pagination-bullet-active {
    opacity: 1;
    background: #fff;
}

/* Product Info */
.product-info-main {
    padding-left: 20px;
}

.product-title {
    font-size: 32px;
    font-weight: var(--font-weight-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.product-collection {
    margin-bottom: 20px;
}

.collection-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-light);
}

/* Social Links */
.product-social-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--color-border);
}

.product-social-links button,
.product-social-links a {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
}

.share-popup {
    position: absolute;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 20px;
    z-index: 100;
    min-width: 250px;
}

.share-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: 15px;
}

.share-list {
    list-style: none;
}

.share-list li {
    margin-bottom: 10px;
}

/* Product Overview */
.product-overview {
    font-size: 14px;
    margin-bottom: 20px;
}

.price-clarifications {
    padding: 15px 0;
    font-size: 12px;
    color: var(--color-text-light);
    margin-bottom: 20px;
}

/* Buttons Container */
.buttons-container {
    margin: 30px 0;
}

.secondary-buttons {
    list-style: none;
}

.appointment {
    width: 100%;
    display: block;
    text-align: center;
}

/* Product Details Accordion */
.product-info-detailed {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--color-border);
}

.product-data-items {
    border-top: 1px solid var(--color-border);
}

.data-item {
    border-bottom: 1px solid var(--color-border);
}

.data-toggle {
    display: block;
    width: 100%;
    text-align: left;
    padding: 20px 0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: var(--font-weight-semibold);
    position: relative;
    cursor: pointer;
}

.data-toggle::after {
    content: '+';
    position: absolute;
    right: 0;
    font-size: 18px;
    transition: transform var(--transition-speed);
}

.data-toggle.active::after {
    content: '−';
}

.data-content {
    padding: 0 0 25px 0;
}

.product-description {
    font-size: 14px;
    line-height: 1.8;
    color: var(--color-text);
}

/* Attributes Table */
.attributes-table-wrapper {
    overflow-x: auto;
}

.attributes-table {
    width: 100%;
    font-size: 13px;
}

.attributes-table caption {
    text-align: left;
    font-weight: var(--font-weight-semibold);
    margin-bottom: 15px;
}

.attributes-table tr {
    border-bottom: 1px solid var(--color-border);
}

.attributes-table th {
    text-align: left;
    padding: 12px 20px 12px 0;
    font-weight: var(--font-weight-semibold);
    width: 40%;
}

.attributes-table td {
    padding: 12px 0;
    color: var(--color-text-light);
}

/* FAQs */
.faqs-list {
    list-style: none;
}

.faqs-list li {
    margin-bottom: 20px;
}

.faqs-list strong {
    display: block;
    font-size: 12px;
    margin-bottom: 8px;
}

.faqs-list span {
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-text-light);
}

/* Related Products / Smart Recommendations */
.related-products-section {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid var(--color-border);
    background: #fafafa;
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 80px;
    overflow: hidden;
}

.recommendations-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    text-align: center;
    font-size: 24px;
    font-weight: var(--font-weight-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.section-subtitle {
    font-size: 14px;
    color: #999;
    font-style: italic;
    margin: 0;
}

.products-carousel,
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.related-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* Product Attributes in recommendations */
.product-item-attributes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.product-item-attributes .attribute {
    font-size: 11px;
    color: #999;
    padding: 3px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    background: white;
}

/* ============================================
   SWIPER CAROUSEL STYLES
   ============================================ */

.recommendations-swiper {
    width: 100%;
    padding-bottom: 50px !important;
    margin: 0 auto;
}

.recommendations-swiper .swiper-slide {
    height: auto;
    display: flex;
}

.recommendations-swiper .product-item {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Swiper Navigation Buttons */
.recommendations-swiper .swiper-button-next,
.recommendations-swiper .swiper-button-prev {
    color: #333;
    background: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.recommendations-swiper .swiper-button-next:after,
.recommendations-swiper .swiper-button-prev:after {
    font-size: 20px;
    font-weight: bold;
}

.recommendations-swiper .swiper-button-next:hover,
.recommendations-swiper .swiper-button-prev:hover {
    background: #333;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

/* Hide navigation on very small screens */
@media (max-width: 640px) {
    .recommendations-swiper .swiper-button-next,
    .recommendations-swiper .swiper-button-prev {
        display: none;
    }
}

/* Swiper Pagination */
.recommendations-swiper .swiper-pagination {
    bottom: 0 !important;
}

.recommendations-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #999;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.recommendations-swiper .swiper-pagination-bullet-active {
    background: #333;
    opacity: 1;
    width: 30px;
    border-radius: 5px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .category-layout {
        grid-template-columns: 200px 1fr;
        gap: 30px;
    }

    .product-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .product-gallery {
        position: static;
    }

    .product-info-main {
        padding-left: 0;
    }
}

@media (max-width: 768px) {
    .category-container {
        padding: 20px 0;
    }

    .category-layout {
        grid-template-columns: 1fr;
    }

    .category-sidebar {
        position: static;
    }

    .filters-container {
        border-right: none;
        padding-right: 0;
        margin-bottom: 20px;
        border: 1px solid var(--color-border);
        border-radius: 4px;
        overflow: hidden;
    }

    .filter-title {
        font-size: 13px;
        margin-bottom: 0;
        padding: 15px;
        background: var(--color-bg-light);
        cursor: pointer;
        user-select: none;
        border-bottom: 1px solid var(--color-border);
    }

    .filter-title:active {
        background: rgba(0, 0, 0, 0.05);
    }

    .filter-panel-toggle-icon {
        display: block;
        color: var(--color-primary);
    }

    .filters-container.collapsed .filter-panel-toggle-icon {
        transform: rotate(-90deg);
    }

    .filter-form {
        max-height: 2000px;
        overflow: hidden;
        transition: max-height 0.4s ease;
        padding: 15px;
    }

    .filters-container.collapsed .filter-form {
        max-height: 0;
        padding: 0 15px;
    }

    .filter-group {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .filter-heading {
        font-size: 12px;
        margin-bottom: 0;
        padding: 10px;
        background: rgba(0, 0, 0, 0.02);
        border-radius: 4px;
        cursor: pointer;
    }

    .filter-heading:active {
        background: rgba(0, 0, 0, 0.05);
    }

    .filter-options {
        margin-top: 10px;
        gap: 8px;
    }

    .filter-option {
        font-size: 12px;
        gap: 8px;
    }

    .filter-option input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    .filter-actions {
        margin-top: 15px;
    }

    .category-header {
        margin-bottom: 20px;
    }

    .category-title {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .category-description {
        font-size: 13px;
        margin-bottom: 15px;
        line-height: 1.6;
    }

    .category-toolbar {
        padding: 12px 0;
    }

    .toolbar-filter-indicator {
        font-size: 11px;
        gap: 6px;
    }

    .filter-icon {
        width: 16px;
        height: 16px;
    }

    .toolbar-amount {
        font-size: 11px;
    }

    .toolbar-sorter {
        font-size: 11px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 20px;
    }

    .product-item-photo {
        margin-bottom: 10px;
    }

    .product-item-name {
        font-size: 11px;
        margin-bottom: 3px;
    }

    .product-item-description {
        font-size: 11px;
        line-height: 1.4;
    }

    .product-item-wishlist {
        width: 36px;
        height: 36px;
        top: 8px;
        right: 8px;
    }

    .product-item-wishlist svg {
        width: 18px;
        height: 18px;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* Product Gallery - Mobile Layout */
    .product-gallery {
        flex-direction: column;
        position: static;
    }

    .gallery-thumbs-wrapper {
        width: 100%;
        order: 2; /* Thumbnails below main gallery */
        margin-top: 15px;
    }

    .gallery-thumbs {
        height: auto !important;
    }

    .gallery-thumbs .swiper-slide {
        width: 80px !important;
        height: 100px;
    }

    .gallery-main-wrapper {
        order: 1;
    }

    .gallery-main .swiper-slide {
        min-height: 350px;
        max-height: 500px;  /* Smaller on mobile */
    }

    .gallery-main-image {
        max-height: 500px;  /* Limit on mobile too */
    }

    .gallery-main .gallery-video {
        max-height: 400px;
    }

    .gallery-main .slide-inner.video-vertical .gallery-video {
        max-width: 280px;
    }

    /* Hide navigation buttons on mobile */
    .gallery-main .swiper-button-next,
    .gallery-main .swiper-button-prev {
        display: none;
    }

    .product-title {
        font-size: 24px;
    }

    .product-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}
