/* -------------------------------------------------------------------------- */
/* PolyCMS FlexiWhite - Shop & Product Styles                                 */
/* -------------------------------------------------------------------------- */

/* 
 * Single Product Layout 
 */
.single-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.single-product-image-wrap {
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--geist-accents-1);
}

.single-product-image {
    width: 100%;
    object-fit: cover;
}

.single-product-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.single-product-thumbnail-btn {
    border: 2px solid transparent;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    background: var(--geist-accents-1);
}

.single-product-thumbnail-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
}

.single-product-no-image {
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: var(--radius);
    background-color: var(--geist-accents-1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--geist-accents-4);
}

.single-product-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.single-product-price-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.single-product-price {
    font-size: 2rem;
}

.single-product-price-strike {
    font-size: 1.25rem;
}

/* Badge specifically inside single product summary to ensure padding */
.single-product-summary .badge,
.listing-card .badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background-color: var(--geist-foreground);
    color: var(--geist-background);
}

.single-product-stock {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.single-product-stock.in-stock {
    color: var(--geist-success);
}

.single-product-stock.out-of-stock {
    color: var(--geist-error);
}

.single-product-stock.on-backorder {
    color: var(--geist-accents-5);
}

.single-product-short-desc {
    color: var(--geist-accents-6);
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.single-product-actions {
    margin-top: auto;
}

.single-product-add-to-cart {
    width: 100%;
    padding: 1rem;
}

.single-product-meta {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--geist-accents-2);
    font-size: 0.875rem;
    color: var(--geist-accents-5);
}

.single-product-meta-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.single-product-meta-label {
    width: 100px;
    font-weight: 600;
}

.single-product-meta-value {
    color: var(--geist-foreground);
}

.single-product-meta-link {
    color: var(--geist-foreground);
    text-decoration: underline;
}

.single-product-details {
    padding-top: 1.75rem;
    border-top: 1px solid var(--geist-accents-2);
}

.single-product-details-title {
    font-size: 1.75rem;
    margin-bottom: 2rem;
}

/* Custom grid layouts for buttons and modal */
.product-media-grid {
    display: grid;
    gap: 8px;
    width: 100%;
    margin-top: 15px;
    grid-template-columns: repeat(3, 1fr);
}
.product-media-grid.cols-1 {
    grid-template-columns: 1fr;
}
.product-media-grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}
.product-media-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.product-media-grid .media-action-btn {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .product-media-grid .media-action-btn {
        padding: 8px 6px !important;
        font-size: 0.8rem !important;
        border-radius: 6px !important;
    }
}

/* Purchase Grid */
.product-purchase-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 768px) {
    .product-purchase-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        max-width: 100% !important;
    }
    .product-purchase-grid > button,
    .product-purchase-grid > a {
        padding: 10px !important;
        font-size: 0.85rem !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    /* If only 1 child, span 2 columns */
    .product-purchase-grid > *:only-child {
        grid-column: span 2 !important;
    }
    /* If 3 children, the 3rd child spans 2 columns */
    .product-purchase-grid > *:nth-child(3) {
        grid-column: span 2 !important;
    }
    .ext-btn-price {
        display: none !important;
    }
}

/* Light/Dark mode and spacing adjustments for Lightbox Gallery */
.product-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483640;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.product-preview-modal.is-open {
    display: flex;
}
.product-preview-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    transition: background 0.3s;
}
.product-preview-modal__dialog {
    position: relative;
    width: min(94vw, 1400px) !important;
    max-width: min(94vw, 1400px) !important;
    max-height: min(92vh, 900px) !important;
    margin: auto !important;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-sizing: border-box;
}
.screenshots-viewer {
    background: transparent !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
    padding: 8px;
    border: none !important;
    border-radius: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
}
.screenshots-viewer img {
    max-width: 100% !important;
    max-height: calc(85vh - 120px) !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}
.screenshots-thumbs {
    margin: 12px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.2);
    display: flex;
    justify-content: center;
    gap: 8px;
    overflow-x: auto;
}

/* Light mode overrides for Modal Lightbox */
html:not(.dark) body:not(.dark) .product-preview-modal__overlay {
    background: rgba(241, 245, 249, 0.7);
}
html:not(.dark) body:not(.dark) .product-preview-modal__dialog {
    background: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
    border-color: rgba(226, 232, 240, 0.8);
}
html:not(.dark) body:not(.dark) .product-lightbox-close {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(203, 213, 225, 0.8);
    color: #0f172a;
}
html:not(.dark) body:not(.dark) .product-lightbox-close:hover {
    background: #ef4444;
    color: #fff;
}
html:not(.dark) body:not(.dark) .product-gallery-nav {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(203, 213, 225, 0.8);
    color: #0f172a;
}
html:not(.dark) body:not(.dark) .product-gallery-nav:hover {
    background: var(--geist-success, #0070f3);
    color: #fff;
    border-color: var(--geist-success, #0070f3);
}
html:not(.dark) body:not(.dark) .screenshots-viewer {
    background: transparent !important;
    border: none !important;
}
html:not(.dark) body:not(.dark) .screenshots-thumbs {
    background: #f1f5f9;
}
html:not(.dark) body:not(.dark) .product-gallery-thumb {
    background: #e2e8f0;
}

@media (max-width: 1024px) {
    .product-preview-modal {
        padding: 10px;
    }
    .product-preview-modal__dialog {
        border-radius: 12px;
        max-height: 90vh;
    }
    .screenshots-viewer img {
        max-height: 60vh;
    }
    .product-gallery-nav {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .product-lightbox-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
    
    /* Reduced padding/margin on Mobile */
    .single-product-grid {
        gap: 1rem !important;
        margin-bottom: 0.75rem !important;
    }
    .single-product-summary {
        padding: 0 10px !important;
    }
    .single-product-price-row {
        margin-bottom: 0.75rem !important;
    }
    .single-product-stats-row {
        margin-top: 4px !important;
        margin-bottom: 8px !important;
    }
    .single-product-stock {
        margin-bottom: 1rem !important;
    }
    .single-product-short-desc {
        margin-bottom: 1rem !important;
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }
    .single-product-meta {
        margin-top: 0.75rem !important;
        padding-top: 0.75rem !important;
    }
    .single-product-details {
        padding-top: 0.75rem !important;
    }
    .single-product-details-title {
        font-size: 1.4rem !important;
        margin-bottom: 1rem !important;
    }

    /* Mobile list view adjustments */
    .is-list .listing-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        min-height: 110px !important;
        overflow: hidden !important;
    }
    .is-list .listing-card__image {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        flex-shrink: 0 !important;
    }
    .is-list .listing-card__image img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }
    .is-list .listing-card__body {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        padding: 0.75rem 0.875rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }
    .is-list .listing-card .badge {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        font-size: 0.65rem !important;
    }
    .is-list .listing-card__title {
        font-size: 0.875rem !important;
        line-height: 1.35 !important;
        margin-bottom: 0.25rem !important;
        word-break: break-word !important;
    }
    /* Mobile toolbar alignment & spacing adjustments */
    .listing-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        margin-bottom: 0.75rem !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    .listing-toolbar {
        display: flex !important;
        width: 100% !important;
        justify-content: flex-end !important;
        align-items: center !important;
        margin-top: 0.25rem !important;
        margin-left: 0 !important;
    }
    .listing-view-toggle {
        margin-left: auto !important;
    }
    .view-toggle-btn {
        padding: 6px 10px !important;
    }
    .view-toggle-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
}

/* -------------------------------------------------------------------------- */
/* PolyCMS FlexiWhite - Group Media (MTxFlow Connection Diagram) Dark/Light Mode   */
/* -------------------------------------------------------------------------- */

/* Light Mode overrides for hardcoded dark/white elements in the diagrams */
.landing-group-media h2.text-white {
    color: var(--theme-heading-color, #111827) !important;
}
.landing-group-media p.text-slate-300,
.landing-group-media p.text-slate-400 {
    color: var(--theme-body-muted-color, #4b5563) !important;
}
.mtx-flow-label {
    background-color: var(--geist-background, #ffffff) !important;
    color: var(--geist-foreground, #1f2937) !important;
    border: 1px solid var(--color-border, #e5e7eb) !important;
}

/* Dark Mode restoration */
html.dark .landing-group-media h2.text-white {
    color: #ffffff !important;
}
html.dark .landing-group-media p.text-slate-300 {
    color: #cbd5e1 !important; /* text-slate-300 */
}
html.dark .landing-group-media p.text-slate-400 {
    color: #94a3b8 !important; /* text-slate-400 */
}
html.dark .mtx-flow-label {
    background-color: rgba(15, 23, 42, 0.95) !important; /* bg-slate-900 */
    color: #f1f5f9 !important; /* text-slate-100 */
    border: 1px solid rgba(51, 65, 85, 0.6) !important; /* border-slate-700 */
}
