.page-title {
    text-align: center;
    color: var(--color-blue-400);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    text-align: center;
    color: var(--color-white-400);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.wrapper {
    margin: auto;
    margin-top: 100px;
}

.products_section {
    padding: 2rem;
    margin: auto;
    width: 90%;
    max-width: 1400px;
}

.product-category {
    margin-bottom: 3rem;
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

.category-title {
    color: var(--headers);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--color-blue-500);
    background: rgba(64, 89, 120, 0.25);
    border-radius: 0 6px 6px 0;
}

/* MesoLab category filter buttons */
.mesolab-section {
    margin-bottom: 3.5rem;
}

.product-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.product-filter {
    padding: 0.55rem 1rem;
    border: 1px solid #3a4a6a;
    border-radius: 999px;
    background: rgba(30, 40, 60, 0.6);
    color: var(--color-white-300);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.product-filter:hover {
    border-color: var(--color-blue-400);
    color: #fff;
    transform: translateY(-1px);
}

.product-filter.is-active {
    background: var(--color-blue-600);
    border-color: var(--color-blue-400);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.active-category-label {
    color: var(--headers);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-left: 0.25rem;
}

.product-grid--loading,
.mesolab-grid--loading {
    opacity: 0.45;
    pointer-events: none;
    min-height: 260px;
}

.product-grid__error,
.mesolab-grid__error {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-white-400);
    padding: 2rem;
}

/* MesoLab product detail modal */
.meso-details__row {
    margin-bottom: 1rem;
}

.meso-details__row strong {
    display: block;
    color: var(--color-blue-400);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.meso-details__row p {
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--color-white-200);
    margin: 0;
}

/* Unified product grid */
.products-grid,
.pro_lst {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Unified card size */
.products-grid > li,
.pro_card {
    position: relative;
    height: 260px;
    border: 1px solid #3a3a3a;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #1a1a2e;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.products-grid > li:hover,
.pro_card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

.products-grid > li > figure {
    margin: 0;
    height: 100%;
    position: relative;
}

/* Unified image area */
.products-grid > li > figure > img,
.pro_card > img {
    width: 100%;
    height: calc(100% - 52px);
    object-fit: contain;
    display: block;
    padding: 0.5rem;
    background: #1a1a2e;
    box-sizing: border-box;
}

/* Unified caption */
.products-grid > li > figure > figcaption,
.pro_card .pro_name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.82);
    box-sizing: border-box;
}

.products-grid > li > figure > figcaption > h3,
.pro_card .pro_name {
    color: var(--headers);
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
    margin: 0;
}

.container__img-holder {
    cursor: pointer;
    height: 100%;
}

.product-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 9999999;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.product-modal.opened {
    display: flex;
}

.product-modal__content {
    background: #1e1e2e;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
    border: 2px solid var(--color-blue-500);
    box-shadow: var(--shadow-large);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.product-modal__close:hover {
    color: var(--color-blue-400);
}

.product-modal__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #3a3a5a;
    text-align: center;
}

.product-modal__img-wrap {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.product-modal__img {
    width: 100%;
    height: 100%;
    max-width: 280px;
    max-height: 280px;
    object-fit: contain;
    border-radius: 6px;
}

.product-modal__title {
    color: var(--headers);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.35;
    max-width: 100%;
}

.product-modal__body {
    color: var(--color-white-200);
    max-height: 60vh;
    overflow-y: auto;
}

.product-modal--image-only .product-modal__body {
    display: none;
}

.product-modal--image-only .product-modal__header {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.product-modal--image-only .product-modal__img-wrap {
    max-width: 400px;
}

.product-modal__body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.product-modal__body table tbody tr td,
.product-modal__body table thead tr th {
    border: 1px solid #4a4a6a;
    padding: 6px 10px;
    text-align: left;
}

.product-modal__body table thead {
    background-color: #405978;
    color: #fff;
}

b.smalltextleft {
    font-size: 0.9rem;
    text-align: left;
    color: var(--color-blue-400);
    display: block;
    margin: 0.75rem 0 0.5rem;
}

ul.prodesc {
    padding-left: 0;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

ul.prodesc li {
    list-style: none;
    padding: 0.2rem 0 0.2rem 1.2rem;
    position: relative;
}

ul.prodesc li::before {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    border-radius: 50%;
    background: var(--color-blue-500);
    position: absolute;
    left: 0;
    top: 0.55rem;
}

.product-modal__loading {
    text-align: center;
    padding: 2rem;
    color: var(--color-white-400);
}

.img-popup {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999999;
}

.img-popup.opened {
    display: flex;
}

.img-popup img {
    max-width: 800px;
    max-height: 95%;
    width: 100%;
    opacity: 0;
    transform: translateY(-20px);
    border: 3px solid var(--color-blue-500);
    border-radius: 20px;
    box-shadow: inset gray 0 0 60px -12px;
}

.img-popup.opened img {
    animation: animatepopup 0.3s ease forwards;
}

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

.close-btn {
    width: 35px;
    height: 30px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
}

.close-btn .bar {
    height: 4px;
    background: #333;
}

.close-btn .bar:nth-child(1) {
    transform: rotate(45deg);
}

.close-btn .bar:nth-child(2) {
    transform: translateY(-4px) rotate(-45deg);
}

@media only screen and (max-width: 700px) {
    .products_section {
        padding: 1rem 0.5rem;
        width: 95%;
    }

    .product-filter {
        font-size: 0.7rem;
        padding: 0.45rem 0.75rem;
    }

    .products-grid,
    .pro_lst {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .products-grid > li,
    .pro_card {
        height: 240px;
    }

    .products-grid > li > figure > figcaption > h3,
    .pro_card .pro_name {
        font-size: 0.72rem;
    }

    .product-modal__header {
        flex-direction: column;
        text-align: center;
    }
}

@media only screen and (min-width: 1200px) {
    .products-grid,
    .pro_lst {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}
