/* 
 * Custom Lightbox Styles & Hotfixes
 * Loaded separately to bypass build process issues.
 */

/* ==========================================================================
   SHORT DESCRIPTION FORMATTER STYLES
   ========================================================================== */

.sf-short-description {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-secondary, #4a5568);
}

.sf-features-header {
    font-weight: 600;
    color: var(--color-text-primary, #1a202c);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.sf-features-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sf-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.04) 100%);
    border-radius: 0.5rem;
    border-left: 3px solid var(--color-success, #22c55e);
    transition: all 0.2s ease;
}

.sf-features-list li:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.06) 100%);
    transform: translateX(2px);
}

.sf-feature-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.sf-feature-text {
    flex: 1;
    color: var(--color-text-primary, #1a202c);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* --- OVERRIDE: WooCommerce Thumbnail Gallery Padding --- */
.woocommerce div.product div.images .flex-control-thumbs {
    padding: 4px !important;
}

/* --- HOTFIX: Price Margin --- */
.sf-product-details .price {
    margin-bottom: 0.2rem !important;
}

/* --- HOTFIX: Force Gallery Visibility (Fixes Missing Image on Single Product) --- */
/* 
   WooCommerce hides the gallery with opacity: 0 until JS initializes. 
   If there is a JS error or conflict (e.g. FSE block issues), the image stays hidden.
   This forces it to be visible immediately.
*/
.woocommerce-product-gallery {
    opacity: 1 !important;
    transition: opacity 0.2s ease-in-out !important;
}

/* --- HOTFIX: Badge Positioning (Safe Fallback) --- */
.sf-bestseller-card .onsale,
.sf-product-card .onsale {
    position: absolute !important;
    top: 0.75rem !important;
    left: 0.75rem !important;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    color: white !important;
    padding: 0.25rem 0.625rem !important;
    border-radius: 9999px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    z-index: 10;
}

/* --- MODERN LIGHTBOX (DARK GLASSM) --- */
.pswp__bg {
    background: rgba(10, 10, 10, 0.85) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    transition: opacity 333ms cubic-bezier(0.4, 0, 0.22, 1) !important;
}

/* Smooth UI Entrance */
.pswp__ui--fit .pswp__top-bar,
.pswp__ui--fit .pswp__caption {
    background: transparent !important;
}

/* Animated Buttons Entrance */
.pswp__button {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    margin: 12px 6px !important;
    width: 44px !important;
    height: 44px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    float: right;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: pswpButtonFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.1s;
}

@keyframes pswpButtonFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pswp__button:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.1) translateY(0);
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Staggered animation for controls */
.pswp__button--close {
    animation-delay: 0.1s;
}

.pswp__button--share {
    animation-delay: 0.15s;
}

.pswp__button--fs {
    animation-delay: 0.2s;
}

.pswp__button--zoom {
    animation-delay: 0.25s;
}

/* Arrows - Classic Sprite Restoration (User Request) */
.pswp__button--arrow--left,
.pswp__button--arrow--right {
    background-color: rgba(255, 255, 255, 0.1) !important;
    margin: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    position: absolute !important;
    width: 56px !important;
    height: 56px !important;
    opacity: 1 !important;
    float: none !important;
    border-radius: 50% !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
    animation: none !important;
    background-image: none !important;
    /* Remove SVG override */
}

/* User provided positioning for Sprite */
.pswp__button--arrow--left:before,
.pswp__button--arrow--right:before {
    content: '' !important;
    top: 13px !important;
    /* Centering for 56px height (56-30)/2 = 13 */
    height: 30px !important;
    width: 32px !important;
    position: absolute !important;
    background-color: transparent !important;
    display: block !important;
}

.pswp__button--arrow--left:before {
    left: 12px !important;
    /* Centering for 56px width (56-32)/2 = 12 */
    background-position: -138px -44px !important;
}

.pswp__button--arrow--right:before {
    right: 12px !important;
    left: auto !important;
    background-position: -94px -44px !important;
}

.pswp__button--arrow--left {
    left: 32px !important;
}

.pswp__button--arrow--right {
    right: 32px !important;
}

.pswp__button--arrow--left:hover,
.pswp__button--arrow--right:hover {
    transform: translateY(-50%) scale(1.1) !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
}

/* Caption & Counter */
.pswp__caption__center {
    display: none !important;
}

.pswp__counter {
    font-family: var(--font-heading, sans-serif);
    color: rgba(255, 255, 255, 0.8);
    text-shadow: none;
    font-size: 1rem;
    padding-top: 24px;
}

/* ==========================================================================
   PRODUCT PAGE SECTIONS - Spacing & Separation
   ========================================================================== */

/* Large spacing between storytelling sections */
.sf-storytelling-container {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.sf-product-story,
.sf-product-specs,
.sf-product-reviews {
    padding: 2.5rem 0;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.sf-product-reviews {
    border-bottom: none;
    padding-bottom: 0;
}

/* Section headings */
.sf-product-story h2,
.sf-product-specs h2,
.sf-product-reviews h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary, #1a202c);
}

/* ==========================================================================
   PRODUCT REVIEWS STYLES
   ========================================================================== */

.sf-product-reviews #reviews {
    padding: 0;
}

.sf-product-reviews .woocommerce-Reviews-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text-primary, #1a202c);
    display: none;
    /* Hide WooCommerce default "Opinie" title - we have our own "Opinie klientów" */
}

/* Reviews List */
.sf-product-reviews #comments {
    margin-bottom: 2rem;
}

.sf-product-reviews .commentlist {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sf-product-reviews .commentlist .review {
    background: var(--color-background, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: box-shadow 0.2s ease;
}

.sf-product-reviews .commentlist .review:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sf-product-reviews .comment_container {
    display: flex;
    gap: 1rem;
}

.sf-product-reviews .comment_container img.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sf-product-reviews .comment-text {
    flex: 1;
}

.sf-product-reviews .comment-text .star-rating {
    margin-bottom: 0.5rem;
}

.sf-product-reviews .comment-text .meta {
    font-size: 0.875rem;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 0.75rem;
}

.sf-product-reviews .comment-text .meta strong {
    color: var(--color-text-primary, #1a202c);
    font-weight: 600;
}

.sf-product-reviews .comment-text .description p {
    margin: 0;
    line-height: 1.6;
    color: var(--color-text-secondary, #475569);
}

/* Star Rating */
.sf-product-reviews .star-rating {
    display: inline-flex;
    font-size: 0.875rem;
    color: #fbbf24;
    position: relative;
}

/* No Reviews Message */
.sf-product-reviews .woocommerce-noreviews,
.sf-no-reviews {
    text-align: center;
    padding: 2rem;
    background: var(--color-surface, #f1f5f9);
    border-radius: 1rem;
    color: var(--color-text-secondary, #475569);
}

/* Review Form */
.sf-product-reviews .comment-respond {
    background: var(--color-surface, #f1f5f9);
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 2rem;
}

.sf-product-reviews .comment-reply-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-text-primary, #1a202c);
}

.sf-product-reviews .comment-form-rating label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.sf-product-reviews .comment-form-rating .stars {
    display: inline-flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.sf-product-reviews .comment-form-rating .stars a {
    font-size: 1.5rem;
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.15s ease;
}

.sf-product-reviews .comment-form-rating .stars a:hover,
.sf-product-reviews .comment-form-rating .stars a.active {
    color: #fbbf24;
}

.sf-product-reviews .comment-form-comment label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.sf-product-reviews .comment-form-comment textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 0.5rem;
    padding: 1rem;
    font-family: inherit;
    resize: vertical;
}

.sf-product-reviews .comment-form-comment textarea:focus {
    outline: none;
    border-color: var(--color-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sf-product-reviews .form-submit input[type="submit"] {
    background: var(--color-primary, #2563eb);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sf-product-reviews .form-submit input[type="submit"]:hover {
    background: var(--color-primary-dark, #1d4ed8);
    transform: translateY(-2px);
}

/* ==========================================================================
   PRODUCT ATTRIBUTES TABLE
   ========================================================================== */

.sf-attributes-table {
    width: 100%;
    border-collapse: collapse;
}

.sf-attributes-table tr {
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

.sf-attributes-table tr:last-child {
    border-bottom: none;
}

.sf-attributes-table th,
.sf-attributes-table td {
    padding: 1rem 0;
    text-align: left;
}

.sf-attributes-table th {
    font-weight: 600;
    color: var(--color-text-primary, #1a202c);
    width: 40%;
}

.sf-attributes-table td {
    color: var(--color-text-secondary, #475569);
}

/* ==========================================================================
   PRODUCT CARD COMPONENT (PHP-generated structure)
   ========================================================================== */

.sf-product-card {
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border, #e2e8f0);
}

.sf-product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

/* Image Container */
.sf-product-card__image-wrapper {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: transparent;
    display: block;
    width: 100%;
}

.sf-product-card__image-link {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.sf-product-card__image-wrapper img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    transition: transform 0.4s ease;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    /* Ensure no other transforms push it */
    transform-origin: center center;
}

.sf-product-card:hover .sf-product-card__image-wrapper img {
    transform: scale(1.08);
}

/* Badges */
.sf-product-card .sf-badges {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Content Area */
.sf-product-card__content {
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Category */
.sf-product-card__category {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sf-product-card__category a {
    color: inherit;
    text-decoration: none;
}

/* Title */
.sf-product-card .wc-block-components-product-title {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.75rem 0 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.625rem;
}

.sf-product-card .wc-block-components-product-title a {
    color: var(--color-text-primary, #1a202c);
    text-decoration: none;
    transition: color 0.2s ease;
}

.sf-product-card .wc-block-components-product-title a:hover {
    color: var(--color-primary, #2563eb);
}

/* Price + Add to Cart Row */
.sf-product-card__price {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text-primary, #1a202c);
    margin-bottom: 0;
}

.sf-product-card__price del {
    color: var(--color-text-muted, #64748b);
    font-size: 0.875rem;
    font-weight: 400;
    margin-right: 0.375rem;
}

.sf-product-card__price ins {
    text-decoration: none;
    color: var(--color-error, #dc2626);
}

/* Actions - Price and Button in one row */
.sf-product-card__actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #e2e8f0);
}

.sf-product-card__actions .add_to_cart_button,
.sf-product-card__actions .button {
    flex: 1;
    text-align: center;
    padding: 0.625rem 1rem !important;
    font-size: 0.8125rem !important;
    font-weight: 600 !important;
    background: var(--color-primary, #2563eb) !important;
    color: white !important;
    border-radius: 0.5rem !important;
    border: none !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
}

.sf-product-card__actions .add_to_cart_button:hover,
.sf-product-card__actions .button:hover {
    background: var(--color-primary-dark, #1d4ed8) !important;
    transform: translateY(-2px);
}

/* Product Grid */
.sf-product-grid {
    display: grid;
    gap: 1.5rem;
}

.sf-product-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.sf-product-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.sf-product-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 1024px) {

    .sf-product-grid.columns-4,
    .sf-product-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {

    .sf-product-grid.columns-4,
    .sf-product-grid.columns-3,
    .sf-product-grid.columns-2 {
        grid-template-columns: 1fr;
    }
}