/* alignvu UI v2.1: the Monitor dialogs (application/views/align_to/landingpage/modals.php), split from css/v21_monitor.css.
   Loaded after it (application/common/head.php). */

/* ---------- Datafeeds dialogs: Changes over time and Counts by reference code (landingpage/modals.php,
   js/modules/monitor/landing/datafeed_dialogs.js). alignvu UI v2.1 Dialog: a head with title, feed name and close
   button, then the controls, then a scrolling body. */
:is(#align-to-landing-changes-graph-modal, #align-to-landing-ref-counts-modal) > .modal-content.app-dialog {
    width: min(1000px, calc(100vw - 48px));
    min-width: 0;
    background: var(--surface);
    max-width: none;
    max-height: calc(100vh - 48px);
    padding: 0;
    gap: 0;
    overflow: hidden;
}

#align-to-landing-ref-counts-modal > .modal-content.app-dialog {
    width: min(880px, calc(100vw - 48px));
    min-width: 0;
}

.app-dialog__head.app-dialog__head--bar {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--row-rule);
}

.app-dialog__head--bar h2.app-dialog__title {
    margin: 0;
    padding: 0;
    font: 700 17px/24px var(--font-display);
    color: var(--heading-ink);
    text-align: left;
}

.app-dialog__sub {
    margin: 2px 0 0;
    font: 500 13px/18px var(--font-display);
    color: var(--body-ink);
}

.app-dialog__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 14px 20px 0;
}

:is(#align-to-landing-changes-graph-modal, #align-to-landing-ref-counts-modal) .modal-content.app-dialog .modal-body {
    flex: 1 1 auto;
    width: auto;
    margin: 0;
    padding: 16px 20px 20px;
    overflow: auto;
}

/* Week / Month / Year: v2.1 segmented control (.active is set by drilldown.js) */
.app-dialog .tabs.av-seg .tab {
    min-width: 0;
    margin: 0;
    padding: 5px 14px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--body-ink);
    font: 500 13px/18px var(--font-display);
    text-decoration: none;
}

.app-dialog .tabs.av-seg .tab.active {
    background: var(--surface);
    color: var(--heading-ink);
    font-weight: 600;
    box-shadow: 0 0 0 1px var(--border);
}

/* Changes / Jurisdictions / Ref codes: v2.1 tabs */
.app-dialog .tabs.av-tabs {
    gap: 24px;
}

.app-dialog .tabs.av-tabs .tab.av-tab {
    margin: 0;
    padding: 6px 0;
    font-size: 13px;
    text-decoration: none;
}

/* the chart and, under each point, the interval's changes as v2.1 status pills (they open the changed records) */
#align-to-landing-changes-graph-modal .align-to-landing-changes-graph-container canvas {
    max-height: 360px;
}

#align-to-landing-changes-graph-modal .changes {
    margin-top: 8px;
}

#align-to-landing-changes-graph-modal .changes .change-block {
    grid-template-rows: repeat(4, 22px);
    gap: 4px;
    justify-items: center;
}

#align-to-landing-changes-graph-modal .change-block > a:not(.empty) {
    width: auto;
    min-width: 52px;
    height: 22px;
    gap: 6px;
    padding: 0 8px;
    border: 1px solid var(--muted);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--heading-ink);
    font: 500 12px/16px var(--font-display);
    text-decoration: none;
}

#align-to-landing-changes-graph-modal .change-block > a[onclick]:hover {
    background: var(--fill);
}

#align-to-landing-changes-graph-modal .change-block > a:not(.empty, .datemaintenace-icon)::before {
    content: "";
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: var(--radius-pill);
}

#align-to-landing-changes-graph-modal .change-block > a.add::before { background: var(--status-new); }
#align-to-landing-changes-graph-modal .change-block > a.change::before { background: var(--gold); }
#align-to-landing-changes-graph-modal .change-block > a.delete::before { background: var(--status-removed); }
#align-to-landing-changes-graph-modal .change-block > a.offset::before { background: var(--status-modified); }

#align-to-landing-changes-graph-modal .change-block > a p {
    margin: 0;
    font: inherit;
    color: inherit;
}

#align-to-landing-changes-graph-modal .spinny-cog {
    justify-content: center;
    padding: 24px 0;
}

/* Counts by reference code: a v2.1 table that scrolls under its sticky heading */
#align-to-landing-ref-counts-modal .scrollable-grid-container.av-table__frame {
    max-height: calc(100vh - 200px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

#align-to-landing-ref-counts-modal .ref-counts-grid-table.av-table {
    font-size: 13px;
    color: var(--table-ink);
}

#align-to-landing-ref-counts-modal .ref-counts-grid-table.av-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px var(--space-4);
    border-bottom: 1px solid var(--border);
    background: var(--day-band);
    font: 600 12.5px/16px var(--font-display);
    color: var(--heading-ink);
}

#align-to-landing-ref-counts-modal .ref-counts-grid-table.av-table thead th.av-num {
    text-align: right;
}

#align-to-landing-ref-counts-modal .ref-counts-grid-table.av-table tbody td {
    padding: 7px var(--space-4);
    border-bottom: 1px solid var(--row-rule);
}

#align-to-landing-ref-counts-modal .ref-counts-grid-table.av-table tbody tr:hover {
    background: none !important;
}

#align-to-landing-ref-counts-modal .app-refcounts__code {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 12.5px;
}


/* ---------- Updates: a notification's details (js/modules/monitor/landing/updates_rows.js) */
#app-update-notice-modal > .modal-content.app-dialog {
    width: min(760px, calc(100vw - 48px));
    min-width: 0;
    max-height: calc(100vh - 48px);
    padding: 0;
    gap: 0;
    background: var(--surface);
    overflow: hidden;
}

#app-update-notice-modal .modal-content.app-dialog .modal-body {
    flex: 1 1 auto;
    padding: 16px 20px 20px;
    overflow: hidden;
}

#app-update-notice-modal .app-notice__frame {
    display: block;
    width: 100%;
    height: min(60vh, 560px);
    border: 0;
}
