/* ==========================================================================
   WESTORX — Order Received / Thank You page
   ========================================================================== */

/* ─── Order Received page: STRICT single-source-of-truth ───────────────
   Kill ALL wrapper padding/margin. Only .wstx-thankyou controls spacing.
   Note: On this page WP renders `<main><div class="container">...</div></main>`
   which inherits the .woocommerce-checkout .container padding (~120px).
   We must zero out THAT container too. */

.woocommerce-order-received .site-main,
.woocommerce-order-received .site-main > .container,
.woocommerce-order-received .woo-wrapper,
.woocommerce-order-received .woocommerce,
.woocommerce-order-received .entry-content,
.woocommerce-order-received .page-content,
.woocommerce-order-received article {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    max-width: 100% !important;
}

/* Keep horizontal padding intact (don't break the layout) but force vertical to 0 */
.woocommerce-order-received .site-main > .container {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Hide the default "Order received" h1 inserted by Woo / page template */
.woocommerce-order-received .page-title,
.woocommerce-order-received h1.page-title,
.woocommerce-order-received h1.entry-title {
    display: none !important;
}

/* The ONE element that controls vertical spacing */
.wstx-thankyou {
    padding-top: calc(var(--header-height) + 24px);
    padding-bottom: 80px;
    background: var(--color-white);
    min-height: 70vh;
    box-sizing: border-box;
}
body.has-announcement .wstx-thankyou {
    padding-top: calc(var(--header-height) + 38px + 24px);
}

/* WooCommerce default order-received heading we don't need */
.woocommerce-order-received .page-title,
.woocommerce-order-received .entry-title,
.woocommerce-order-received h1.entry-title {
    display: none !important;
}

.wstx-thankyou .container {
    max-width: 760px;
}

/* ── HERO ─────────────────────────────────────────────────────────────── */
.wstx-ty-hero {
    text-align: center;
    padding: 0 0 20px;
}

/* Animated check mark */
.wstx-ty-check {
    width: 60px;
    height: 60px;
    margin: 0 auto 18px;
}
.wstx-ty-check svg {
    width: 100%;
    height: 100%;
}
.wstx-ty-check-circle {
    stroke: var(--color-accent);
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: wstx-ty-draw-circle .7s cubic-bezier(.65,0,.45,1) .2s forwards;
}
.wstx-ty-check-tick {
    stroke: var(--color-accent);
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: wstx-ty-draw-tick .5s cubic-bezier(.65,0,.45,1) .85s forwards;
}
@keyframes wstx-ty-draw-circle {
    to { stroke-dashoffset: 0; }
}
@keyframes wstx-ty-draw-tick {
    to { stroke-dashoffset: 0; }
}

.wstx-ty-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin: 0 0 12px 0;
}

.wstx-ty-title {
    font-family: var(--font-secondary);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 400;
    color: var(--color-black);
    margin: 0 0 12px 0;
    line-height: 1.15;
    letter-spacing: 0.01em;
}

.wstx-ty-sub {
    font-size: 1rem;
    color: var(--color-gray-3);
    margin: 0;
    line-height: 1.6;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ── ORDER META CARD ─────────────────────────────────────────────────── */
.wstx-ty-meta {
    background: var(--color-gray-1);
    border: 1px solid var(--color-gray-2);
    padding: 26px 28px;
    margin: 30px 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 32px;
}

.wstx-ty-meta-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.wstx-ty-meta-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-gray-3);
    margin: 0;
}

.wstx-ty-meta-value {
    font-size: 0.95rem;
    color: var(--color-black);
    margin: 0;
    word-break: break-word;
}

.wstx-ty-meta-strong {
    font-weight: 700;
    font-size: 1rem;
}

/* ── NEXT STEPS (3 cards) ────────────────────────────────────────────── */
.wstx-ty-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 30px 0;
}

.wstx-ty-step {
    background: var(--color-white);
    border: 1px solid var(--color-gray-2);
    padding: 22px 20px;
    text-align: center;
}

.wstx-ty-step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--color-gray-1);
    color: var(--color-accent);
    border-radius: 50%;
    margin-bottom: 12px;
}

.wstx-ty-step-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-black);
    margin: 0 0 6px 0;
}

.wstx-ty-step-text {
    font-size: 0.82rem;
    color: var(--color-gray-3);
    margin: 0;
    line-height: 1.5;
}
.wstx-ty-step-text strong {
    color: var(--color-black);
    font-weight: 600;
}

/* ── SECTIONS (Summary, Addresses) ───────────────────────────────────── */
.wstx-ty-section {
    margin: 40px 0;
}

.wstx-ty-section-title {
    font-family: var(--font-secondary);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-black);
    margin: 0 0 18px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-gray-2);
}

/* Order items */
.wstx-ty-items {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-gray-2);
    background: var(--color-white);
}

.wstx-ty-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-gray-2);
    align-items: center;
}
.wstx-ty-item:last-child {
    border-bottom: none;
}

.wstx-ty-item-image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    background: var(--color-gray-1);
}

.wstx-ty-item-body {
    min-width: 0;
}

.wstx-ty-item-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-black);
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.wstx-ty-item-meta {
    font-size: 0.72rem;
    color: var(--color-gray-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 4px 0;
}
.wstx-ty-item-meta strong {
    color: var(--color-black);
}

.wstx-ty-item-qty {
    font-size: 0.78rem;
    color: var(--color-gray-3);
    margin: 0;
}
.wstx-ty-item-qty strong {
    color: var(--color-black);
}

.wstx-ty-item-price {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-black);
    white-space: nowrap;
}

/* Totals */
.wstx-ty-totals {
    margin-top: 18px;
    padding: 16px 18px;
    background: var(--color-gray-1);
    border: 1px solid var(--color-gray-2);
}

.wstx-ty-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #444;
}
.wstx-ty-total-row strong {
    color: var(--color-black);
    font-weight: 600;
}

.wstx-ty-total-final {
    padding-top: 14px;
    margin-top: 8px;
    border-top: 1px solid var(--color-gray-2);
    font-size: 1.05rem;
}
.wstx-ty-total-final span {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    font-size: 0.75rem;
}
.wstx-ty-total-final strong {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-black);
}

/* ── ADDRESSES ───────────────────────────────────────────────────────── */
.wstx-ty-addresses {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 30px 0;
}

.wstx-ty-address {
    padding: 22px 22px;
    border: 1px solid var(--color-gray-2);
}

.wstx-ty-address-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin: 0 0 10px 0;
}

.wstx-ty-address address {
    font-style: normal;
    color: #444;
    line-height: 1.7;
    font-size: 0.88rem;
    margin: 0;
}

/* ── Gateway instructions ─────────────────────────────────────────────── */
.wstx-ty-instructions {
    margin: 30px 0;
    padding: 22px 24px;
    background: #fffaf2;
    border-left: 3px solid var(--color-accent);
    font-size: 0.92rem;
    color: #444;
    line-height: 1.65;
}
.wstx-ty-instructions p:last-child { margin-bottom: 0; }
.wstx-ty-instructions h2,
.wstx-ty-instructions h3 {
    font-family: var(--font-secondary);
    color: var(--color-black);
    font-size: 1.1rem;
    margin: 0 0 10px 0;
}

/* ── ACTIONS ─────────────────────────────────────────────────────────── */
.wstx-ty-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 36px 0 20px;
    flex-wrap: wrap;
}

.wstx-ty-btn-primary,
.wstx-ty-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    height: 50px;
    padding: 0 28px;
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    border: 1px solid var(--color-black);
    border-radius: 0;
}

.wstx-ty-btn-primary {
    background: var(--color-black);
    color: var(--color-white);
}
.wstx-ty-btn-primary:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
}

.wstx-ty-btn-outline {
    background: var(--color-white);
    color: var(--color-black);
}
.wstx-ty-btn-outline:hover {
    background: var(--color-black);
    color: var(--color-white);
}

/* ── Failed order state ──────────────────────────────────────────────── */
.wstx-ty-failed {
    text-align: center;
    padding: 40px 0;
}
.wstx-ty-failed-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: #d04545;
}
.wstx-ty-failed-icon svg {
    width: 100%;
    height: 100%;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .wstx-thankyou {
        padding-top: calc(var(--header-height) + 16px);
        padding-bottom: 50px;
    }
    body.has-announcement .wstx-thankyou {
        padding-top: calc(var(--header-height) + 32px + 16px);
    }
    .wstx-thankyou .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    .wstx-ty-hero {
        padding-bottom: 16px;
    }
    .wstx-ty-check {
        width: 52px;
        height: 52px;
        margin-bottom: 14px;
    }
    .wstx-ty-eyebrow {
        font-size: 0.62rem;
        margin-bottom: 8px;
    }
    .wstx-ty-title {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    .wstx-ty-sub {
        font-size: 0.88rem;
    }
    .wstx-ty-meta {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 22px 20px;
    }
    /* Steps become a tight list of rows on mobile */
    .wstx-ty-steps {
        grid-template-columns: 1fr;
        gap: 0;
        background: var(--color-white);
        border: 1px solid var(--color-gray-2);
        margin: 24px 0;
    }
    .wstx-ty-step {
        display: grid;
        grid-template-columns: 40px 1fr;
        column-gap: 14px;
        row-gap: 2px;
        padding: 16px 18px;
        text-align: left;
        border: none;
        border-bottom: 1px solid var(--color-gray-2);
        align-items: center;
    }
    .wstx-ty-step:last-child {
        border-bottom: none;
    }
    .wstx-ty-step-icon {
        grid-row: 1 / span 2;
        margin: 0;
        width: 40px;
        height: 40px;
        background: var(--color-gray-1);
        flex-shrink: 0;
    }
    .wstx-ty-step-icon svg {
        width: 18px;
        height: 18px;
    }
    .wstx-ty-step-title {
        font-size: 0.62rem;
        letter-spacing: 0.16em;
        margin: 0;
        line-height: 1.2;
        align-self: end;
    }
    .wstx-ty-step-text {
        font-size: 0.78rem;
        margin: 0;
        line-height: 1.4;
        color: var(--color-gray-3);
        align-self: start;
    }
    .wstx-ty-step-text strong {
        color: var(--color-black);
        font-weight: 600;
    }
    .wstx-ty-addresses {
        grid-template-columns: 1fr;
    }
    .wstx-ty-item {
        grid-template-columns: 56px 1fr;
        padding: 14px;
    }
    .wstx-ty-item-image {
        width: 56px;
        height: 56px;
    }
    .wstx-ty-item-price {
        grid-column: 1 / -1;
        text-align: right;
        margin-top: 4px;
    }
    .wstx-ty-actions {
        flex-direction: column;
    }
    .wstx-ty-btn-primary,
    .wstx-ty-btn-outline {
        width: 100%;
        min-width: 0;
    }
}
