/**
 * Product Card Styles - Babuszka Store
 * Custom product card for shop/archive pages
 */
 /* ===== SHOP PAGE PADDING ===== */
.woocommerce {
    padding: 0;
}

/* ===== SHOP INFO SECTION ===== */
.shop-info {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

/* Breadcrumbs - top left, thin font */
.shop-breadcrumbs {
    grid-column: 1 / -1;
    grid-row: 1;
}

.shop-breadcrumbs .woocommerce-breadcrumb {
    font-size: 0.875rem;
    font-weight: 300;
    color: var(--color-text-light);
    margin-left: 2.7rem;
    padding-top: 1rem;
}

.shop-breadcrumbs .woocommerce-breadcrumb a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.shop-breadcrumbs .woocommerce-breadcrumb a:hover {
    color: var(--color-primary);
}

/* Category Title - centered and bold */
.shop-title {
    grid-column: 2;
    grid-row: 2;
    font-size: 3rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--color-primary);
    margin: 0;
    text-align: center;
}

/* Sorting and Filtering - right side */
.shop-controls {
    grid-column: 3;
    grid-row: 3;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    align-items: flex-start;
    padding-right: 1rem;
}

.shop-controls .woocommerce-ordering {
    margin: 0;
    position: relative;
    width: 3rem;
    height: 3rem;
}

/* Hide the default select visually but keep it functional */
.shop-controls select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* Circular sorting button */
.shop-controls .woocommerce-ordering::before {
    content: '';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background-color: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg fill='%23F5E6D3' height='800px' width='800px' version='1.1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 489.389 489.389'%3E%3Cg%3E%3Cpath d='M261.294,326.102c-8.3-7.3-21.8-6.2-29.1,2.1l-77,86.8v-346.9c0-11.4-9.4-20.8-20.8-20.8s-20.8,9.4-20.8,20.8v346.9l-77-86.8c-8.3-8.3-20.8-9.4-29.1-2.1c-8.3,8.3-9.4,20.8-2.1,29.1l113.4,126.9c8.5,10.5,23.5,8.9,30.2,0l114.4-126.9C270.694,347.002,269.694,333.402,261.294,326.102z'/%3E%3Cpath d='M483.994,134.702l-112.4-126.9c-10-10.1-22.5-10.7-31.2,0l-114.4,126.9c-7.3,8.3-6.2,21.8,2.1,29.1c12.8,10.2,25.7,3.2,29.1-2.1l77-86.8v345.9c0,11.4,9.4,20.8,20.8,20.8s20.8-8.3,20.8-19.8v-346.8l77,86.8c8.3,8.3,20.8,9.4,29.1,2.1C490.194,155.502,491.294,143.002,483.994,134.702z'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.25rem;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.shop-controls .woocommerce-ordering:hover::before {
    background-color: var(--color-dark);
    transform: translateY(-0.125rem) scale(1.05);
    box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.2);
}

/* ===== FILTER BUTTON ===== */
.filter-toggle-btn {
    width: 3rem;
    height: 3rem;
    background-color: var(--color-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-secondary);
}

.filter-toggle-btn:hover {
    background-color: var(--color-primary);
    transform: translateY(-0.125rem) scale(1.05);
    box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.2);
}

.filter-toggle-btn.active {
    background-color: var(--color-primary);
}

/* ===== FILTER BAR ===== */
.filter-bar {
    background-color: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: grid-template-rows 1.7s ease-in-out,
                opacity 0.3s ease;
}

.filter-bar.open {
    max-height: 2000px;
    opacity: 1;
    margin-bottom: 2rem;
}

.filter-bar-inner {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2.5rem;
    background-color: #f5f5f0;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

.filter-section-title {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    color: var(--color-primary);
    margin: 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.filter-option:hover {
    color: var(--color-primary);
}

.filter-checkbox,
.filter-radio {
    width: 1.125rem;
    height: 1.125rem;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* Color filter specific styles */
.filter-colors {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.color-option {
    flex-direction: row;
    align-items: center;
}

.color-swatch {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.color-name {
    font-size: 0.875rem;
}

/* Filter actions */
.filter-actions {
    grid-column: 1 / -1;
    gap: 1rem;
    display: flex;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.filter-actions button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 7.5rem;
    height: 2.75rem;
}

.apply-filters {
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

.apply-filters:hover {
    background-color: var(--color-dark);
}

.clear-filters {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.clear-filters:hover {
    background-color: #F3F4F6;
}

.results-count {
    font-size: 0.9rem;
    color: var(--color-gray);
    font-weight: 500;
}

/* Loading state */
.woocommerce ul.products.filtering {
    opacity: 0.5;
    pointer-events: none;
}

.filter-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

.filter-loading .spinner {
    width: 3rem;
    height: 3rem;
    border: 0.25rem solid var(--color-light-cream);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.no-products-message,
.filter-error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    font-size: 1.125rem;
    color: var(--color-gray);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== PRODUCTS GRID SECTION ===== */
.products-grid-section {
    padding: 1rem 0; /* No horizontal padding - gallery goes edge-to-edge */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* Product grid gets the horizontal padding */
.products-grid-section .woocommerce ul.products {
    max-width: 1600px;
    width: 100%;
    height: 100%;
    padding: 0 2rem; /* Changed from 4rem to 2rem for larger images */
    box-sizing: border-box;
}

/* Gallery rows - full width, no padding */
.products-grid-section .archive-gallery-row {
    width: 100%;
}

/* ===== PRODUCT CARD CONTAINER ===== */
.custom-product-card {
    list-style: none;
    border-radius: 0;
    overflow: visible; /* Allow images to overflow during zoom */
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    background-color: transparent; /* Same as body */
    border: none;
    width: 100%;
    height: 100%;
    max-width: none;
    padding: 1rem; /* Changed from 2rem to 1rem for even larger images */
}

.custom-product-card:hover {
    transform: none; /* Remove lift effect */
}


/* ===== PRODUCT IMAGE ===== */
.product-card-image {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%; /* Changed from 90% to 100% for larger images */
    height: auto; 
    aspect-ratio: 1 / 1;
    overflow: visible; /* Clip zoom effect to container */
    background-color: var(--color-secondary);
    flex-shrink: 0;
    cursor: pointer;
}


/* Center the link wrapper */
.product-card-image a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Override WooCommerce default image styles */
.woocommerce ul.products li.product a img {
    padding-top: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain - shows full image */
    image-rendering: -webkit-optimize-contrast; /* Sharper images */
    image-rendering: crisp-edges;
    overflow: visible;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Show full image */
    object-position: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
    image-rendering: -webkit-optimize-contrast; /* Sharper images */
    image-rendering: crisp-edges;
    transform: scale(1.05); /* Subtle zoom - 5% larger to fill space nicely */
}

.custom-product-card:hover .product-card-image img {
    transform: scale(1.10); /* Hover zoom - 10% for interactive feedback */
    z-index: 100;
}

/* Product Badges */
.product-badge {
    position: absolute;
    top: 0.625rem;
    right: 0.625rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    z-index: 101;
}

.sale-badge {
    background-color: var(--color-error);
    color: var(--color-white);
}

.custom-badge {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    top: 2rem;
}

/* ===== PRODUCT CONTENT ===== */
.product-card-content {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    background-color: transparent;
}

/* Title */
.woocommerce ul.products li.product .product-card-title {
    padding: 0;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.3;
    text-align: left;
    margin-bottom: 0;
}

.product-card-title a {
    color: var(--color-dark);
    text-decoration: none;
    transition: color var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.product-card-title a:hover {
    color: var(--color-primary);
}

/* Split title styles */
.product-card-title .title-main {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    font-family: var(--font-primary);
}

.product-card-title .title-subtitle {
    font-size: 1.1rem;
    font-weight: 200;
    font-style: italic;
    color: var(--color-primary);
    font-family: var(--font-primary);
}

/* Price and Button Row */
.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-right: 1rem;
}

/* Price */
.product-card-price {
    font-size: 1.125rem;
    font-weight: 200; /* Thin font */
    color: var(--color-primary);
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Current price (after ::after adds PLN) */
.product-card-price .price-current::after {
    content: " PLN";
}

/* Regular price (old price - strikethrough) */
.product-card-price .price-regular {
    font-size: 0.9rem;
    font-weight: 300;
    color: #999;
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    order: 1; /* Appears first */
}

.product-card-price .price-regular::after {
    content: " PLN";
}

.product-card-price .price-current {
    order: 2; /* Appears second */
}

/* Sale price styling */
.product-card-price.on-sale .price-current {
    color: #c41e3a; /* Czerwony */
    font-weight: 500; /* Grubszy */
}

/* ===== ARROW BUTTON (Link to Product Page) ===== */
.product-card-arrow-btn {
    /* Position offset - adjust these to move button without affecting layout */
    --btn-offset-x: -3rem;    /* negative = left, positive = right */
    --btn-offset-y: -1.5rem;    /* negative = up, positive = down */
    
    width: 4rem;
    height: 4rem;
    min-width: 3rem;
    background-color: var(--color-primary);
    color: var(--color-secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    transform: translate(var(--btn-offset-x), var(--btn-offset-y));
}

.product-card-arrow-btn svg {
    width: 2.25rem;
    height: 2.25rem;
    stroke-width: 2.5;
}

.product-card-arrow-btn:hover {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    transform: translate(var(--btn-offset-x), var(--btn-offset-y)) translateY(-0.125rem) scale(1.05);
    box-shadow: 0 0.375rem 1rem rgba(0, 0, 0, 0.2);
}

.product-card-arrow-btn:active {
    transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1);
}

/* Loading state - spinner */
.product-card-arrow-btn.loading {
    pointer-events: none;
    position: relative;
}

.product-card-arrow-btn.loading svg {
    opacity: 0;
}

.product-card-arrow-btn.loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid transparent;
    border-top-color: var(--color-secondary);
    border-right-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Added state - checkmark with success animation */
.product-card-arrow-btn.added {
    background-color: #4CAF50 !important;
    pointer-events: none;
    animation: successTilt 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Override hover state when added */
.product-card-arrow-btn.added:hover {
    background-color: #4CAF50 !important;
    transform: translate(var(--btn-offset-x), var(--btn-offset-y));
}

@keyframes successTilt {
    0% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1) rotate(0deg);
    }
    20% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1.1) rotate(-8deg);
    }
    40% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1.1) rotate(8deg);
    }
    60% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1.1) rotate(-4deg);
    }
    80% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1.05) rotate(2deg);
    }
    100% {
        transform: translate(var(--btn-offset-x), var(--btn-offset-y)) scale(1) rotate(0deg);
    }
}

.product-card-arrow-btn.added svg {
    opacity: 0;
}

.product-card-arrow-btn.added::after {
    content: '';
    position: absolute;
    width: 0.5rem;
    height: 0.875rem;
    border: solid var(--color-secondary);
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    margin-top: -0.125rem;
    animation: checkmarkDraw 0.3s ease-out 0.2s both;
}

@keyframes checkmarkDraw {
    0% {
        height: 0;
        width: 0;
        opacity: 0;
    }
    50% {
        height: 0.875rem;
        width: 0;
        opacity: 1;
    }
    100% {
        height: 0.875rem;
        width: 0.5rem;
        opacity: 1;
    }
}

/* ===== OVERRIDE WOOCOMMERCE DEFAULT GRID STYLES ===== */
.woocommerce ul.products[class*="columns-"] li.product,
.woocommerce-page ul.products[class*="columns-"] li.product {
    width: 90% !important; /* Override WooCommerce's width */
    float: none !important; /* Disable float layout */
    clear: none !important; /* Disable clear */
    margin: 0 !important; /* Remove margin (we use gap) */
}

/* Desktop - Default (3 columns) */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    justify-items: stretch;
    padding-left: 3.75rem;
}

/* Remove pseudo-elements that interfere with grid */
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    display: none !important;
}

/* Tablet (max-width: 1024px) - 2 columns */
@media (max-width: 1024px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .woocommerce {
        padding: 0;
    }
}

/* Mobile (max-width: 768px) - 2 columns */
@media (max-width: 768px) {
    /* Grid: 2 columns */
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .woocommerce {
        padding: 0;
    }
    
    /* Shop info - stack vertically */
    .shop-info {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 2rem;
    }
    
    .shop-breadcrumbs {
        text-align: center;
    }
    
    .shop-breadcrumbs .woocommerce-breadcrumb {
        margin-left: 0;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .shop-title {
        grid-column: 1;
        font-size: 1.5rem;
        text-align: center;
        margin-top: -1rem;
    }
    
    .shop-controls {
        grid-column: 1;
        grid-row: 3;
        justify-content: flex-end;
        padding-right: 1rem;
    }
    
    /* Smaller sorting button on mobile */
    .shop-controls .woocommerce-ordering {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .shop-controls .woocommerce-ordering::before {
        width: 2.5rem;
        height: 2.5rem;
        background-size: 1rem;
    }
    
    /* Products grid section - smaller padding */
    .products-grid-section {
        padding: 1.5rem 0;
        margin-left: -2rem;
    }
    
    /* Product grid padding on mobile */
    .products-grid-section .woocommerce ul.products {
        padding: 0 1rem;
    }
    
    /* Product card adjustments */
    .product-card-content {
        padding: 0.75rem 0;
    }
    
    /* Mobile only - przesunięcie zdjęcia w lewo */
    .woocommerce ul.products li.product a img {
        object-position: -0.72rem center;
    }
    
    .product-card-title {
        font-size: 0.9rem;
    }
    
    .product-card-price {
        font-size: 0.85rem;
        gap: 0.35rem;
    }
    
    .product-card-price .price-regular {
        font-size: 0.75rem;
    }
    
    /* Fix arrow button to be perfectly circular */
    .product-card-arrow-btn {
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        min-height: 2.5rem;
        flex-shrink: 0;
        transform: none;
    }
    
    .product-card-arrow-btn:hover {
        transform: none;
    }
    
    .product-card-arrow-btn:active {
        transform: scale(0.95);
    }
    
    .product-card-arrow-btn svg {
        width: 1rem;
        height: 1rem;
    }
    
    /* Move badges higher on mobile */
    .product-badge {
        top: 0;
        right: 0.3125rem;
        padding: 0.1875rem 0.5rem;
        font-size: 0.65rem;
    }
    
    .custom-badge {
        top: 0.5rem;
    }
}

/* ===== ARCHIVE GALLERY ROWS ===== */
/* Edge-to-edge gallery rows - simple, no tricks needed */
.archive-gallery-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0; /* No gap between images */
    margin: 2rem 0;
    width: 100%;
}

.archive-gallery-image {
    position: relative;
    overflow: hidden;
    border-radius: 0; /* No border radius for edge-to-edge */
    aspect-ratio: 16 / 10; /* Shorter height */
}

.archive-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.archive-gallery-image:hover img {
    transform: scale(1.03);
}

/* Single image in gallery row - center it */
.archive-gallery-row:has(.archive-gallery-image:only-child) {
    grid-template-columns: 1fr;
}

/* Mobile: Show only first image */
@media (max-width: 768px) {
    .archive-gallery-row {
        grid-template-columns: 1fr;
        gap: 0;
        margin: 1.5rem 0;
    }
    
    .archive-gallery-image {
        aspect-ratio: 16 / 9;
    }
    
    /* Hide second image on mobile */
    .archive-gallery-image:nth-child(2) {
        display: none;
    }
}
