/**
 * TMU Product Loop Widget Styles
 * Matches the TMU Shop Page E-Book Library Card Design System
 */

.tmu-product-loop-widget {
    position: relative;
    width: 100%;
}

/* 1. Category Filter Tabs Navigation */
.tmu-product-tabs-wrapper {
    margin-bottom: 32px;
    width: 100%;
}

.tmu-product-tabs-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0;
    padding: 4px 2px;
}

.tmu-tabs-align-center .tmu-product-tabs-nav {
    justify-content: center;
}

.tmu-tabs-align-right .tmu-product-tabs-nav {
    justify-content: flex-end;
}

.tmu-tabs-align-left .tmu-product-tabs-nav {
    justify-content: flex-start;
}

.tmu-product-tabs-nav .tmu-cat-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    color: #2b3655;
    background: #ffffff;
    border: 1px solid #e1e4ed;
    border-radius: 9999px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.3;
    white-space: nowrap;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(15, 28, 61, 0.04);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.tmu-product-tabs-nav .tmu-cat-pill:hover {
    background: #eef2f8;
    border-color: #cbd5e1;
    color: #0f1c3d;
    transform: translateY(-1px);
}

.tmu-product-tabs-nav .tmu-cat-pill.is-active {
    background: #0f1c3d;
    border-color: #0f1c3d;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 28, 61, 0.18);
    transform: translateY(0);
}

.tmu-product-tabs-nav .tmu-cat-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(15, 28, 61, 0.2);
}

/* 2. Product Grid Loop */
.tmu-product-loop-grid {
    display: grid;
    grid-template-columns: repeat(var(--tmu-pl-cols-desktop, 4), 1fr);
    gap: var(--tmu-pl-gap, 26px);
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
}

.tmu-product-grid-item {
    margin: 0;
    padding: 0;
    width: 100%;
    list-style: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: scale(1);
}

.tmu-product-grid-item.is-hidden {
    display: none !important;
    opacity: 0;
    transform: scale(0.96);
}

.tmu-product-grid-item.is-animating-in {
    animation: tmuPlFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes tmuPlFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 3. Book Card Anatomy (Shop Page Match) */
.tmu-product-loop-widget .tmu-book-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(15, 28, 61, 0.03);
}

.tmu-product-loop-widget .tmu-book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(15, 28, 61, 0.09);
    border-color: #cbd5e1;
}

/* Top Media Area */
.tmu-product-loop-widget .tmu-book-card-media {
    background-color: #eaedf6;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 20px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

.tmu-product-loop-widget .tmu-book-mockup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 !important;
    padding: 0 !important;
    perspective: 800px;
}

.tmu-product-loop-widget .tmu-book-cover-img {
    display: block;
    width: auto;
    max-width: 175px;
    height: auto;
    border-radius: 4px 12px 12px 4px;
    object-fit: contain;
    margin: 0 !important;
    padding: 0 !important;
    transform: rotate(-2.2deg);
    box-shadow: none !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tmu-product-loop-widget .tmu-book-card:hover .tmu-book-mockup .tmu-book-cover-img {
    transform: rotate(-0.8deg) translateY(-4px);
}

/* Fallback Vector Cover */
.tmu-product-loop-widget .tmu-book-cover-vector {
    width: 132px;
    height: 184px;
    border-radius: 4px 12px 12px 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 12px;
    margin: 0 !important;
    transform: rotate(-2.2deg);
    box-shadow: none !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
}

.tmu-product-loop-widget .tmu-book-card:hover .tmu-book-cover-vector {
    transform: rotate(-0.8deg) translateY(-4px);
}

.tmu-product-loop-widget .tmu-cover-header-tag {
    font-family: inherit;
    font-size: 7.5px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.9;
    display: block;
    margin-bottom: auto;
}

.tmu-product-loop-widget .tmu-cover-title {
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: auto 0 8px;
    word-break: break-word;
}

/* Bottom Card Content Area */
.tmu-product-loop-widget .tmu-book-card-body {
    padding: 22px 22px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: #ffffff;
}

.tmu-product-loop-widget .tmu-book-card-badge-wrap {
    margin-bottom: 12px;
}

.tmu-product-loop-widget .tmu-book-badge {
    display: inline-block;
    background-color: #e6f6f2;
    color: #0e6853;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 9999px;
    text-transform: capitalize;
    line-height: 1.2;
}

.tmu-product-loop-widget .tmu-book-card-title {
    font-family: inherit;
    font-size: 17.5px;
    font-weight: 800;
    color: #0f1c3d;
    line-height: 1.35;
    letter-spacing: -0.015em;
    margin: 0 0 18px;
}

.tmu-product-loop-widget .tmu-book-card-title a {
    color: #0f1c3d;
    text-decoration: none;
    transition: color 0.15s ease;
}

.tmu-product-loop-widget .tmu-book-card-title a:hover {
    color: #0e6853;
}

/* Pricing */
.tmu-product-loop-widget .tmu-book-card-pricing {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 18px;
    margin-top: auto;
    margin-bottom: 18px;
}

.tmu-product-loop-widget .tmu-pricing-col-member {
    display: flex;
    flex-direction: column;
}

.tmu-product-loop-widget .tmu-pricing-label-member {
    font-size: 10.5px;
    font-weight: 800;
    color: #0e6853;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.tmu-product-loop-widget .tmu-pricing-amount-member {
    font-family: inherit;
    font-size: 26px;
    font-weight: 800;
    color: #0f1c3d;
    line-height: 1;
    letter-spacing: -0.02em;
}

.tmu-product-loop-widget .tmu-pricing-col-regular {
    display: flex;
    flex-direction: column;
    margin-bottom: 3px;
}

.tmu-product-loop-widget .tmu-pricing-label-regular {
    font-size: 11.5px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 2px;
}

.tmu-product-loop-widget .tmu-pricing-amount-regular {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    line-height: 1;
}

/* Action Button */
.tmu-product-loop-widget .tmu-book-card-action {
    width: 100%;
}

.tmu-product-loop-widget .tmu-book-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background-color: transparent;
    border: 1.5px solid #283765;
    border-radius: 8px;
    color: #283765;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tmu-product-loop-widget .tmu-book-card:hover .tmu-book-view-btn,
.tmu-product-loop-widget .tmu-book-view-btn:hover {
    background-color: #e59b24;
    border-color: #0f1c3d;
    color: #0f1c3d;
    box-shadow: 0 4px 14px rgba(229, 155, 36, 0.28);
}

/* Empty State */
.tmu-product-loop-widget .tmu-products-empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    color: #64748b;
    font-size: 15px;
    font-weight: 500;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
    .tmu-product-loop-grid {
        grid-template-columns: repeat(var(--tmu-pl-cols-tablet, 2), 1fr);
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .tmu-product-loop-grid {
        grid-template-columns: repeat(var(--tmu-pl-cols-mobile, 1), 1fr);
        gap: 18px;
    }

    .tmu-product-tabs-wrapper {
        margin-bottom: 24px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
    }

    .tmu-product-tabs-wrapper::-webkit-scrollbar {
        display: none;
    }

    .tmu-product-tabs-nav {
        flex-wrap: nowrap;
        width: max-content;
    }

    .tmu-product-tabs-nav .tmu-cat-pill {
        padding: 7px 14px;
        font-size: 12.5px;
    }

    .tmu-product-loop-widget .tmu-book-card-media {
        height: 250px;
    }
}
