/* Inweld Certs — front-end styles */

.iwc-app { margin: 1.5rem 0; }
.iwc-title { margin-bottom: 1rem; }

.iwc-app-head { display: flex; align-items: baseline; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.iwc-app-head .iwc-title { margin: 0; }
.iwc-count { color: #666; font-size: 1rem; white-space: nowrap; }

.iwc-toolbar { margin-left: auto; }
.iwc-perpage-label { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: #444; }
.iwc-per-page { padding: .35rem .5rem; border: 1px solid #c3c4c7; border-radius: 4px; background: #fff; }

.iwc-results { position: relative; min-height: 80px; }
.iwc-results.iwc-loading { opacity: .5; pointer-events: none; }

.iwc-table { width: 100%; border-collapse: collapse; }
.iwc-table th, .iwc-table td {
    text-align: left;
    padding: .6rem .75rem;
    border-bottom: 1px solid #e2e4e7;
    font-size: .92rem;
}
.iwc-table tbody tr:nth-child(even) { background: #fafafa; }

/* Sort header row */
.iwc-sort-row th { background: #2b2b2b; padding: 0; }
.iwc-sort {
    display: block;
    width: 100%;
    text-align: left;
    padding: .6rem .75rem;
    background: none;
    border: 0;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
}
.iwc-sort:hover { background: #3c3c3c; }
/* "Actions" header — match the sortable header cells. */
.iwc-sort-row th.iwc-actions-col {
    color: #fff; font-weight: 600; font-size: .9rem; padding: .6rem .75rem; text-align: left;
}

/* Per-column filter row */
.iwc-filter-row th { background: #f0f1f2; padding: .4rem .5rem; }
.iwc-col-search, .iwc-col-filter {
    width: 100%;
    padding: .35rem .5rem;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    font-size: .85rem;
    box-sizing: border-box;
}
.iwc-view {
    display: inline-block;
    padding: .35rem .8rem;
    background: #E82012;
    color: #fff !important;
    border-radius: 4px;
    text-decoration: none !important;
    font-size: .85rem;
    transition: background-color .15s ease;
}
.iwc-view:hover { background: #3a3a3a; }

.iwc-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: 1.25rem;
    justify-content: center;
}
.iwc-page-btn {
    min-width: 40px;
    padding: .45rem .65rem;
    border: 1px solid #d0d2d5;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: .9rem;
    color: #2b2b2b;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.iwc-page-btn:hover:not(:disabled):not(.is-active) { background: #3a3a3a; border-color: #3a3a3a; color: #fff; }
.iwc-page-btn.is-active { background: #E82012; border-color: #E82012; color: #fff; cursor: default; }
.iwc-page-btn:disabled { opacity: .4; cursor: default; }
.iwc-page-ellipsis { padding: 0 .25rem; color: #888; }
.iwc-empty { padding: 1.5rem; background: #f6f7f8; border-radius: 6px; }

/* ---- Single cert: Certified Material Test Report ---- */
.iwc-cmtr {
    --iwc-red: #e1241b;
    max-width: 960px;
    margin: 0 auto;
    color: #1f1f1f;
}
.iwc-cmtr-head { position: relative; margin-bottom: 1.5rem; }
.iwc-cmtr-logo-wrap { display: none; } /* letterhead: print only */
.iwc-cmtr-logo { box-shadow: none !important; filter: none !important; border: 0 !important; background: transparent !important; }
.iwc-cmtr-title { margin: 0; font-size: 1.6rem; font-weight: 800; letter-spacing: -.01em; }
.iwc-cmtr-title::after {
    content: ""; display: block; width: 64px; height: 4px;
    margin-top: .6rem; background: var(--iwc-red); border-radius: 2px;
}
.iwc-cmtr-sub { margin: .75rem 0 0; color: #555; font-size: .95rem; }

.iwc-cmtr-section {
    border: 1px solid #e2e4e7; border-radius: 10px; overflow: hidden;
    margin-bottom: 1.25rem; background: #fff;
}
.iwc-cmtr-legend {
    background: #f7f8f9; border-bottom: 1px solid #e2e4e7; padding: .7rem 1.1rem;
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--iwc-red);
}
.iwc-cmtr-body { padding: 1.1rem 1.25rem; }
.iwc-cmtr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1.75rem; align-items: start; }

.iwc-cmtr-field { display: flex; flex-direction: column; gap: .3rem; margin: 0; }
.iwc-cap { font-size: .82rem; font-weight: 600; color: #333; line-height: 1.2; }
.iwc-cmtr-field input {
    margin: 0 !important; padding: .5rem .6rem; border: 1px solid #c3c4c7; border-radius: 6px;
    font-weight: 400; font-size: .95rem; background: #fff; line-height: 1.3;
}
.iwc-cmtr-field input:focus {
    outline: none; border-color: var(--iwc-red);
    box-shadow: 0 0 0 3px rgba(225,36,27,.12);
}
.iwc-req { color: var(--iwc-red); margin-left: 2px; }

.iwc-cmtr-readcol p {
    display: flex; justify-content: space-between; gap: 1rem;
    margin: 0 0 .55rem; padding-bottom: .55rem;
    border-bottom: 1px dashed #e6e8ea; font-size: .92rem;
}
.iwc-cmtr-readcol p span { color: #666; }
.iwc-cmtr-readcol p strong { text-align: right; }
.iwc-cmtr-readcol .iwc-cmtr-field { margin-top: .6rem; }

.iwc-cmtr-chem {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: .55rem .9rem;
}
.iwc-cmtr-el {
    display: flex; align-items: baseline; gap: .4rem; padding: .35rem .55rem;
    background: #f7f8f9; border: 1px solid #eceef0; border-radius: 6px; font-size: .9rem;
}
.iwc-cmtr-el .el { font-weight: 700; min-width: 1.8em; }
.iwc-cmtr-el .val { color: #333; }
.iwc-cmtr-other { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e2e4e7; font-size: .92rem; }
.iwc-cmtr-other span { color: #666; }
.iwc-cmtr-phys { margin-top: .75rem; display: grid; gap: .35rem; }
.iwc-cmtr-phys p { margin: 0; font-size: .92rem; }
.iwc-cmtr-phys p span { color: #666; min-width: 160px; display: inline-block; }

.iwc-cmtr-cert { font-style: italic; color: #666; font-size: .85rem; margin: 0 0 1.25rem; }

.iwc-cmtr-sign { margin: 0 0 1.5rem; }
.iwc-cmtr-sign-img {
    display: block; height: 64px; width: auto; margin-bottom: .25rem;
    box-shadow: none !important; filter: none !important; border: 0 !important; background: transparent !important; padding: 0 !important;
}
.iwc-cmtr-sign-label {
    display: block; border-top: 1px solid #c3c4c7; padding-top: .35rem;
    width: 240px; color: #555; font-size: .85rem;
}

/* Hide theme post title, meta/date, and prev/next navigation on cert pages. */
.single-inweld_cert .entry-title,
.single-inweld_cert .ast-single-post .entry-title,
.single-inweld_cert .entry-header,
.single-inweld_cert .entry-meta,
.single-inweld_cert .posted-on,
.single-inweld_cert .ast-blog-meta-container,
.single-inweld_cert .post-navigation,
.single-inweld_cert nav.post-navigation,
.single-inweld_cert .ast-single-related-posts-container { display: none !important; }

/* Pull the certificate up — the hidden title/header left a large top gap. */
.single-inweld_cert .ast-article-single,
.single-inweld_cert .ast-article-post { padding-top: 1.5rem !important; }
.single-inweld_cert .entry-content { margin-top: 0 !important; }

/* Hide the theme page title on any page containing the [inweld_certs] table. */
.iwc-cert-index .entry-title,
.iwc-cert-index .ast-page-title,
.iwc-cert-index .page-title,
.iwc-cert-index .ast-archive-description { display: none !important; }

/* Halve the theme's 60px top margin on #primary for cert pages. */
.iwc-cert-index #primary,
.iwc-cert-index .content-area.primary,
.single-inweld_cert #primary,
.single-inweld_cert .content-area.primary { margin-top: 30px !important; }

.iwc-cmtr-actions { display: flex; gap: .75rem; }
.iwc-btn {
    padding: .7rem 1.5rem; border-radius: 6px; font-size: .95rem;
    font-weight: 600; cursor: pointer; border: 1px solid transparent;
}
.iwc-btn-email { background: var(--iwc-red); color: #fff; }
.iwc-btn-email:hover { background: #b71c12; color: #fff !important; }
.iwc-btn-print { background: #fff; color: #333; border-color: #c3c4c7; }
.iwc-btn-print:hover { background: #3a3a3a; color: #fff !important; border-color: #3a3a3a; }

.iwc-notice { padding: 1rem 1.25rem; border-radius: 8px; margin-bottom: 1.5rem; max-width: 960px; margin-left: auto; margin-right: auto; }
.iwc-notice.iwc-success { background: #e6f4ea; border: 1px solid #0a6c3c; }
.iwc-notice.iwc-error { background: #fce8e8; border: 1px solid #e1241b; }

@media (max-width: 640px) {
    .iwc-cmtr-grid { grid-template-columns: 1fr; }
}

/* ---- Print: clean standalone certificate, site chrome hidden ---- */
@media print {
    @page { margin: 0.5in; }

    /* Show only the certificate. */
    body * { visibility: hidden !important; }
    .iwc-cmtr, .iwc-cmtr * { visibility: visible !important; }
    .iwc-cmtr {
        position: absolute; left: 0; top: 0; width: 100%;
        max-width: none; margin: 0; padding: 24px 0 0; color: #000;
        font-size: 10pt;
    }

    /* Drop interactive / non-document bits. */
    .iwc-cmtr-actions, .iwc-cmtr-sub, .iwc-notice { display: none !important; }

    /* Logo letterhead, top right, with breathing room. */
    .iwc-cmtr-logo-wrap { display: block !important; position: absolute; top: 4px; right: 8px; }
    .iwc-cmtr-logo { max-height: 46px; width: auto; box-shadow: none !important; filter: none !important; }

    .iwc-cmtr-head { margin-bottom: 24px; padding: 6px 240px 0 0; }
    .iwc-cmtr-title { font-size: 17pt; margin-top: 18px; }
    .iwc-cmtr-title::after { display: none; }

    /* Flatten cards into clean ruled sections. */
    .iwc-cmtr-section {
        border: 1px solid #999; border-radius: 0; margin-bottom: 6px;
        box-shadow: none; break-inside: avoid; page-break-inside: avoid;
    }
    .iwc-cmtr-legend {
        background: transparent !important; color: #000; border-bottom: 1px solid #999;
        padding: 3px 8px; font-size: 8.5pt;
    }
    .iwc-cmtr-body { padding: 6px 10px; }

    /* Customer / product inputs collapse to compact inline "Label: value"
       rows with no underline; blank when empty. !important so the theme's
       form styles can't reintroduce the stacked/underlined layout. */
    .iwc-cmtr-grid { gap: 4px 56px !important; align-items: baseline !important; }
    .iwc-cmtr-field {
        display: flex !important; flex-direction: row !important;
        align-items: baseline !important; gap: 4px !important; margin: 0 !important;
    }
    .iwc-cap { font-size: 9pt; white-space: nowrap; }
    .iwc-cap::after { content: ":"; }
    .iwc-cmtr-field input {
        flex: 1 1 auto !important; min-width: 0 !important;
        border: 0 !important; border-radius: 0 !important; padding: 0 !important;
        margin: 0 !important; box-shadow: none !important; background: transparent !important;
        font-size: 9pt !important; height: auto !important;
    }

    /* Chemistry: 3 spaced columns, staggered (checkerboard) row tint. */
    .iwc-cmtr-chem { grid-template-columns: repeat(3, 1fr); gap: 1px 26px; }
    .iwc-cmtr-el {
        border: 0; padding: 1.5px 8px; background: transparent;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    /* Outer columns tint odd rows; middle column tints even rows. */
    .iwc-cmtr-el:nth-child(6n+1),
    .iwc-cmtr-el:nth-child(6n+3),
    .iwc-cmtr-el:nth-child(6n+5) { background: #f1f2f4; }

    /* Product info + Other/physical properties: tightened. */
    .iwc-cmtr-readcol p { border-bottom: 0; padding-bottom: 0; margin-bottom: 1px; }
    .iwc-cmtr-other { margin-top: 6px !important; padding-top: 6px !important; }
    .iwc-cmtr-phys { margin-top: 3px !important; gap: 0 !important; }
    .iwc-cmtr-phys p { margin: 0 !important; line-height: 1.35; }

    .iwc-cmtr-cert { color: #000; margin: 6px 0; }
    .iwc-cmtr-sign { margin: 6px 0 0 !important; }
    .iwc-cmtr-sign-img { height: 42px; }
    .iwc-cmtr-sign-label { padding-top: 2px; }
}
