/* Vanguard Product Display v1.3.5 — ATC Design System */
/* Navy accent, WCAG AA compliant, UK/AU readability standards */

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    --atc-navy:        #1e3a5f;
    --atc-navy-dark:   #152d4a;
    --atc-navy-light:  #e8eef5;
    --atc-navy-mid:    #2c5282;
    --atc-green:       #1a6b3a;
    --atc-green-dark:  #145230;
    --atc-text-primary:   #1a1a1a;
    --atc-text-body:      #2d2d2d;
    --atc-text-secondary: #555555;
    --atc-text-muted:     #666666;
    --atc-border:         #d4d9e0;
    --atc-bg-subtle:      #f5f7fa;
    --atc-bg-card:        #ffffff;
    --atc-radius:         6px;
    --atc-transition:     0.18s ease;
}

/* ============================================
   HIDE WC/BLOCKSY/DOKAN DUPLICATE OUTPUT
   ============================================ */

.product_meta,
.summary .product_meta,
.entry-summary .product_meta,
.woocommerce div.product .product_meta,
.woocommerce div.product .summary .product_meta,
.woocommerce div.product form.cart + .product_meta,
.single-product .product_meta,
.single-product .summary .product_meta {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.sku_wrapper,
.product_meta .sku_wrapper,
.posted_in,
.product_meta .posted_in,
.tagged_as,
.product_meta .tagged_as,
span.sku_wrapper,
span.posted_in,
span.tagged_as,
p.posted_in,
p.tagged_as {
    display: none !important;
}

.ct-product-metas,
.ct-product-tax,
[class*="ct-product-meta"],
.ct-product-divider,
.ct-product-tags,
.ct-product-categories,
.blocksy-product-tags,
.blocksy-product-categories,
.wc-block-components-product-meta__tagged_as,
.woocommerce-product-details__short-description + .book-details,
.summary > .book-details:not(.book-details-line) {
    display: none !important;
}

.atc-publisher,
span.atc-publisher {
    display: none !important;
}

.atc-comic-metadata {
    display: none !important;
}

.dokan-vendor-info-wrap,
.dokan-store-info,
.dokan-report-abuse-button,
a.dokan-report-abuse-button,
a[href="#report-abuse"],
.seller-rating,
.summary .dokan-vendor-info-wrap,
.entry-summary .dokan-vendor-info-wrap,
.summary img[src*="mystery-person"],
.entry-summary img[src*="mystery-person"],
.woocommerce div.product img[src*="mystery-person"] {
    display: none !important;
}

.entry-summary .tagged_as,
.summary .tagged_as,
.woocommerce div.product .summary .tagged_as,
.woocommerce div.product p.tagged_as,
.woocommerce div.product span.tagged_as {
    display: none !important;
}

/* ============================================
   PRODUCT IMAGE — FIFU Premium (renewed license)
   ============================================
   FIFU Premium renders a bare <img class="fifu visible">
   directly inside Blocksy's .product-entry-wrapper.
   No gallery wrapper, no LightSlider, no WC gallery.
   
   The image gets squished because Blocksy's layout forces
   the image column to a fixed width and width:100% stretches
   the portrait cover to fill the full column width.
   ============================================ */

/* === PRIMARY FIX: FIFU bare <img> inside Blocksy wrapper === */
.product-entry-wrapper > img.fifu,
.product-entry-wrapper img.fifu.visible,
img.fifu.visible {
    width: auto !important;        /* Do NOT stretch to fill column */
    max-width: 100% !important;    /* Don't exceed container */
    height: auto !important;       /* Natural aspect ratio */
    max-height: 750px;             /* Reasonable cap for very tall covers */
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;     /* Center in the column */
    aspect-ratio: auto !important;
}

/* Hide zoom overlay that FIFU sometimes injects */
img.zoomImg,
.zoomContainer,
.woocommerce-product-gallery .zoomImg {
    display: none !important;
}

/* === LEGACY FALLBACK: LightSlider (if FIFU license lapses again) === */
ul.fifu-product-gallery,
ul#image-gallery,
ul.lightSlider {
    height: auto !important;
    max-height: none !important;
    min-height: 200px;
    overflow: hidden !important;
}

ul.fifu-product-gallery li.lslide.active,
ul#image-gallery li.lslide.active,
ul.lightSlider li.lslide.active {
    position: relative !important;
    overflow: visible !important;
}

ul.fifu-product-gallery li.lslide:not(.active),
ul#image-gallery li.lslide:not(.active),
ul.lightSlider li.lslide:not(.active) {
    overflow: hidden !important;
    visibility: hidden !important;
    height: 0 !important;
}

.lSSlideOuter,
.lSSlideWrapper {
    overflow: hidden !important;
    max-height: none !important;
    height: auto !important;
}

ul.fifu-product-gallery img.fifu,
ul#image-gallery img.fifu,
ul.lightSlider img.fifu {
    height: auto !important;
    max-height: none !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
}

/* === JS bypass container (if single-image JS fires) === */
.vpd-single-image {
    text-align: center;
    margin-bottom: 20px;
}
.vpd-single-image .vpd-cover-image {
    width: auto !important;
    max-width: 100% !important;
    max-height: 700px;
    height: auto !important;
    object-fit: contain !important;
    border-radius: var(--atc-radius);
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    display: block;
    margin: 0 auto;
}

/* === Generic WC gallery overrides (safety net) === */
.woocommerce div.product div.images img,
.single-product .wp-post-image,
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery__image a img,
.woocommerce-product-gallery .woocommerce-product-gallery__image img {
    max-height: none !important;
    height: auto !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    aspect-ratio: auto !important;
}

.woocommerce-product-gallery,
.woocommerce div.product div.images,
.woocommerce-product-gallery__image,
.woocommerce-product-gallery .woocommerce-product-gallery__image {
    overflow: visible !important;
    aspect-ratio: auto !important;
    height: auto !important;
    max-height: none !important;
}

.woocommerce-product-gallery__image::before,
.woocommerce-product-gallery__image::after {
    display: none !important;
    padding-bottom: 0 !important;
    content: none !important;
}

.woocommerce-product-gallery figure,
.woocommerce-product-gallery__image figure {
    padding-bottom: 0 !important;
    height: auto !important;
}


/* ============================================
   BOOK METADATA
   ============================================ */
.vanguard-book-meta {
    margin: 4px 0 24px;
}

/* Author — clickable link */
.book-author {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--atc-text-secondary);
    margin: 0 0 8px;
}
.book-author strong {
    font-weight: 600;
    color: var(--atc-text-body);
}
.book-author-link {
    color: inherit;
    text-decoration: none;
    transition: color var(--atc-transition);
}
.book-author-link:hover,
.book-author-link:focus {
    color: var(--atc-navy);
}
.book-author-link:hover strong,
.book-author-link:focus strong {
    color: var(--atc-navy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Publisher · Year · ISBN */
.book-details-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--atc-text-muted);
    margin-bottom: 20px;
}
.book-details-line > span:not(:last-child)::after,
.book-details-line > a:not(:last-child)::after {
    content: "·";
    margin: 0 7px;
    color: #bbb;
}

/* Publisher link styling */
.book-publisher-link {
    color: var(--atc-text-muted);
    text-decoration: none;
    transition: color var(--atc-transition);
}
.book-publisher-link:hover,
.book-publisher-link:focus {
    color: var(--atc-navy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Brief Description */
.book-brief-desc {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--atc-text-body);
    margin: 0 0 22px;
    padding: 14px 18px;
    background: var(--atc-navy-light);
    border-left: 3px solid var(--atc-navy);
    border-radius: 0 var(--atc-radius) var(--atc-radius) 0;
}

/* ============================================
   BOOK SPECS GRID
   ============================================ */
.book-specs {
    margin: 0 0 22px;
    padding: 18px 20px;
    background: var(--atc-bg-subtle);
    border-radius: var(--atc-radius);
    border: 1px solid var(--atc-border);
}
.specs-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--atc-text-muted);
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.specs-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 32px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.spec-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.spec-item dt {
    font-size: 12px;
    font-weight: 600;
    color: var(--atc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}
.spec-item dd {
    font-size: 15px;
    font-weight: 500;
    color: var(--atc-text-primary);
    margin: 0;
    line-height: 1.4;
}
.spec-na {
    color: #bbb;
    font-weight: 400;
}

/* ============================================
   META ROW: Age Rating + Genre side-by-side
   ============================================ */
.book-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px 20px;
    margin-bottom: 22px;
}

/* Age badge */
.book-age-rating-section {
    flex-shrink: 0;
}
.age-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.4;
}
.age-all-ages { background: #d1fae5; color: #065f46; }
.age-teen     { background: #dbeafe; color: #1e40af; }
.age-teen-2b  { background: #fef3c7; color: #92400e; }   /* Teen+ */
.age-mature   { background: #fee2e2; color: #991b1b; }

/* Genre/Subject tags */
.book-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.genre-tag {
    display: inline-block;
    padding: 5px 14px;
    background: var(--atc-navy-light);
    color: var(--atc-navy);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    transition: all var(--atc-transition);
    white-space: nowrap;
}
a.genre-tag:hover,
a.genre-tag:focus {
    background: var(--atc-navy);
    color: #fff;
}
.subject-tag {
    background: var(--atc-bg-subtle);
    color: var(--atc-text-muted);
    border: 1px solid var(--atc-border);
}

/* ============================================
   SELLERS SECTION ("Available From")
   ============================================ */
.vanguard-sellers-section {
    margin: 24px 0;
    padding: 20px;
    background: var(--atc-bg-card);
    border: 1px solid var(--atc-border);
    border-radius: var(--atc-radius);
}
.vanguard-sellers-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--atc-text-primary);
    margin: 0 0 16px;
}
.no-sellers {
    text-align: center;
    padding: 20px 0;
    color: var(--atc-text-muted);
}
.no-sellers .hint {
    font-size: 13px;
    color: var(--atc-text-muted);
    margin-top: 8px;
}
.sellers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.seller-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--atc-bg-subtle);
    border-radius: var(--atc-radius);
    gap: 16px;
}
.seller-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.seller-info .name {
    font-weight: 600;
    font-size: 15px;
    color: var(--atc-text-primary);
}
.seller-link {
    text-decoration: none;
    color: var(--atc-navy);
    transition: color var(--atc-transition);
}
.seller-link:hover {
    color: var(--atc-navy-dark);
    text-decoration: underline;
}

/* Condition badge */
.condition {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--atc-bg-subtle);
    color: var(--atc-text-muted);
    white-space: nowrap;
    line-height: 1.4;
}
.cond-like_new { background: #d1fae5; color: #065f46; }
.cond-good     { background: #dbeafe; color: #1e40af; }
.cond-fair     { background: #fef3c7; color: #92400e; }
.cond-poor     { background: #fee2e2; color: #991b1b; }

/* Seller buttons */
.seller-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.seller-btns button,
.seller-btns a.button,
.seller-btns .vanguard-trade-btn,
.seller-btns .btn-buy {
    padding: 9px 18px;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    border-radius: var(--atc-radius);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--atc-transition);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Trade button — navy */
.vanguard-trade-btn,
a.vanguard-trade-btn,
.button.vanguard-trade-btn,
a.button.vanguard-trade-btn,
.woocommerce a.button.vanguard-trade-btn,
.dokan-add-to-quote-btn.vanguard-trade-btn {
    background: var(--atc-navy) !important;
    color: #fff !important;
    border: none !important;
}
.vanguard-trade-btn:hover,
.vanguard-trade-btn:focus,
a.vanguard-trade-btn:hover,
a.vanguard-trade-btn:focus {
    background: var(--atc-navy-dark) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(30, 58, 95, 0.35);
    outline: none;
}
.vanguard-trade-btn:focus-visible {
    outline: 3px solid var(--atc-navy-mid);
    outline-offset: 2px;
}
.vanguard-trade-btn.is-loading  { opacity: 0.7; pointer-events: none; }
.vanguard-trade-btn.added_to_quote { background: #1a6b3a !important; }

/* Buy button — green */
.btn-buy {
    background: var(--atc-green);
    color: #fff;
}
.btn-buy:hover,
.btn-buy:focus {
    background: var(--atc-green-dark);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(26, 107, 58, 0.35);
    outline: none;
}
.btn-buy:focus-visible {
    outline: 3px solid #2ecc71;
    outline-offset: 2px;
}

/* Wishlist */
.btn-wishlist {
    padding: 10px 18px;
    background: #fff;
    border: 2px solid var(--atc-navy);
    color: var(--atc-navy);
    border-radius: var(--atc-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    transition: all var(--atc-transition);
}
.btn-wishlist:hover,
.btn-wishlist:focus {
    background: var(--atc-navy);
    color: #fff;
}
.btn-wishlist:focus-visible {
    outline: 3px solid var(--atc-navy-mid);
    outline-offset: 2px;
}
.wishlist-cta {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--atc-border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--atc-text-muted);
}

/* ============================================
   CONTENT WARNINGS
   ============================================ */
.book-warnings-section {
    margin: 0 0 18px;
    padding: 12px 16px;
    background: #fffbeb;
    border-radius: var(--atc-radius);
    border: 1px solid #fde68a;
    font-size: 14px;
    line-height: 1.6;
}
.warnings-label {
    font-weight: 700;
    color: #6d4a00;
    margin-right: 6px;
}
.warnings-list {
    color: #6d4a00;
    display: inline;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.vanguard-trade-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--atc-navy);
    color: #fff;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 300px;
    max-width: 90vw;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}
.vanguard-trade-toast.toast-visible { transform: translateY(0); opacity: 1; }
.vanguard-trade-toast .toast-content { display: flex; align-items: center; gap: 12px; }
.vanguard-trade-toast .toast-icon { font-size: 22px; }
.vanguard-trade-toast .toast-message { font-weight: 600; font-size: 15px; line-height: 1.4; }
.vanguard-trade-toast .toast-actions { display: flex; gap: 10px; }
.vanguard-trade-toast .toast-btn {
    background: #fff;
    color: var(--atc-navy);
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background var(--atc-transition);
}
.vanguard-trade-toast .toast-btn:hover { background: #e8eef5; }
.vanguard-trade-toast .toast-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
}
.vanguard-trade-toast .toast-close:hover { opacity: 1; }


/* ============================================
   STAR RATINGS
   ============================================ */
.vanguard-star-rating {
    margin: 0 0 18px;
}
.vanguard-stars-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.vanguard-star-rating .star-rating,
.woocommerce .vanguard-star-rating .star-rating {
    color: var(--atc-navy) !important;
    font-size: 16px !important;
    letter-spacing: 1px;
    line-height: 1;
    overflow: visible !important;
    width: auto !important;
}
.vanguard-star-rating .star-rating::before,
.vanguard-star-rating .star-rating span::before {
    color: var(--atc-navy) !important;
}
.vanguard-rating-summary {
    font-size: 14px;
    color: var(--atc-text-muted);
    line-height: 1.4;
}
.vanguard-review-count {
    color: var(--atc-navy);
    text-decoration: underline;
    font-size: 14px;
    transition: color var(--atc-transition);
}
.vanguard-review-count:hover {
    color: var(--atc-navy-dark);
}
.vanguard-empty-stars {
    font-size: 14px !important;
    color: #ccc !important;
    width: auto !important;
    overflow: visible !important;
}
.vanguard-empty-stars::before {
    color: #ccc !important;
}
.vanguard-no-ratings {
    display: flex;
    align-items: center;
    gap: 8px;
}
.vanguard-no-ratings .vanguard-review-count {
    letter-spacing: normal;
    font-size: 13px;
    color: var(--atc-text-muted);
}

/* ============================================
   ARCHIVE PAGE — Publisher / Author headings
   ============================================ */
.tax-book_publisher .page-title,
.tax-book_author .page-title,
.tax-book_publisher .woocommerce-products-header__title,
.tax-book_author .woocommerce-products-header__title {
    font-size: 28px;
    font-weight: 700;
    color: var(--atc-text-primary);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 520px) {
    .specs-list {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .seller-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .seller-info {
        justify-content: space-between;
    }
    .seller-btns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .vanguard-trade-btn,
    .btn-buy {
        width: 100%;
    }
    .wishlist-cta {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .btn-wishlist {
        width: 100%;
    }
}
