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

/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    --atc-navy:        #1e3a5f;   /* Primary accent — navy blue */
    --atc-navy-dark:   #152d4a;   /* Hover state */
    --atc-navy-light:  #e8eef5;   /* Tint background */
    --atc-navy-mid:    #2c5282;   /* Secondary navy */
    --atc-green:       #1a6b3a;   /* Buy button */
    --atc-green-dark:  #145230;
    --atc-text-primary:   #1a1a1a; /* 16:1 on white — AAA */
    --atc-text-body:      #2d2d2d; /* 13.5:1 on white — AAA */
    --atc-text-secondary: #555555; /* 7.0:1 on white — AA large + small */
    --atc-text-muted:     #666666; /* 5.7:1 on white — AA */
    --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
   Nuclear-level selectors: Blocksy renders
   product_meta, publisher, genres, and Dokan
   vendor info outside the containers we'd
   normally expect. Target every known pattern.
   ============================================ */

/* ── product_meta block (SKU, Category, Tag) ── */
.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;
}

/* ── Individual product_meta children (in case container is invisible but children leak) ── */
.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;
}

/* ── Blocksy-specific publisher/category/tag/divider output ── */
.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;
}

/* ── Publisher text (Blocksy outputs "DC Comics" as bare text or span) ── */
.atc-publisher,
span.atc-publisher {
    display: none !important;
}

/* ── Legacy metadata block ── */
.atc-comic-metadata {
    display: none !important;
}

/* ── Dokan: vendor info, avatar, report abuse ── */
.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,
/* Dokan mystery-person avatar rendered outside vendor-info-wrap */
.summary img[src*="mystery-person"],
.entry-summary img[src*="mystery-person"],
.woocommerce div.product img[src*="mystery-person"] {
    display: none !important;
}

/* ── Blocksy GENRES: label (rendered outside product_meta) ── */
.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 + LightSlider fix
   ============================================
   FIFU (Featured Image from URL) uses LightSlider with inline
   height:650px on the <ul>. Portrait covers get clipped.
   
   FIX: CSS !important overrides inline styles. Combined with
   JS MutationObserver for belt-and-suspenders reliability.
   ============================================ */

/* === PRIMARY FIX: Override FIFU's inline height:650px === */
ul.fifu-product-gallery,
ul#image-gallery,
ul.lightSlider {
    height: auto !important;
    max-height: none !important;
    min-height: 200px;
    overflow: hidden !important; /* clip non-active slides horizontally */
}

/* Active slide must be position:relative to contribute height */
ul.fifu-product-gallery li.lslide.active,
ul#image-gallery li.lslide.active,
ul.lightSlider li.lslide.active {
    position: relative !important;
    overflow: visible !important;
}

/* Non-active slides: HIDE completely so they don't bleed through */
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;
}

/* Slider wrapper containers — auto height but clip overflow */
.lSSlideOuter,
.lSSlideWrapper {
    overflow: hidden !important;
    max-height: none !important;
    height: auto !important;
}

/* FIFU zoom image — hide the absolutely-positioned zoom overlay */
img.zoomImg,
.zoomContainer,
.woocommerce-product-gallery .zoomImg {
    display: none !important;
}

/* Images: fill width, auto height, no cropping */
ul.fifu-product-gallery img.fifu,
ul#image-gallery img.fifu,
ul.lightSlider img.fifu {
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
    object-fit: contain !important;
}
.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: 100% !important;
    object-fit: contain !important;
    aspect-ratio: auto !important;
}

/* Gallery containers: no fixed aspect ratio or height */
.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;
}

/* Kill pseudo-elements that enforce aspect ratio */
.woocommerce-product-gallery__image::before,
.woocommerce-product-gallery__image::after {
    display: none !important;
    padding-bottom: 0 !important;
    content: none !important;
}

/* Blocksy uses a <figure> with padding-bottom for aspect ratio */
.woocommerce-product-gallery figure,
.woocommerce-product-gallery__image figure {
    padding-bottom: 0 !important;
    height: auto !important;
}


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

/* Author — clear secondary line under title */
.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);
}

/* Publisher · Year · ISBN — small, muted, scannable */
.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 {
    content: "·";
    margin: 0 7px;
    color: #bbb;
}

/* Brief Description — normal weight, subtle tint, no italic */
.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 — WCAG AA compliant labels
   ============================================ */
.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);   /* #666 — passes WCAG AA */
    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;                 /* 12px minimum for labels */
    font-weight: 600;
    color: var(--atc-text-muted);   /* #666 — passes AA */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}
.spec-item dd {
    font-size: 15px;
    font-weight: 500;
    color: var(--atc-text-primary); /* #1a1a1a — AAA */
    margin: 0;
    line-height: 1.5;
}
.spec-na {
    color: #bbb;
    font-weight: 400;
}

/* ============================================
   GENRE TAGS & AGE RATING
   ============================================ */
.book-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 22px;
}
.book-genres {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.genre-tag {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 20px;
    background: var(--atc-navy);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    transition: background var(--atc-transition);
}
.genre-tag:hover {
    background: var(--atc-navy-dark);
    color: #fff;
    text-decoration: none;
}
.genre-tag:focus-visible {
    outline: 3px solid var(--atc-navy-mid);
    outline-offset: 2px;
}

/* Subject tags — slightly lighter variant of genre pills */
.subject-tag {
    background: var(--atc-navy-mid);
}
.subject-tag:hover {
    background: var(--atc-navy);
}

/* Age rating badge */
.age-badge {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
}
.age-all-ages { background: #1a6b3a; color: #fff; }
.age-teen     { background: var(--atc-navy); color: #fff; }
.age-teen-    { background: #5b2c8d; color: #fff; }
.age-mature   { background: #8b1c1c; color: #fff; }

/* ============================================
   AVAILABLE FROM — sellers section
   ============================================ */
.vanguard-sellers-section {
    margin: 24px 0 0;
    padding: 20px;
    background: var(--atc-bg-subtle);
    border-radius: var(--atc-radius);
    border: 1px solid var(--atc-border);
}
.vanguard-sellers-section h3 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--atc-text-primary);
    letter-spacing: 0.01em;
}

/* No sellers state */
.no-sellers {
    text-align: center;
    padding: 24px 20px;
}
.no-sellers p {
    margin: 0 0 12px;
    font-size: 15px;
    color: var(--atc-text-secondary);
}
.no-sellers .hint {
    font-size: 13px;
    color: var(--atc-text-muted);
    margin-top: 6px;
}

/* Sellers list */
.sellers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Individual seller row */
.seller-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--atc-bg-card);
    border-radius: var(--atc-radius);
    border: 1px solid var(--atc-border);
    gap: 12px;
    transition: box-shadow var(--atc-transition);
}
.seller-row:hover {
    box-shadow: 0 2px 10px rgba(30, 58, 95, 0.10);
}

/* Seller info */
.seller-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.seller-info .name {
    font-size: 15px;
    font-weight: 600;
    color: var(--atc-text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.seller-info a.name.seller-link {
    color: var(--atc-navy);
    text-decoration: none;
    transition: color var(--atc-transition);
}
.seller-info a.name.seller-link:hover,
.seller-info a.name.seller-link:focus {
    color: var(--atc-navy-dark);
    text-decoration: underline;
}
.condition {
    font-size: 12px;
    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 (ATC — used sparingly)
   ============================================ */
.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
   ============================================ */



.vanguard-star-rating {
    margin: 0 0 18px;
}
.vanguard-stars-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* WC star icons — use navy tint */
.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 {
    /* WC star-rating at 0% — shows empty star outlines */
    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);
}

/* ============================================
   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%;
    }
}
