/**
 * Issue #8315 — In-app report shortcode styling.
 *
 * Layout: sticky left TOC + scrollable right article. 4 sections, each
 * audience-targeted. Print-friendly (no TOC, no JS, sections become
 * page-breakable).
 */

/* ════════════════════════════════════════════════════════════════════════
 * Issue #8354 — admin section centering + 1-row alert rendering.
 * Mirrors the .orgs-ifs-report pattern below so both shortcodes
 * (#wcp-admin-orgs-ifs-wrap + #orgs-ifs-report-wrap) render with identical
 * horizontal alignment on Elementor Full Width pages.
 * ════════════════════════════════════════════════════════════════════════ */

/* Issue #8354 M34 — Highlight hidden columns in the colvis dropdown so the
 * user immediately sees which columns are off (WCP ID, Address 2 by default).
 * DataTables Buttons toggles `.active` class on visible columns; entries
 * WITHOUT `.active` are the hidden ones — those get a yellow accent + bold. */
.dt-button-collection .dt-button.buttons-columnVisibility:not(.active) {
    background: #fff8e1 !important;
    color: #c87000 !important;
    border-left: 4px solid #ff9800 !important;
    font-weight: 700 !important;
    padding-left: 8px !important;
}
.dt-button-collection .dt-button.buttons-columnVisibility:not(.active)::after {
    content: ' (hidden)';
    color: #b71c1c;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}
.dt-button-collection .dt-button.buttons-columnVisibility:not(.active):hover {
    background: #ffe0b2 !important;
}

.wcp-admin-orgs-ifs-section {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 0;
    box-sizing: border-box;
}

/* Force the .alert banner inside the admin section to render as a single
 * full-width block — overrides any inherited multi-column from Elementor /
 * theme .entry-content rules that produce the multi-column rendering. */
.wcp-admin-orgs-ifs-section .alert,
.wcp-admin-orgs-ifs-section .alert-info {
    display: block;
    width: 100%;
    max-width: 100%;
    column-count: 1 !important;
    box-sizing: border-box;
}

.orgs-ifs-report {
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #222;
    max-width: 1280px;
    margin: 0 auto;
}

.orgs-ifs-report-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.orgs-ifs-report-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    align-items: start;
}

/* Issue #8379 — grid items default to min-width:auto, which lets a wide table
   (e.g. #sec-community email lists) blow out the 1fr track and push the page
   beyond its container. Force min-width:0 so 1fr really constrains, and add
   overflow-x:auto as a fallback if a single cell is still too wide. */
.orgs-ifs-report-body {
    min-width: 0;
    overflow-x: auto;
}
.orgs-ifs-report-body table.orgs-ifs-tbl {
    table-layout: auto;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
}
.orgs-ifs-report-body table.orgs-ifs-tbl td,
.orgs-ifs-report-body table.orgs-ifs-tbl th {
    word-break: break-word;
    max-width: 320px;
}

/* Issue #8386 — the cascade (Bootstrap/Metronic) forces .alert into display:flex
   row, which makes inline content (strong/code/text) lay out as visual columns
   that push the container width. Force block-level stacking so each sentence
   reads top-to-bottom at full width. */
.orgs-ifs-report-body .alert,
.cw-email-context-card.alert {
    display: block;
}
.orgs-ifs-report-body .alert > * {
    display: block;
    margin-bottom: 6px;
}
.orgs-ifs-report-body .alert > *:last-child { margin-bottom: 0; }
.orgs-ifs-report-body .alert code,
.cw-email-context-card code {
    display: inline;
    overflow-wrap: anywhere;
}
/* Modal context card .ctx-row stays as a flex row (icon+label+value side-by-side)
   but wraps when narrow + value gets full-width fallback. */
.cw-email-context-card .ctx-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 4px;
}
.cw-email-context-card .ctx-row .ctx-value {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ── Sticky TOC ── */
.orgs-ifs-toc {
    position: sticky;
    top: 90px;
    background: #f0f4f8;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    align-self: start;
}

.orgs-ifs-toc strong {
    display: block;
    margin-bottom: 8px;
    color: #0073aa;
    font-size: 13px;
}

.orgs-ifs-toc ol {
    list-style: none;
    padding: 0;
    margin: 0 0 6px 0;
}

.orgs-ifs-toc li {
    margin-bottom: 4px;
}

.orgs-ifs-toc a {
    display: block;
    padding: 6px 8px;
    color: #444;
    text-decoration: none;
    border-radius: 4px;
    border-left: 3px solid transparent;
    transition: background 120ms, border-color 120ms, color 120ms;
}

.orgs-ifs-toc a:hover {
    background: rgba(0, 115, 170, 0.08);
    color: #0073aa;
}

.orgs-ifs-toc a.active {
    background: #cfe7ff;
    border-left-color: #0073aa;
    color: #0073aa;
    font-weight: 600;
}

.orgs-ifs-toc hr {
    border: 0;
    border-top: 1px solid #d0d7de;
}

/* ── Article body ── */
.orgs-ifs-report-body section {
    padding-bottom: 48px;
    margin-bottom: 32px;
    border-bottom: 1px dashed #d0d7de;
    /* scroll-margin gives anchored-link clicks a comfortable offset under
       the WP/Termont fixed header */
    scroll-margin-top: 90px;
}

.orgs-ifs-report-body section:last-child {
    border-bottom: 0;
}

.orgs-ifs-report-body h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 22px;
    font-weight: 700;
}

.orgs-ifs-report-body h4 {
    margin-top: 28px;
    margin-bottom: 12px;
    font-size: 17px;
    color: #444;
    font-weight: 600;
}

.orgs-ifs-report-body h5 {
    margin-top: 18px;
    margin-bottom: 8px;
    font-size: 15px;
    color: #0073aa;
}

.orgs-ifs-report-body code {
    background: #f5f5f5;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.92em;
    color: #c62828;
}

/* ── KPI banner ── */
.orgs-ifs-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 14px 0 24px 0;
}

.orgs-ifs-kpi {
    flex: 1;
    min-width: 160px;
    padding: 14px 16px;
    background: #fafbfc;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
}

.orgs-ifs-kpi .kpi-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 6px;
}

.orgs-ifs-kpi .kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: #222;
}

.orgs-ifs-kpi .kpi-value small {
    font-weight: 400;
    color: #999;
    font-size: 14px;
    margin-left: 4px;
}

/* ── Tables ── */
.orgs-ifs-tbl {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 24px 0;
    font-size: 13px;
}

.orgs-ifs-tbl th,
.orgs-ifs-tbl td {
    border: 1px solid #d0d7de;
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.orgs-ifs-tbl thead th {
    background: #f0f4f8;
    color: #0073aa;
    font-weight: 600;
}

.orgs-ifs-tbl tbody tr:nth-child(even) {
    background: #fafbfc;
}

/* ── Inline badges (use cases) ── */
.badge-green,
.badge-red,
.badge-neutral {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-green   { background: #e8f5e9; color: #2e7d32; }
.badge-red     { background: #fbeaea; color: #c62828; }
.badge-neutral { background: #f0f4f8; color: #666;    }

/* ── Figures ── */
.orgs-ifs-report-body figure {
    margin: 18px 0;
    padding: 0;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    overflow: hidden;
    background: #fafbfc;
}

.orgs-ifs-report-body figure img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

.orgs-ifs-report-body figcaption {
    padding: 10px 14px;
    font-size: 13px;
    color: #555;
    background: #fafbfc;
    border-top: 1px solid #d0d7de;
}

/* ── Collapsible email ── */
details.orgs-ifs-collapse {
    margin: 14px 0;
    background: #fafbfc;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 12px 16px;
}

details.orgs-ifs-collapse[open] {
    background: #fff;
}

details.orgs-ifs-collapse summary {
    cursor: pointer;
    color: #0073aa;
    user-select: none;
}

.orgs-ifs-email {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #d0d7de;
    font-size: 13px;
}

.orgs-ifs-email h5 {
    color: #0073aa;
    border-bottom: 1px solid #cfe7ff;
    padding-bottom: 4px;
}

/* ── Mermaid containers (rendered after JS init) ── */
.orgs-ifs-report .mermaid {
    background: #fafbfc;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    padding: 16px;
    margin: 14px 0 24px 0;
    overflow-x: auto;
    text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────
   Issue #8381 — community-mgmt modal: clickable email title link +
   Bootstrap-styled modal with context card + copy/paste fields + toast
   ───────────────────────────────────────────────────────────────────── */

.cw-email-title-link {
    display: block;
    color: #0073aa;
    text-decoration: none;
    cursor: pointer;
    border-bottom: 1px dotted transparent;
    padding: 1px 0;
}
.cw-email-title-link:hover {
    border-bottom-color: #0073aa;
    background: rgba(0,115,170,0.04);
    text-decoration: none;
}
.cw-email-title-link:focus { outline: 2px solid #0073aa; outline-offset: 2px; }

.cw-modal-overlay {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 60px 20px 20px;
    overflow-y: auto;
}
.cw-modal-dialog {
    background: #fff; border-radius: 8px; max-width: 780px; width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}
.cw-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid #eee;
}
.cw-modal-title { margin: 0; font-size: 16px; color: #0073aa; }
.cw-modal-close {
    border: 0; background: transparent; font-size: 22px; cursor: pointer;
    color: #666; padding: 0 6px; line-height: 1;
}
.cw-modal-close:hover { color: #c62828; }
.cw-modal-body { padding: 18px 20px 20px; position: relative; }

.cw-email-context-card {
    background: #e7f4fb; border-left: 4px solid #0073aa; border-radius: 4px;
    padding: 14px 18px; margin-bottom: 18px; font-size: 13px; color: #1e3a5f;
}
.cw-email-context-card > strong { display: block; margin-bottom: 8px; }
.cw-email-context-card .ctx-row {
    display: flex; align-items: flex-start; margin-bottom: 4px; gap: 8px;
}
.cw-email-context-card .ctx-icon { width: 22px; flex-shrink: 0; }
.cw-email-context-card .ctx-label { width: 90px; flex-shrink: 0; font-weight: 600; }
.cw-email-context-card .ctx-value { flex: 1; }

.cw-modal-field-group { margin-bottom: 14px; }
.cw-modal-field-group label {
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600; font-size: 13px; margin-bottom: 4px;
}
.cw-modal-field-group input[type="text"],
.cw-modal-field-group textarea {
    width: 100%; box-sizing: border-box;
    padding: 8px 10px; font-family: monospace; font-size: 12px;
    border: 1px solid #ccc; border-radius: 4px; background: #fafafa;
    color: #222;
}
.cw-modal-field-group textarea { line-height: 1.45; resize: vertical; }
.cw-modal-field-group input[readonly]:focus,
.cw-modal-field-group textarea[readonly]:focus { outline: 2px solid #0073aa; }

.cw-copy-btn {
    border: 1px solid #0073aa; background: #fff; color: #0073aa;
    padding: 3px 10px; font-size: 11px; border-radius: 4px; cursor: pointer;
}
.cw-copy-btn:hover { background: #0073aa; color: #fff; }

.cw-toggle-en {
    border: 0; background: transparent; color: #0073aa; cursor: pointer;
    padding: 6px 0; font-size: 13px; margin: 4px 0 8px;
}
.cw-toggle-en:hover { text-decoration: underline; }

.cw-modal-toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: #2e7d32; color: #fff; padding: 10px 18px; border-radius: 4px;
    font-size: 13px; font-weight: 600;
    opacity: 0; pointer-events: none; transition: opacity 180ms;
    z-index: 1000000;
}
.cw-modal-toast.show { opacity: 1; }

body.cw-modal-open { overflow: hidden; }

.cw-golive-gantt { width: 100%; }
.cw-golive-gantt .mermaid { width: 100%; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .orgs-ifs-report-grid {
        grid-template-columns: 1fr;
    }

    .orgs-ifs-toc {
        position: relative;
        top: auto;
        margin-bottom: 18px;
    }

    .orgs-ifs-kpi {
        min-width: 140px;
    }
}

/* ── Print-friendly ── */
@media print {
    .orgs-ifs-toc { display: none; }
    .orgs-ifs-report-grid { grid-template-columns: 1fr; }
    .orgs-ifs-report-body section { page-break-after: always; border-bottom: 0; }
    .orgs-ifs-report a { color: #000; text-decoration: underline; }
    .orgs-ifs-report .mermaid { page-break-inside: avoid; }
    figure { page-break-inside: avoid; }
}

/* Issue #8391 — DataTables pagination has visible double borders because the
   cascade applies BOTH .paginate_button (DT default border on <li>) AND
   .page-link (Bootstrap 5 border on <a>). Drop the inner .page-link border
   and keep the outer .page-item one only. Scoped to #wcp-admin-orgs-ifs-dt
   so other DTs in the plugin are unaffected. */
#wcp-admin-orgs-ifs-dt_wrapper .dataTables_paginate .page-item .page-link,
#wcp-admin-orgs-ifs-dt_wrapper .dataTables_paginate .paginate_button .page-link {
    border: 0;
    background: transparent;
}
#wcp-admin-orgs-ifs-dt_wrapper .dataTables_paginate .page-item.active .page-link {
    background: #0073aa;
    color: #fff;
}
#wcp-admin-orgs-ifs-dt_wrapper .dataTables_paginate .page-item:not(.active) .page-link:hover {
    background: rgba(0, 115, 170, 0.08);
    color: #0073aa;
}

/* ─────────────────────────────────────────────────────────────────────
   Issue #8402 F14 + F17 + D24 — modal stacking + dms-badge declarations
   MOVED to assets/css/dms-badges.css (loaded globally on every page that
   shows .dms-badge or opens a Bootstrap 5 modal). Keeping them here was
   dead code on /admin-organizations/, /admin-users/, etc. — the file is
   only enqueued on /admin-organizations-ifs-report/. Single source of
   truth = dms-badges.css. (2026-04-27)
   ───────────────────────────────────────────────────────────────────── */
