/* Styles for the report guide and shared in-app guidance. */

.first-profit-cogs-checklist,
.first-profit-cogs-checklist-reopen {
    position: fixed;
    z-index: 20;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
}

.first-profit-cogs-checklist {
    display: flex;
    flex-direction: column;
    width: min(900px, calc(100vw - 32px));
    max-height: calc(100vh - 120px);
    padding: 12px;
    border: 1px solid #E5E9E4;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(23, 26, 24, 0.16);
}

/* Compact sizing for one or two task cards so they stay balanced instead of
 * stretching across the full desktop dialog width. Explicit column counts keep
 * the cards side-by-side even when a long source label would otherwise let the
 * auto-fit grid collapse to a single stretched column. */
.first-profit-cogs-checklist--count-1 {
    width: min(360px, calc(100vw - 32px));
}

.first-profit-cogs-checklist--count-1 .first-profit-cogs-checklist__tasks {
    grid-template-columns: 1fr;
}

.first-profit-cogs-checklist--count-2 {
    width: min(620px, calc(100vw - 32px));
}

.first-profit-cogs-checklist--count-2 .first-profit-cogs-checklist__tasks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.first-profit-cogs-checklist__header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 0 2px 10px;
}

.first-profit-cogs-checklist__header strong {
    color: #171A18;
}

.first-profit-cogs-checklist__dismiss {
    border: 0;
    background: transparent;
    color: #7B837D;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.first-profit-cogs-checklist__tasks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
}

.first-profit-cogs-checklist__task {
    position: relative;
    display: grid;
    grid-template-rows: minmax(22px, auto) auto;
    align-content: space-between;
    gap: 8px;
    min-width: 0;
    min-height: 94px;
    padding: 10px;
    border: 1px solid #E5E9E4;
    border-radius: 9px;
    background: #fff;
}

.first-profit-cogs-checklist__task-title {
    display: block;
    margin: 0;
    min-width: 0;
    /* Keep the title clear of the top-right checkbox without narrowing the CTA. */
    padding-right: 34px;
    color: #171A18;
    font-size: 0.9rem;
    line-height: 1.35;
    cursor: pointer;
}

.first-profit-cogs-checklist__task-title span {
    overflow-wrap: normal;
    word-break: normal;
}

.first-profit-cogs-checklist__task-actions {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
}

/* The checkbox sits in the top-right corner of each task card. */
.first-profit-cogs-checklist__task-check {
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
    cursor: pointer;
}

.first-profit-cogs-checklist__setup {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}

.first-profit-cogs-checklist__setup {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    padding: 8px 10px;
    border-radius: 7px;
    background: #171A18;
    text-align: center;
}

.first-profit-cogs-checklist__setup:hover,
.first-profit-cogs-checklist__setup:focus {
    color: #fff;
    background: #171A18;
    text-decoration: none;
}

.first-profit-cogs-checklist-reopen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: min(900px, calc(100vw - 32px));
    min-height: 58px;
    border: 1px solid #E5E9E4;
    border-radius: 12px;
    background: #fff;
    color: #171A18;
    padding: 10px 12px 10px 16px;
    box-shadow: 0 14px 34px rgba(23, 26, 24, 0.16);
    cursor: pointer;
    text-align: left;
}

.first-profit-cogs-checklist-reopen__copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.first-profit-cogs-checklist-reopen__copy strong {
    color: #171A18;
    font-size: 0.9rem;
}

.first-profit-cogs-checklist-reopen__copy span {
    color: #7B837D;
    font-size: 0.82rem;
    line-height: 1.25;
}

.first-profit-cogs-checklist-reopen__action {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    border-radius: 7px;
    background: #171A18;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    padding: 9px 11px;
}

.first-profit-cogs-checklist-reopen:hover .first-profit-cogs-checklist-reopen__action,
.first-profit-cogs-checklist-reopen:focus .first-profit-cogs-checklist-reopen__action {
    background: #171A18;
}

.first-profit-cogs-checklist-reopen:focus-visible {
    outline: 3px solid rgba(23, 26, 24, 0.3);
    outline-offset: 3px;
}

@media (max-width: 640px) {
    .first-profit-cogs-checklist,
    .first-profit-cogs-checklist-reopen {
        width: calc(100vw - 24px);
        bottom: 64px;
    }

    .first-profit-cogs-checklist {
        padding: 14px;
    }

    .first-profit-cogs-checklist__tasks {
        grid-template-columns: 1fr;
    }

    .first-profit-cogs-checklist--count-2 .first-profit-cogs-checklist__tasks {
        grid-template-columns: 1fr;
    }

    .first-profit-cogs-checklist-reopen {
        align-items: flex-start;
        padding: 12px;
    }
}

@media (max-width: 560px) {
    .first-profit-cogs-checklist__tasks {
        grid-template-columns: 1fr;
    }
}

/* Dashboard metric help: an anchored, accessible popover instead of a full-card hover overlay. */
.dashboard-tooltip {
    position: absolute;
    z-index: 10;
    top: 8px;
    right: 10px;
}

/* Card hover transforms create stacking contexts. Raise the active card so a
 * downward-facing tooltip remains above the dashboard row beneath it. */
.card.dashboard-tooltip-card--active {
    position: relative;
    z-index: 20;
}

.dashboard-tooltip--inline {
    position: relative;
    top: auto;
    right: auto;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
}

.dashboard-tooltip__trigger {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ABB1AC;
    cursor: help;
    font-size: 13px;
    line-height: 20px;
    transition: color 0.15s ease, background 0.15s ease;
}

.dashboard-tooltip__trigger:hover,
.dashboard-tooltip__trigger:focus {
    background: rgba(23, 26, 24, 0.06);
    color: #171A18;
    outline: 0;
}

.dashboard-tooltip__trigger:focus-visible {
    box-shadow: 0 0 0 3px rgba(23, 26, 24, 0.2);
}

.dashboard-tooltip__trigger--compact {
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
}

.card .dashboard-tooltip .card-hover-text {
    position: absolute;
    top: auto;
    bottom: calc(100% + 8px);
    right: 0;
    left: auto;
    width: 250px;
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 7px 10px;
    border: 1px solid #171A18;
    border-radius: 10px;
    background: #171A18;
    box-shadow: 0 10px 24px rgba(23, 26, 24, 0.25);
    color: #fff;
    font-family: Nunito, Arial, sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    text-align: left;
    transform: translate(var(--dashboard-tooltip-offset-x, 0px), -4px);
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
    visibility: hidden;
}

.dashboard-tooltip .card-hover-text::before {
    position: absolute;
    top: auto;
    bottom: -6px;
    right: calc(8px + var(--dashboard-tooltip-offset-x, 0px));
    width: 10px;
    height: 10px;
    border-right: 1px solid #171A18;
    border-bottom: 1px solid #171A18;
    background: #171A18;
    content: '';
    transform: rotate(45deg);
}

.card .dashboard-tooltip:hover .card-hover-text,
.card .dashboard-tooltip:focus-within .card-hover-text,
.card .dashboard-tooltip.dashboard-tooltip--open .card-hover-text {
    opacity: 1;
    pointer-events: auto;
    transform: translate(var(--dashboard-tooltip-offset-x, 0px), 0);
    visibility: visible;
}

.card .dashboard-tooltip.dashboard-tooltip--below .card-hover-text {
    top: calc(100% + 8px);
    bottom: auto;
}

.dashboard-tooltip.dashboard-tooltip--below .card-hover-text::before {
    top: -6px;
    bottom: auto;
    border-top: 1px solid #171A18;
    border-right: 0;
    border-bottom: 0;
    border-left: 1px solid #171A18;
}

#loading {
    z-index: 1100;
}

.dashboard-chart-card > .card-header {
    position: relative;
    background: transparent;
    border-bottom: 0;
}

/* Graph cards anchor their help icon to the top-right of the card header,
 * matching the placement and size of the info icon on regular metric cards
 * rather than sitting inline next to the chart title. */
.dashboard-tooltip--chart-action {
    top: 12px;
    right: 16px;
}

@media (max-width: 480px) {
    .card .dashboard-tooltip .card-hover-text {
        width: min(250px, calc(100vw - 28px));
    }
}

/* Country report totals have ten metrics, arranged as two balanced desktop rows. */
@media (min-width: 992px) {
    #totals-cards-row1 .country-order-totals-card {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

/* ---- Report Guide Page ---- */
/* Layout-only rules. Visual card styling (border, radius, shadow, header
 * background) is intentionally deferred to the global app card classes
 * (.card.card-dashboard / .card-header / .card-body.dashboard-card) so this
 * page matches every other report page. */
#report-guide .report-guide-title-card {
    margin-bottom: 0;
}

#report-guide .report-guide-grid {
    margin-top: 16px;
}

#report-guide .report-guide-grid .col-xl-4,
#report-guide .report-guide-grid .col-lg-6,
#report-guide .report-guide-grid .col-md-6 {
    margin-bottom: 16px;
}

#report-guide .report-guide-card {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#report-guide .report-guide-card:hover {
    border-color: #62E99A;
    box-shadow: 0 2px 8px rgba(23, 26, 24, 0.08);
}

/* Focus ring on the card itself (overlay link is a descendant). */
#report-guide .report-guide-card:focus-within {
    border-color: #171A18;
    box-shadow: 0 0 0 2px rgba(23, 26, 24, 0.2);
}

/* Invisible overlay link that makes the whole card clickable. */
#report-guide .report-guide-card__overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}

#report-guide .report-guide-card__overlay:focus {
    outline: none;
}

#report-guide .report-guide-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}

#report-guide .report-guide-card__header-copy {
    flex: 1 1 auto;
    min-width: 0;
}

#report-guide .report-guide-card__eyebrow {
    display: block;
    color: #7B837D;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
    margin-bottom: 5px;
    text-transform: uppercase;
}

#report-guide .report-guide-card__goal {
    color: #171A18;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0;
}

#report-guide .report-guide-card__icon {
    color: #99A19C;
    flex: 0 0 auto;
    font-size: 1rem;
    margin-top: 2px;
}

#report-guide .report-guide-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    text-align: left;
}

#report-guide .report-guide-card__description {
    color: #7B837D;
    font-size: 0.88rem;
    line-height: 1.45;
    margin: 0 0 14px;
}

/* Compact signal chips — at-a-glance keywords, not paragraphs. */
#report-guide .report-guide-card__signals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

#report-guide .report-guide-signal {
    border: 1px solid #E5E9E4;
    border-radius: 999px;
    color: #171A18;
    background: #F7FAF7;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
    white-space: nowrap;
}

#report-guide .report-guide-actions {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #E5E9E4;
}

#report-guide .report-guide-open-text {
    color: #171A18;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

#report-guide .report-guide-open-arrow {
    font-size: 0.78rem;
    transition: transform 0.15s ease;
}

#report-guide .report-guide-card:hover .report-guide-open-arrow {
    transform: translateX(3px);
}

@media (max-width: 576px) {
    #report-guide .report-guide-card__goal {
        font-size: 0.95rem;
    }
}
