/**
 * Holy Dog — Single Product Page Redesign
 *
 * Loaded only on single product pages (is_product()).
 * Depends on: style.css (design tokens), custom.css, HDPS inline styles.
 *
 * @package HolydogArtboardsChild
 * @since   1.4.0
 */

/* ─────────────────────────────────────────────────────────
   1.  PRODUCT WRAPPER — constrain width, reset Astra padding
   ───────────────────────────────────────────────────────── */

.single-product .hd-product.product {
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 0 24px;
    float: none !important;
    /* undo Astra float */
    width: 100% !important;
}

/* Astra's default product breadcrumb + page-title spacing */
.single-product .ast-breadcrumbs-wrapper {
    margin-bottom: 12px;
}

/* ─────────────────────────────────────────────────────────
   2.  TWO-COLUMN GRID — gallery (left) + summary (right)
   ───────────────────────────────────────────────────────── */

.hd-product-main {
    display: grid;
    grid-template-columns: 52% 1fr;
    gap: 52px;
    align-items: start;
    margin-bottom: 40px;
}

/* Image column — sticky so summary scrolls past it */
.hd-product-gallery-col {
    position: sticky;
    top: 90px;
    /* Reserve aspect ratio before image loads */
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    background: #f3f6fb;
}

/* The featured image itself */
.hd-product-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 16px;
    /* Subtle lift shadow */
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hd-product-image:hover {
    transform: scale(1.015);
}

/* Placeholder state */
.hd-product-image--placeholder {
    object-fit: contain;
    padding: 24px;
    background: #f3f6fb;
    box-shadow: none;
}

/* Summary column — stacked flex */
.hd-product-summary-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ─────────────────────────────────────────────────────────
   4.  PRODUCT TITLE
   ───────────────────────────────────────────────────────── */

.hd-product-title.product_title {
    font-family: 'Fraunces', Georgia, serif !important;
    font-size: 34px !important;
    font-weight: 700 !important;
    color: var(--hd-ink) !important;
    line-height: 1.18 !important;
    letter-spacing: -0.015em !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ─────────────────────────────────────────────────────────
   5.  STAR RATING ROW
   ───────────────────────────────────────────────────────── */

.hd-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hd-rating-row .star-rating {
    margin: 0 !important;
    font-size: 14px;
    color: #F59E0B;
}

.hd-review-count {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: var(--hd-muted);
    font-weight: 500;
}

/* ─────────────────────────────────────────────────────────
   6.  PRICE
   ───────────────────────────────────────────────────────── */

.hd-price-wrap {
    margin: 2px 0;
    line-height: 1;
}

/* HDPS already styles .hp-price-kg for the per-kg price block */
.hd-price-wrap .woocommerce-Price-amount {
    color: var(--hd-blue);
}

/* ─────────────────────────────────────────────────────────
   7.  CART WRAP — form container
   ───────────────────────────────────────────────────────── */

.hd-cart-wrap {
    margin: 2px 0;
}

/* Ensure the form takes full width */
.hd-cart-wrap form.cart {
    width: 100% !important;
}

/* ADD TO CART button — already styled in style.css via .single_add_to_cart_button;
   here we ensure correct margin when stacked with Buy Now */
.hd-cart-wrap .single_add_to_cart_button {
    margin-top: 12px !important;
    margin-bottom: 0 !important;
    height: 54px !important;
    font-size: 15px !important;
    letter-spacing: 0.08em !important;
}

/* Buy Now button removed per user request. */

/* ─────────────────────────────────────────────────────────
   9.  AVAILABILITY
   ───────────────────────────────────────────────────────── */

.hd-availability {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    margin-top: 2px;
}

.hd-availability-label {
    color: var(--hd-muted);
    font-weight: 500;
}

.hd-availability-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}

.hd-stock-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.hd-stock--in {
    color: #16A34A;
}

.hd-stock--in .hd-stock-dot {
    background: #22C55E;
    box-shadow: 0 0 0 2px #DCFCE7;
}

.hd-stock--out {
    color: #DC2626;
}

.hd-stock--out .hd-stock-dot {
    background: #EF4444;
    box-shadow: 0 0 0 2px #FEE2E2;
}

/* ─────────────────────────────────────────────────────────
   10.  SPECIES BADGE
   ───────────────────────────────────────────────────────── */

.hd-species {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1.5px solid;
}

.hd-species--dogs {
    color: #92400E;
    background: #FEF3C7;
    border-color: #FDE68A;
}

.hd-species--cats {
    color: #5B21B6;
    background: #F5F3FF;
    border-color: #DDD6FE;
}

.hd-species--both {
    color: #1D4ED8;
    background: #EFF6FF;
    border-color: #BFDBFE;
}

.hd-trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
}

.hd-trust-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hd-blue);
}

.hd-trust-text {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--hd-ink);
    line-height: 1.35;
    letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────
   12.  BENEFITS BAR — 3-column grid below main grid
   ───────────────────────────────────────────────────────── */

.hd-benefits-bar {
    background: #F6F9FF;
    border: 1px solid var(--hd-line);
    border-radius: 14px;
    padding: 28px 32px;
    margin-bottom: 40px;
}

.hd-benefits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: start;
}

.hd-benefit-divider {
    border: none;
    border-left: 1px solid var(--hd-line);
}

.hd-benefit-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.hd-benefit-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #EEF3FE;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--hd-blue);
}

.hd-benefit-content {
    flex: 1;
    min-width: 0;
}

.hd-benefit-title {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--hd-ink);
    margin: 0 0 4px;
}

.hd-benefit-desc {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    color: var(--hd-muted);
    line-height: 1.55;
    margin: 0;
}

/* ─────────────────────────────────────────────────────────
   13.  ACCORDION (product tabs)
   ───────────────────────────────────────────────────────── */

.hd-accordion.woocommerce-tabs {
    border: 1px solid var(--hd-line);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 48px;
    /* reset any WooCommerce tab UL styles */
    padding: 0 !important;
    list-style: none !important;
}

.hd-accordion-item {
    border-bottom: 1px solid var(--hd-line);
}

.hd-accordion-item:last-child {
    border-bottom: none;
}

/* Header button */
.hd-accordion-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #fff;
    border: none !important;
    border-radius: 0 !important;
    outline: none;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--hd-ink);
    text-align: left;
    transition: background 0.15s ease;
    box-shadow: none !important;
    text-shadow: none !important;
}

.hd-accordion-header:hover {
    background: var(--hd-bg);
}

.hd-accordion-header:focus-visible {
    outline: 2px solid var(--hd-blue);
    outline-offset: -2px;
}

/* Chevron icon */
.hd-accordion-chevron {
    color: var(--hd-muted);
    flex-shrink: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.15s ease;
}

.hd-accordion-header[aria-expanded="true"] .hd-accordion-chevron {
    transform: rotate(180deg);
    color: var(--hd-blue);
}

/* Active header highlight */
.hd-accordion-header[aria-expanded="true"] {
    color: var(--hd-blue);
}

/* Collapsible body */
.hd-accordion-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.28s ease;
    opacity: 0;
}

.hd-accordion-body.open {
    max-height: 3000px;
    opacity: 1;
}

/* Inner content padding */
.hd-accordion-content {
    padding: 4px 24px 24px;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    line-height: 1.75;
    color: var(--hd-ink);
}

.hd-accordion-content p {
    margin-top: 0;
    margin-bottom: 12px;
}

.hd-accordion-content p:last-child {
    margin-bottom: 0;
}

.hd-accordion-content h4 {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hd-muted);
    margin: 20px 0 6px;
    padding: 0;
}

.hd-accordion-content h4:first-child {
    margin-top: 0;
}

/* Description (woocommerce default tab) typography */
.hd-accordion-content .woocommerce-product-details__short-description p {
    margin-bottom: 8px;
}

/* Analysis table (if admin enters a table) */
.hd-accordion-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.hd-accordion-content table td,
.hd-accordion-content table th {
    padding: 8px 12px;
    /*border: 1px solid var(--hd-line);*/
}

.hd-accordion-content table th {
    background: var(--hd-bg);
    font-weight: 700;
    text-align: left;
}

/* Reviews inside accordion */
#hd-tab-reviews .woocommerce-Reviews {
    padding: 0;
}

#hd-tab-reviews .comment-form {
    padding: 0;
}

/* ─────────────────────────────────────────────────────────
   14.  RELATED PRODUCTS — "You May Also Like"
   ───────────────────────────────────────────────────────── */

.single-product .related.products {
    clear: both;
    margin-top: 16px;
}

.single-product .related.products h2 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--hd-ink);
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}

/* ─────────────────────────────────────────────────────────
   15.  REMOVE ASTRA DEFAULT SINGLE-PRODUCT LAYOUT WRAPPERS
        that conflict with our custom grid
   ───────────────────────────────────────────────────────── */

/* Astra wraps gallery + summary in flex; we override with our own grid */
.single-product .woocommerce-product-gallery,
.single-product .summary.entry-summary {
    float: none !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Hide Astra's breadcrumb duplicate in product summary */
.hd-product-summary-col .woocommerce-breadcrumb {
    display: none;
}

/* ─────────────────────────────────────────────────────────
   16.  RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────── */

/* Tablet: single column */
@media (max-width: 900px) {
    .hd-product-main {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .hd-product-gallery-col {
        position: static;
        max-width: 520px;
        margin: 0 auto;
        width: 100%;
    }

    .hd-benefits-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .single-product .hd-product.product {
        padding: 0 16px;
    }

    .hd-product-title.product_title {
        font-size: 26px !important;
    }

    .hd-benefits-bar {
        padding: 20px 18px;
    }

    .hd-benefits-grid {
        grid-template-columns: 1fr;
    }

    .hd-trust-badge {
        flex-direction: row;
        text-align: left;
        flex: 0 0 calc(50% - 8px);
    }

    .hd-accordion-header {
        padding: 16px 18px;
        font-size: 14px;
    }

    .hd-accordion-content {
        padding: 4px 18px 20px;
    }
}

/* ─────────────────────────────────────────────────────────
   17. BESTELLUNG & ABHOLUNG — 3-step ordering section
       Minimalistic, blue-accented, large-print accessible
   ───────────────────────────────────────────────────────── */

.hd-ordering {
    padding: 4px 0 8px;
}

/* Three steps in a horizontal row */
.hd-ordering-steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 20px;
}

/* Individual step card */
.hd-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 22px 20px 22px 0;
}

/* Step head: badge + icon side by side */
.hd-step-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2px;
}

/* Numbered step badge */
.hd-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--hd-blue);
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
    line-height: 1;
}

/* Icon container */
.hd-step-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #EEF3FE;
    color: var(--hd-blue);
    flex-shrink: 0;
}

/* Step title — uppercase, bold, blue */
.hd-step-title {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--hd-blue);
    margin: 0;
    padding: 0;
}

/* Step body — larger for readability */
.hd-step-body {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--hd-ink);
    margin: 0;
}

/* Arrow connector between steps */
.hd-step-arrow {
    display: flex;
    align-items: center;
    padding: 0 4px;
    margin-top: 50px;
    /* aligns with icon centre */
    color: var(--hd-line);
    flex-shrink: 0;
}

/* Payment method pill badges */
.hd-pay-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.hd-pay-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--hd-ink);
    background: #F0F4FF;
    border: 1px solid var(--hd-line);
    border-radius: 999px;
    padding: 3px 10px 3px 7px;
    line-height: 1.4;
}

.hd-pay-badge--razorpay {
    background: #EFF6FF;
    border-color: #BFDBFE;
    color: #1D4ED8;
}

/* Location list in step 3 */
.hd-locations {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hd-locations li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    color: var(--hd-muted);
    line-height: 1.4;
}

.hd-locations li svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--hd-blue);
}

/* Info notice at the bottom of the ordering section */
.hd-ordering-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #F0F7FF;
    border: 1px solid #BFDBFE;
    border-radius: 10px;
    padding: 14px 18px;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    color: var(--hd-ink);
    line-height: 1.6;
}

.hd-ordering-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--hd-blue);
}

/* ── Responsive: stack steps on tablet/mobile ── */
@media (max-width: 820px) {
    .hd-ordering-steps {
        flex-direction: column;
        gap: 0;
    }

    .hd-step {
        padding: 18px 0;
        border-bottom: 1px solid var(--hd-line);
    }

    .hd-step:last-child {
        border-bottom: none;
    }

    .hd-step-arrow {
        display: none;
        /* hide arrows when stacked */
    }
}

/* ═══════════════════════════════════════════════════════════
   Nährwerte — inline progress-bar table
   Rendered by holydog_render_naehrwerte() between the
   benefits bar and the accordion tabs.
   ═══════════════════════════════════════════════════════════ */

/* ── Outer card ──────────────────────────────────────────── */
.hd-nw-wrap {
    background: #fff;
    border: 1px solid var(--hd-line);
    border-radius: 14px;
    padding: 28px 32px 24px;
    margin-bottom: 40px;
}

/* ── Section label (small caps above the intro line) ──────── */
.hd-nw-label {
    display: block;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hd-blue);
    margin-bottom: 6px;
}

/* ── Intro / subtitle line ────────────────────────────────── */
.hd-nw-intro {
    font-family: 'Manrope', sans-serif;
    font-size: 13.5px;
    color: var(--hd-muted);
    margin: 0 0 22px;
    line-height: 1.5;
}

/* ── Table reset ─────────────────────────────────────────── */
.hd-nw-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    table-layout: fixed;
}

/* ── Column widths ───────────────────────────────────────── */
.hd-nw-table col.hd-nw-col-name {
    width: 38%;
}

.hd-nw-table col.hd-nw-col-value {
    width: 62%;
}

/* ── Header row ──────────────────────────────────────────── */
.hd-nw-table thead tr {
    border-bottom: 1.5px solid var(--hd-line);
}

.hd-nw-table thead th {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9ca3af;
    /*padding: 0 0 12px;*/
}

.hd-nw-th-right {
    text-align: right;
}

/* ── Body rows ───────────────────────────────────────────── */
.hd-nw-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.hd-nw-table tbody tr:last-child {
    border-bottom: none;
}

.hd-nw-table tbody tr:hover {
    background: #f8faff;
}

/* ── Nutrient name cell (left) ───────────────────────────── */
.hd-nw-table tbody td {
    padding: 14px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--hd-ink);
    vertical-align: middle;
}

/* ── Bar + value cell (right) ────────────────────────────── */
.hd-nw-bar-cell {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-end;
    padding-right: 0;
}

/* ── Track ───────────────────────────────────────────────── */
.hd-nw-bar {
    display: block;
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: #e9edf5;
    border-radius: 99px;
    overflow: hidden;
}

/* ── Fill — gradient blue ────────────────────────────────── */
.hd-nw-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, var(--hd-blue) 100%);
    border-radius: 99px;
    transition: width 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

/* ── Percentage label ────────────────────────────────────── */
.hd-nw-pct {
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--hd-blue);
    min-width: 52px;
    text-align: right;
    white-space: nowrap;
}

/* ── Optional footnote / note ────────────────────────────── */
.hd-nw-note {
    font-family: 'Manrope', sans-serif;
    font-size: 12.5px;
    color: #9ca3af;
    font-style: italic;
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE — Nährwerte
   ───────────────────────────────────────────────────────── */

/* Tablet: tighten card padding, shrink bar */
@media (max-width: 768px) {
    .hd-nw-wrap {
        padding: 22px 24px 18px;
    }

    .hd-nw-bar {
        max-width: 140px;
    }
}

/* Mobile: collapse to single column — name on top, bar below */
@media (max-width: 540px) {
    .hd-nw-wrap {
        padding: 18px 18px 14px;
        margin-bottom: 28px;
        border-radius: 10px;
    }

    /* Switch table to block layout so each row stacks */
    .hd-nw-table,
    .hd-nw-table tbody,
    .hd-nw-table thead,
    .hd-nw-table tr,
    .hd-nw-table td,
    .hd-nw-table th {
        display: block;
        width: 100%;
        border: 0;
    }

    /* Hide the original thead — labels will be implied */
    .hd-nw-table thead {
        display: none;
    }

    .hd-nw-table tbody tr {
        padding: 12px 0;
        border-bottom: 1px solid #f1f5f9;
    }

    .hd-nw-table tbody tr:last-child {
        padding-bottom: 0;
    }

    /* Name cell: full width, lighter weight on mobile */
    .hd-nw-table tbody td {
        padding: 0 0 8px;
        font-size: 13px;
    }

    /* Bar cell: full width, left-aligned */
    .hd-nw-bar-cell {
        justify-content: flex-start;
        padding: 0;
        gap: 10px;
    }

    .hd-nw-bar {
        max-width: 100%;
        flex: 1;
    }

    .hd-nw-pct {
        min-width: 44px;
        font-size: 13px;
    }
}