/**
 * PW Shop Tree  v1.0.4
 *
 * Brand restyle — navy structure, orange action, light base.
 * Tokens prefixed --pwst- to stay self-contained.
 */

:root {
    --pwst-navy: #28235B;
    --pwst-navy-hover: #1E1A45;
    --pwst-orange: #FF9D52;
    --pwst-orange-hover: #F08A3A;
    --pwst-navy-tint: #EDECF3;
    --pwst-orange-tint: #FFF1E6;
    --pwst-border: #E6E6EC;
    --pwst-text: #2F2E3D;
    --pwst-muted: #8E8CA6;
}

/* ── Page wrapper — kill Divi's default WC layout ──── */

.pw-shop-tree-page {
    max-width: 900px;
    margin: 40px auto 60px;
    padding: 0 20px;
}

.pw-shop-tree-page .woocommerce-result-count,
.pw-shop-tree-page .woocommerce-ordering,
.pw-shop-tree-page .woocommerce-pagination,
.pw-shop-tree-page .woocommerce-breadcrumb {
    display: none !important;
}

/* ── Tree container ──────────────────────────────────── */

.pw-shop-tree {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pw-shop-tree__empty,
.pw-shop-tree__no-results {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--pwst-muted);
    font-size: 16px;
}

/* ── Toolbar / search ────────────────────────────────── */

.pw-shop-tree__toolbar {
    margin-bottom: 20px;
}

.pw-shop-tree__search {
    position: relative;
}

.pw-shop-tree__search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--pwst-navy);
    opacity: 0.45;
    pointer-events: none;
}

.pw-shop-tree__search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 16px 13px 44px;
    font-size: 15px;
    font-family: inherit;
    color: var(--pwst-navy);
    border: 1px solid var(--pwst-border);
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pw-shop-tree__search-input::placeholder {
    color: var(--pwst-muted);
}

.pw-shop-tree__search-input:focus {
    outline: none;
    border-color: var(--pwst-orange);
    box-shadow: 0 0 0 3px rgba(255, 157, 82, 0.25);
}

/* ── Category ────────────────────────────────────────── */

.pw-shop-tree__category {
    margin-bottom: 14px;
}

.pw-shop-tree__category.is-filtered-out {
    display: none;
}

.pw-shop-tree__cat-toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 18px 22px;
    border: 1px solid var(--pwst-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 4px 0 0 var(--pwst-navy);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.pw-shop-tree__cat-toggle:hover {
    background: var(--pwst-navy-tint);
    border-color: #D6D6E0;
}

.pw-shop-tree__cat-toggle:active {
    background: #E3E2EE;
}

.pw-shop-tree__cat-toggle[aria-expanded="true"] {
    background: var(--pwst-navy-tint);
    box-shadow: inset 4px 0 0 var(--pwst-orange);
}

.pw-shop-tree__cat-name {
    font-weight: 600;
    font-size: 17px;
    color: var(--pwst-navy);
}

.pw-shop-tree__cat-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--pwst-navy);
    background: var(--pwst-navy-tint);
    padding: 3px 11px;
    border-radius: 20px;
    font-weight: 500;
}

.pw-shop-tree__cat-toggle[aria-expanded="true"] .pw-shop-tree__cat-count {
    background: #fff;
}

/* ── Arrow ───────────────────────────────────────────── */

.pw-shop-tree__arrow {
    display: inline-block;
    font-size: 12px;
    color: var(--pwst-navy);
    opacity: 0.7;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    width: 14px;
    text-align: center;
}

.pw-shop-tree__arrow--product {
    opacity: 0.5;
}

.pw-shop-tree__arrow--hidden {
    visibility: hidden;
}

[aria-expanded="true"] > .pw-shop-tree__arrow,
[aria-expanded="true"] > .pw-shop-tree__arrow--product {
    transform: rotate(90deg);
}

/* ── Product list (smooth open) ──────────────────────── */

.pw-shop-tree__products {
    padding: 4px 0 8px 0;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.pw-shop-tree__products.is-open {
    opacity: 1;
    transform: translateY(0);
}

/* ── Product row ─────────────────────────────────────── */

.pw-shop-tree__product {
    border-radius: 8px;
    margin: 4px 0 4px 28px;
    transition: background 0.12s;
}

.pw-shop-tree__product.is-filtered-out {
    display: none;
}

.pw-shop-tree__product:hover {
    background: var(--pwst-navy-tint);
}

.pw-shop-tree__product-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    gap: 16px;
    min-height: 52px;
}

.pw-shop-tree__product-toggle,
.pw-shop-tree__product-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.pw-shop-tree__product-info {
    cursor: default;
}

.pw-shop-tree__product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--pwst-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.pw-shop-tree__product-short {
    font-size: 13px;
    color: var(--pwst-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right section */

.pw-shop-tree__product-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.pw-shop-tree__price {
    font-size: 14px;
    font-weight: 600;
    color: var(--pwst-navy);
    background: var(--pwst-navy-tint);
    padding: 5px 11px;
    border-radius: 8px;
    white-space: nowrap;
    line-height: 1.3;
}

.pw-shop-tree__price .woocommerce-Price-amount {
    font-size: inherit;
    color: inherit;
}

.pw-shop-tree__price del {
    opacity: 0.55;
    text-decoration: line-through;
    font-weight: 400;
    margin-right: 4px;
}

.pw-shop-tree__price ins {
    text-decoration: none;
    font-weight: 600;
}

.pw-shop-tree__price .screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* Order button — orange action, navy text */

.pw-shop-tree__order-btn {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    background: var(--pwst-orange);
    color: var(--pwst-navy);
    padding: 9px 22px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, transform 0.05s;
    line-height: 1.3;
    letter-spacing: 0.01em;
}

.pw-shop-tree__order-btn:hover {
    background: var(--pwst-orange-hover);
    color: var(--pwst-navy);
    text-decoration: none;
}

.pw-shop-tree__order-btn:active {
    transform: scale(0.98);
}

/* ── Detail panel (smooth open) ──────────────────────── */

.pw-shop-tree__detail {
    padding: 0 20px 16px 44px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.pw-shop-tree__detail.is-open {
    opacity: 1;
    transform: translateY(0);
}

.pw-shop-tree__detail p {
    font-size: 14px;
    color: #6B6982;
    line-height: 1.6;
    margin: 0;
}

/* ── Blocked customer notice ──────────────────────── */

.pw-shop-tree--blocked {
    padding: 40px 20px;
    text-align: center;
}

.pw-shop-tree__blocked-notice {
    max-width: 500px;
    margin: 0 auto;
    padding: 30px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.pw-shop-tree__blocked-notice h3 {
    margin: 0 0 8px;
    color: #991b1b;
    font-size: 18px;
}

.pw-shop-tree__blocked-notice p {
    margin: 0;
    color: #7f1d1d;
    font-size: 14px;
}

/* ── Reduced motion ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .pw-shop-tree__products,
    .pw-shop-tree__detail,
    .pw-shop-tree__arrow,
    .pw-shop-tree__order-btn {
        transition: none;
    }
    .pw-shop-tree__products,
    .pw-shop-tree__detail {
        transform: none;
    }
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 600px) {

    .pw-shop-tree-page {
        margin: 20px auto 40px;
        padding: 0 12px;
    }

    .pw-shop-tree__cat-toggle {
        padding: 16px 18px;
        gap: 10px;
    }

    .pw-shop-tree__cat-name {
        font-size: 16px;
    }

    .pw-shop-tree__product {
        margin-left: 12px;
    }

    .pw-shop-tree__product-row {
        flex-wrap: wrap;
        padding: 12px 14px;
        gap: 8px;
        min-height: auto;
    }

    .pw-shop-tree__product-toggle,
    .pw-shop-tree__product-info {
        flex-basis: 100%;
        flex-wrap: wrap;
    }

    .pw-shop-tree__product-short {
        flex-basis: 100%;
        padding-left: 24px;
        white-space: normal;
        margin-top: 2px;
    }

    .pw-shop-tree__product-right {
        width: 100%;
        justify-content: space-between;
        padding-left: 24px;
        padding-top: 4px;
    }

    .pw-shop-tree__order-btn {
        padding: 10px 24px;
        font-size: 14px;
    }

    .pw-shop-tree__detail {
        padding: 0 14px 14px 36px;
    }
}
