/*
Theme stability patch layer
Version: 1.0.0
Purpose:
- Normalize WooCommerce product grids
- Prevent homepage/shop container shrink issues
- Improve responsive consistency
*/

.woocommerce ul.products,
.woocommerce-page ul.products,
.products {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    box-sizing: border-box;
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.products .product {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    float: none !important;
    box-sizing: border-box;
}


.site-content,
.content-area,
.container,
.wrapper,
main {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.home .products,
.blog .products,
.archive .products,
.post-type-archive-product .products {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 991px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 640px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .products {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}


/* WooCommerce My Account Address Layout Fix */
.woocommerce-account .woocommerce-Addresses {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.woocommerce-account .woocommerce-Addresses .woocommerce-Address {
    flex: 1 1 320px;
    min-width: 320px;
    width: calc(50% - 12px);
}

@media (max-width: 768px) {
    .woocommerce-account .woocommerce-Addresses .woocommerce-Address {
        width: 100%;
        min-width: 100%;
    }
}

/* Footer bar — credit on the right */
.footer-bar .s-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-credit {
  margin-left: auto;
}


/* ================================================================
   Order Received page — match Confirm Payment plugin width (700px)
   ================================================================ */

body.woocommerce-order-received .woocommerce-order {
    max-width: 700px !important;
    margin-inline: auto !important;
    width: 100% !important;
}

/* ── Order overview: table-style rows ─────────────────────────── */
body.woocommerce-order-received .woocommerce-order-overview {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 0.75rem;
    padding: 0;
    list-style: none;
    display: block;
    width: 100%;
    margin: 0 0 1.5rem;
    overflow: hidden;
    font-size: 0.9rem;
}

body.woocommerce-order-received .woocommerce-order-overview li {
    display: flex !important;
    align-items: baseline !important;
    justify-content: flex-start !important;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 !important;
    margin: 0;
}

body.woocommerce-order-received .woocommerce-order-overview li:last-child {
    border-bottom: none;
}

body.woocommerce-order-received .woocommerce-order-overview li .da-overview-label {
    display: block !important;
    flex: 0 0 160px !important;
    min-width: 160px !important;
    padding: 0.65rem 1rem !important;
    color: #888 !important;
    font-weight: 400 !important;
    float: none !important;
    margin: 0 !important;
    text-align: left !important;
}

body.woocommerce-order-received .woocommerce-order-overview li strong {
    display: block !important;
    padding: 0.65rem 1rem !important;
    color: var(--s-text, #f9f5f1) !important;
    font-weight: 600 !important;
    float: none !important;
    margin: 0 !important;
    text-align: left !important;
}

/* ── QR code: fix SVG stretching ──────────────────────────────── */
.edc-promptpay-qr,
.seed-promptpay-qr {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 20px !important;
    padding: 20px 24px !important;
    background: #fff !important;
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    margin-bottom: 16px !important;
}

.edc-qr-code,
.seed-promptpay-qr-qrcode {
    flex-shrink: 0 !important;
    width: 150px !important;
    height: 150px !important;
    overflow: hidden !important;
}

img[src^="data:image/svg+xml"] {
    width: 150px !important;
    height: 150px !important;
    max-width: 150px !important;
    display: block !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* ── Bank details: restore flex layout ────────────────────────── */
.edc-bank-table {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.edc-bank-table tr {
    display: flex !important;
    align-items: baseline !important;
    gap: 8px !important;
    border: none !important;
}

.edc-bank-table th {
    display: block !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #888 !important;
    white-space: nowrap !important;
    width: 110px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
}

.edc-bank-table td {
    display: block !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--s-text, #f9f5f1) !important;
    padding: 0 !important;
    border: none !important;
}

.edc-bank-logo img {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    display: block !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    margin: 0 !important;
}

/* ── Order overview label JS inject (shared with Expensive Design) */

/* ── Bank table: stronger specificity to beat woo.min.css th rules ──────── */
.edc-bank-card .edc-bank-table,
.edc-bank-label .edc-bank-table {
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    flex: 1 !important;
    min-width: 0 !important;
    border-collapse: unset !important;
}

.edc-bank-card .edc-bank-table tr,
.edc-bank-label .edc-bank-table tr {
    display: flex !important;
    align-items: baseline !important;
    gap: 8px !important;
    border: none !important;
}

.edc-bank-card .edc-bank-table th,
.edc-bank-label .edc-bank-table th {
    display: block !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: #888 !important;
    white-space: nowrap !important;
    width: 110px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
    background: none !important;
}

.edc-bank-card .edc-bank-table td,
.edc-bank-label .edc-bank-table td {
    display: block !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--s-text, #f9f5f1) !important;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
}

.edc-bank-card .edc-bank-logo img,
.edc-bank-label .edc-bank-logo img {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    display: block !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    margin: 0 !important;
}

/* ── edc-bank-label: force flex (beats WooCommerce label{display:block}) ── */
label.edc-bank-label,
.edc-bank-label {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    width: 100% !important;
    flex-direction: row !important;
}

.edc-bank-card {
    padding-left: 40px !important;
}

/* =============================================================================
   FOOTER WIDGET COLUMNS — arrange the 4 footer widget areas left to right
   (previously had no layout rule at all, so they stacked top to bottom
   as default block-level divs)
   ============================================================================= */
.footer-columns {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 32px;
}

.footer-column .widget-title,
.footer-column h2 {
    color: #f9f5f1;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 16px;
}

.footer-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-column li {
    margin-bottom: 8px;
}

@media (max-width: 991px) {
    .footer-columns {
        grid-template-columns: repeat(2, 1fr);
        gap: 28px;
    }
}

@media (max-width: 600px) {
    .footer-columns {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* =============================================================================
   CTA BLOCK — reduce gap on mobile for both layouts
   Split stacks vertically on mobile so the 4rem desktop gap becomes too large
   ============================================================================= */
@media (max-width: 639px) {
    /* Center layout */
    .ed-cta--center .ed-cta__card {
        gap: 16px !important;
    }
    .ed-cta--center .ed-cta__btn {
        width: 100%;
        justify-content: center;
    }
    /* Split layout — stacks on mobile, reduce gap when stacked */
    .ed-cta--split .ed-cta__card {
        gap: 12px !important;
    }
}

/* =============================================================================
   404 PAGE — the ed-404.php template markup had no matching CSS at all
   (rendered as plain unstyled text/links). Full styling added here.
   ============================================================================= */
.ed-404__hero {
    position: relative;
    overflow: hidden;
    background-color: var(--s-light, #F5F5F5);
    padding: calc(var(--s-header-height, 64px) + 90px) 0 90px;
    text-align: center;
}
.ed-404__ghost {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--s-heading, "Sarabun"), sans-serif;
    font-weight: 800;
    font-size: clamp(180px, 30vw, 420px);
    line-height: 1;
    color: var(--s-text, #121314);
    opacity: 0.05;
    white-space: nowrap;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}
.ed-404__hero-inner {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
}
.ed-404__title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 700;
    color: var(--s-text, #121314);
    margin: 0 0 16px;
}
.ed-404__sub {
    font-size: 16px;
    line-height: 1.7;
    color: var(--s-text-light, #6B6B6F);
    margin: 0 0 36px;
}
.ed-404__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.ed-404__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--s-radius, 8px);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    border: 1px solid var(--s-border, #E5E5E7);
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease;
}
.ed-404__btn--primary {
    background-color: var(--s-accent, #121314);
    color: var(--s-bg, #f9f5f1) !important;
    border-color: var(--s-accent, #121314);
}
.ed-404__btn--primary:hover {
    background-color: var(--s-accent-hover, #333333);
    border-color: var(--s-accent-hover, #333333);
    transform: translateY(-2px);
}
.ed-404__btn--ghost {
    background-color: transparent;
    color: var(--s-text, #121314) !important;
    border-color: var(--s-border, #E5E5E7);
}
.ed-404__btn--ghost:hover {
    background-color: var(--s-bg, #f9f5f1);
    border-color: var(--s-text, #121314);
    transform: translateY(-2px);
}
.ed-404__links-wrap {
    padding: 70px 0 90px;
    background-color: var(--s-bg, #f9f5f1);
}
.ed-404__links-label {
    text-align: center;
    font-family: var(--s-heading, "Sarabun"), sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--s-text-light, #6B6B6F);
    margin: 0 0 28px;
}
.ed-404__links-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .ed-404__links-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .ed-404__links-grid { grid-template-columns: 1fr; }
}
.ed-404__link-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 22px;
    border: 1px solid var(--s-border, #E5E5E7);
    border-radius: var(--s-radius, 8px);
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.ed-404__link-card:hover {
    border-color: var(--s-accent, #121314);
    transform: translateY(-3px);
    box-shadow: var(--s-shadow, 0 1px 4px rgba(0,0,0,0.08));
}
.ed-404__link-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--s-text, #121314);
}
.ed-404__link-desc {
    font-size: 13.5px;
    color: var(--s-text-light, #6B6B6F);
}

/* =============================================================================
   SINGLE POST META LINE (date / author / category above the excerpt)
   Force a solid, clearly legible dark gray here specifically — don't only
   rely on the shared --s-text-light variable for this element, since it's
   one of the most-read lines on the page and needs guaranteed contrast.
   ============================================================================= */
.content-single .entry-meta,
.content-single .entry-meta a,
.single-area .entry-meta,
.single-area .entry-meta a {
    color: #3a3e42 !important;
    font-weight: 500 !important;
}
.content-single .entry-meta svg,
.single-area .entry-meta svg {
    fill: #3a3e42 !important;
    color: #3a3e42 !important;
}
.content-single .entry-meta a:hover,
.single-area .entry-meta a:hover {
    color: var(--s-accent, #121314) !important;
}

/* =============================================================================
   UNIFY CARD / COMPONENT HEADING SIZES TO 18px
   Card-level headings across different blocks had drifted to different sizes
   (17–23px+). Force them all to a single consistent 18px, using literal px
   with !important so this can't be re-diluted by rem/root-font-size drift
   or any other rule loaded later.
   (Does NOT touch large section headlines like the Split Feature block's
   main "Expensive Design" heading — only card/item-level headings.)
   ============================================================================= */
.efc-title,
.eic-title,
.esf-item__label,
.ed-cta__heading,
.content-item .entry-title {
    font-size: 18px !important;
    line-height: 1.35 !important;
}

/* Footer social icons (Brand Identity > Social) */
.footer-social {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}
.footer-social__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--ed-social-size, 20px) + 16px);
    height: calc(var(--ed-social-size, 20px) + 16px);
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: inherit;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.footer-social__link svg {
    width: var(--ed-social-size, 20px);
    height: var(--ed-social-size, 20px);
}
.footer-social__link:hover {
    background: var(--s-accent, #121314);
    color: var(--s-bg, #f9f5f1);
    transform: translateY(-2px);
}
