/* =====================================================
   PROCORA Fruit3 — Layout
   Site shell: body, header, footer, content, sidebar
   ===================================================== */

/* --- 1. Global / Body --- */
body {
    background: linear-gradient(180deg, #f5faff 0%, #eef6fb 40%, #e3eff8 100%);
}

/* Content headings — same blue as Product card titles (#0b3d63) */
.site-content h1,
.site-content h2,
.site-content h3,
.site-main h1,
.site-main h2,
.site-main h3,
.entry-content h1,
.entry-content h2,
.entry-content h3,
.page-content h1,
.page-content h2,
.page-content h3,
.shop-content h1,
.shop-content h2,
.shop-content h3,
.woocommerce-page .page-title,
.procora-product-title,
.procora-product-title__en,
.procora-product-title__th,
.procora-product-identity,
.procora-product-identity__label,
.procora-product-identity__value {
    color: #0b3d63;
}

/* --- 2. Top Bar --- */
.top-bar {
    /* Option C: primary → mid blue only (no cyan) */
    background: linear-gradient(90deg, #0b5fa5 0%, #1489c6 100%);
    position: relative;
}

.top-bar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.1) 15%, rgba(255,255,255,0.1) 65%, rgba(255,255,255,0.2) 100%);
    pointer-events: none;
}

/* Top bar contact / lang links (Customizer Right Text HTML) */
.top-bar .topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-right: 20px;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .2s ease;
}

.top-bar .topbar-link:hover {
    color: inherit;
    text-decoration: none;
    opacity: .8;
}

.top-bar .topbar-link i,
.top-bar .topbar-link svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0 5px 0 0;
}

.top-bar .topbar-link .procora-inline-icon {
    margin-right: 5px;
}

.top-bar .topbar-link .procora-inline-icon svg {
    width: 16px;
    height: 16px;
    margin: 0 !important;
}

.top-bar .topbar-lang {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

/* --- 3. Header --- */
.site-header,
.header,
.header-wrap {
    background: linear-gradient(5deg, #0b5fa5 30%, #1489c6 60%, #20b3c2 100%);
}

.site-header a,
.site-header i {
    color: #ffffff;
}

.site-header a:hover {
    color: #e6f6ff;
}

/* --- Breadcrumb (WooCommerce + Rank Math) — highlight current page --- */
/* Shared selectors keep visual parity when Rank Math replaces WC markup. */
/* Current page is plain text; links stay muted. */
.woocommerce-breadcrumb,
.rank-math-breadcrumb {
    color: #4a6f8c;
    font-weight: 500;
}

.woocommerce-breadcrumb a,
.rank-math-breadcrumb a {
    color: #71767f;
    font-weight: 400;
}

.woocommerce-breadcrumb a:hover,
.rank-math-breadcrumb a:hover {
    color: #0b5fa5;
}

.woocommerce-breadcrumb a:focus-visible,
.rank-math-breadcrumb a:focus-visible {
    outline: 2px solid #0b5fa5;
    outline-offset: 2px;
}

.woocommerce-breadcrumb > span,
.woocommerce-breadcrumb .separator,
.rank-math-breadcrumb > span,
.rank-math-breadcrumb .separator {
    color: #71767f;
    font-weight: 400;
}

.rank-math-breadcrumb .last {
    color: #4a6f8c;
    font-weight: 500;
}

/* Plant3 hides .woocommerce-breadcrumb on mobile (woo-m.css).
   Show trail on single product + category so users can navigate back. */
@media (max-width: 1023px) {
    .single-product .woocommerce-breadcrumb,
    .single-product .rank-math-breadcrumb,
    .tax-product_cat .woocommerce-breadcrumb,
    .tax-product_cat .rank-math-breadcrumb {
        display: block;
        font-size: 0.8em;
        padding: 4px 0 10px;
        margin: 0;
        line-height: 1.4;
    }
}

/* Shop archive: tighten gap under "หมวดหมู่สินค้า" before category grid */
@media (max-width: 1023px) {
    body.post-type-archive-product .page-header {
        margin: 0;
        padding: 0 0 4px;
    }

    body.post-type-archive-product .page-header h1 {
        margin: 0 0 4px;
        padding: 0;
    }

    body.post-type-archive-product .shop-widgets:not(.active) {
        margin-bottom: 0;
    }

    body.post-type-archive-product .shop-main {
        margin-top: 0;
    }

    body.post-type-archive-product .shop-content {
        padding-top: 0;
    }

    body.post-type-archive-product ul.products {
        margin-top: 8px;
    }
}

/* --- 4. Content Container --- */
.site-content,
.content-area,
.site-main {
    background: #ffffff;
    border-radius: 18px;
    padding: 12px 12px;
    box-shadow: 0 14px 40px rgba(13,79,130,0.10);
}

.site-content {
    margin: 16px 2px 16px 2px;
}

/* Mobile: slightly tighter side gutters (keep Review #004 margin) */
@media (max-width: 767px) {
    .site-content,
    .content-area,
    .site-main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .site-content > .s-container {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* --- 8. Sidebar — Product Category Tree --- */
#secondary {
    background: linear-gradient(180deg, #d3e9f8 0%, #c2dced 100%);
    margin-right: 14px;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 12px 28px rgba(13,79,130,0.18);
    align-self: flex-start;
    height: auto;
}

#secondary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#secondary li {
    position: relative;
    border-radius: 8px;
    margin-bottom: 0;
    border-bottom: 3px solid rgba(11,95,165,0.12);
}

#secondary li > a {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 44px;
    padding: 8px 10px;
    color: #0b3d63;
    font-weight: 500;
    border-radius: 8px;
    transition: background .25s ease, color .25s ease;
}

/* Reserve space so label text does not sit under the toggle hit area */
#secondary li:has(> .cat-toggle) > a {
    padding-right: 48px;
}

#secondary li > a:hover {
    background: linear-gradient(90deg, #cfefff 0%, #bfe8f4 100%);
    color: #0b5fa5;
}

/* Larger tap/click target for subcategory accordion (aligned to parent row) */
#secondary .cat-toggle {
    position: absolute;
    right: 4px;
    top: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0b5fa5;
    cursor: pointer;
    z-index: 1;
    border-radius: 50%;
    transition: background .2s ease;
}

#secondary .cat-toggle::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(11, 95, 165, 0.12);
    transform: scale(0.7);
    opacity: 0;
    transition: transform .2s ease, opacity .2s ease;
    pointer-events: none;
}

#secondary .cat-toggle:hover::before,
#secondary .cat-toggle:focus-visible::before {
    transform: scale(1.15);
    opacity: 1;
}

#secondary .cat-toggle::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    display: inline-block;
    transition: transform .25s ease;
    position: relative;
    z-index: 1;
}

#secondary .cat-toggle:hover::after,
#secondary .cat-toggle:focus-visible::after {
    transform: rotate(45deg) scale(1.35);
}

#secondary li.is-open > .cat-toggle::after {
    transform: rotate(-135deg);
}

#secondary li.is-open > .cat-toggle:hover::after,
#secondary li.is-open > .cat-toggle:focus-visible::after {
    transform: rotate(-135deg) scale(1.35);
}

#secondary li > ul {
    max-height: 0;
    overflow: hidden;
    padding-left: 12px;
    margin-top: 1px;
    transition: max-height .35s ease;
}

#secondary li > ul > li {
    margin-bottom: 1px;
    border-bottom: 1px solid rgba(11,95,165,0.08);
}

#secondary li > ul > li > a {
    min-height: 38px;
    font-size: 14px;
    font-weight: 400;
    padding-left: 18px;
    color: #355d7a;
}

#secondary li.is-current > a {
    background: linear-gradient(90deg, #0b5fa5 0%, #1489c6 100%);
    color: #ffffff;
    font-weight: 700;
}

#secondary li.is-path > a {
    background: rgba(20,137,198,0.15);
    color: #0b5fa5;
    font-weight: 600;
}

#secondary li.is-current > ul,
#secondary li.is-path > ul {
    max-height: 3000px !important;
    overflow: visible !important;
}

/* Sidebar multi-language labels */
.cat-en {
    font-weight: 600;
    font-size: 13.5px;
}

.cat-th {
    font-weight: 400;
    font-size: 12.5px;
    opacity: 0.85;
    margin-top: 2px;
}

/* --- 12. Footer --- */
.site-footer,
.footer,
.footer-wrap {
    background: linear-gradient(180deg, #0b5fa5 0%, #0e6fb8 35%, #0b3d63 100%);
    color: #eaf4fb;
    position: relative;
}

.site-footer::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
}

.site-footer p,
.site-footer li {
    color: #d4e8f6;
}

.site-footer h4,
.site-footer h5 {
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.site-footer a {
    color: #cfefff;
    transition: color .2s ease;
}

.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.site-footer hr,
.site-footer .footer-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    margin: 24px 0;
}

.site-footer .site-info,
.site-footer .copyright {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
}

/* Footer: tighter typography sets */
.site-footer p {
    margin-top: 0;
    margin-bottom: 0.35em;
    line-height: 1.45;
}

.site-footer h2,
.site-footer h3,
.site-footer h4,
.site-footer h5,
.site-footer h6,
.site-footer .widget-title,
.site-footer .s-menu-title {
    margin-top: 0;
    margin-bottom: 0.2em;
    line-height: 1.2;
}

.site-footer ul,
.site-footer .menu {
    margin-bottom: 0.5em;
    padding-top: 0;
    padding-bottom: 0;
}

.site-footer li,
.site-footer .menu li {
    margin-bottom: 0.25em;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 1.4;
}

.site-footer .s-menu {
    margin-bottom: 0.75em;
}

.site-footer .s-menu .menu {
    padding-top: 4px;
    padding-bottom: 0;
}

/* Footer icon size/gap — keep paragraph display intact for text-align: center */
.site-footer p > svg {
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    margin-right: 6px;
}

/* Footer: mobile edge spacing for left-aligned text */
@media (max-width: 767px) {
    .site-footer .footer-widgets {
        padding-left: 16px;
        padding-right: 16px;
    }

    .site-footer .s-menu,
    .site-footer .widget,
    .site-footer .text-left {
        padding-left: 4px;
        padding-right: 4px;
    }
}

/* กรอบข้อความหัว Shop Sidebar */
#secondary h2,
#secondary .wp-block-heading {
    width: 240px;
    background: #1f67ad;
    color: #fff;
    padding: 10px 20px;
    border-radius: 12px;
    margin: 8px auto;
}

/* --- Shop filter toggle (mobile) ---
   Plant3 absolute top-right overlaps PROCORA search H1 / category cards.
   Use a floating control so it does not reserve heading line space. */
@media (max-width: 1023px) {
    .shop-content > .shop-widgets-toggle {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        z-index: 90;
    }

    .shop-content > .shop-widgets-toggle svg {
        background: #ffffff;
        box-shadow: 0 4px 14px rgba(13, 79, 130, 0.22);
    }
}
