/* ============================================================================
 * Dashboard Framework — canonical widget typography + layout utilities.
 *
 * Loaded by apps that render dashboards (CoreApp Web, Ems.Web, Mobile, DevHost)
 * via:
 *   <link rel="stylesheet"
 *         href="_content/Experior.Framework.Dashboards/css/dashboard-framework.css" />
 *
 * Contains the NON-scoped rules that consumer widgets (EMS Cards, CRM Widgets,
 * CommonWidgets) slot into WidgetFrame ChildContent with:
 *   <span class="oros-widget__value">…</span>
 *   <span class="oros-widget__meta">…</span>
 *   etc.
 *
 * CSS variables (--oros-widget-*-size, ...) are declared by OROS DesignSystem's
 * oros-theme.css. When that theme is loaded, it overrides the fallback values
 * below. When it's NOT loaded (MAUI Blazor Hybrid ships without DesignSystem),
 * widgets still render with coherent typography thanks to these fallbacks.
 * ============================================================================ */

.oros-widget__label {
    font-family: var(--oros-font-family, "Inter", system-ui, sans-serif);
    font-size: var(--oros-widget-label-size, 11px);
    font-weight: var(--oros-widget-label-weight, 600);
    letter-spacing: var(--oros-widget-label-tracking, 0.18em);
    line-height: var(--oros-widget-label-line-height, 1);
    color: var(--oros-widget-label-color, rgba(255, 255, 255, 0.6));
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    display: inline-flex;
    align-items: center;
}

.oros-widget__value {
    font-family: var(--oros-widget-value-family, "JetBrains Mono", ui-monospace, monospace);
    font-size: var(--oros-widget-value-size, 34px);
    font-weight: var(--oros-widget-value-weight, 700);
    line-height: var(--oros-widget-value-line-height, 1.05);
    color: var(--oros-widget-value-color, #ffffff);
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    margin: 0;
}

.oros-widget__caption {
    font-family: var(--oros-font-family, "Inter", system-ui, sans-serif);
    font-size: var(--oros-widget-caption-size, 13px);
    font-weight: var(--oros-widget-caption-weight, 500);
    line-height: var(--oros-widget-caption-line-height, 1.4);
    color: var(--oros-widget-caption-color, rgba(255, 255, 255, 0.75));
    margin: 0;
}

.oros-widget__meta {
    font-family: var(--oros-font-family, "Inter", system-ui, sans-serif);
    font-size: var(--oros-widget-meta-size, 11px);
    font-weight: var(--oros-widget-meta-weight, 500);
    line-height: var(--oros-widget-meta-line-height, 1.3);
    color: var(--oros-widget-meta-color, rgba(255, 255, 255, 0.5));
    margin: 0;
}

/* 24hTracker-inspired flow dashboard shell. */
.dashboard-flow-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dashboard-flow-toolbar__meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
}

.dashboard-flow-segment {
    display: inline-flex;
    gap: 0.125rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    background: rgba(38, 38, 38, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-flow-segment button {
    border: 0;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.dashboard-flow-segment button:hover,
.dashboard-flow-segment button.is-active {
    color: #fff;
    background: rgba(2, 86, 220, 0.82);
}

.dashboard-flow-grid {
    display: grid;
    align-items: stretch;
}

.dashboard-flow-widget {
    position: relative;
    min-width: 0;
    border-radius: 0.75rem;
    transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.dashboard-flow-widget.is-editing {
    outline: 1px solid rgba(255, 255, 255, 0.12);
    outline-offset: -1px;
}

.dashboard-flow-widget__content {
    height: 100%;
    min-width: 0;
}

.dashboard-flow-editbar {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 20;
    display: inline-flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 120ms ease;
}

.dashboard-flow-widget:hover .dashboard-flow-editbar,
.dashboard-flow-widget.widget-resizing .dashboard-flow-editbar,
.dashboard-flow-widget.widget-tile-drag .dashboard-flow-editbar {
    opacity: 1;
}

.dashboard-flow-icon-button {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.375rem;
    background: rgba(23, 23, 23, 0.72);
    color: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(6px);
    cursor: pointer;
}

.dashboard-flow-icon-button:hover {
    color: #fff;
    background: rgba(2, 86, 220, 0.82);
}

.dashboard-flow-icon-button--danger:hover {
    background: rgba(220, 38, 38, 0.88);
}

.dashboard-flow-icon-button svg,
.dashboard-flow-add svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2;
}

.widget-drag-handle {
    cursor: grab;
}

.widget-drag-handle:active {
    cursor: grabbing;
}

.widget-tile-ghost {
    opacity: 0.35;
}

.widget-tile-drag {
    transform: scale(0.985);
    opacity: 0.78;
    z-index: 30;
}

.widget-resize-handle {
    position: absolute;
    top: 0;
    right: -0.375rem;
    bottom: 0;
    z-index: 18;
    width: 0.75rem;
    cursor: col-resize;
    opacity: 0;
    transition: opacity 120ms ease;
}

.widget-resize-handle::after {
    content: "";
    position: absolute;
    top: 0.75rem;
    bottom: 0.75rem;
    left: 50%;
    width: 0.1875rem;
    border-radius: 999px;
    transform: translateX(-50%);
    background: rgba(2, 86, 220, 0.78);
}

.dashboard-flow-widget:hover .widget-resize-handle,
.dashboard-flow-widget.widget-resizing .widget-resize-handle {
    opacity: 1;
}

.dashboard-flow-add {
    margin-top: 1rem;
    width: 100%;
    min-height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 0.75rem;
    background: rgba(38, 38, 38, 0.35);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.dashboard-flow-add:hover {
    border-color: rgba(2, 86, 220, 0.7);
    background: rgba(2, 86, 220, 0.14);
    color: #fff;
}

@media (max-width: 1023px) {
    .widget-resize-handle {
        display: none;
    }
}

.widget-resizing {
    user-select: none;
}

/* Domain filter shell ------------------------------------------------------ */
.dashboard-domain-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    width: 100%;
}

.dashboard-domain-filter__ranges,
.dashboard-domain-filter__facets,
.dashboard-domain-filter__facet {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.dashboard-domain-filter__facet > span {
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.75rem;
    font-weight: 600;
}

.dashboard-domain-filter__range,
.dashboard-domain-filter__chip,
.dashboard-domain-filter__clear {
    min-height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.375rem 0.625rem;
    background: rgba(23, 23, 23, 0.62);
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
}

.dashboard-domain-filter__range:hover,
.dashboard-domain-filter__chip:hover,
.dashboard-domain-filter__clear:hover,
.dashboard-domain-filter__range.is-active,
.dashboard-domain-filter__chip.is-active {
    border-color: rgba(2, 86, 220, 0.72);
    background: rgba(2, 86, 220, 0.24);
    color: #fff;
}

.dashboard-domain-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.dashboard-domain-filter__chip small {
    color: rgba(255, 255, 255, 0.52);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.6875rem;
}

.dashboard-domain-filter__chip--pin.is-active {
    border-color: rgba(196, 166, 79, 0.8);
    background: rgba(196, 166, 79, 0.2);
}

.dashboard-domain-filter__search {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2rem;
    min-width: min(16rem, 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0 0.625rem;
    background: rgba(23, 23, 23, 0.62);
    color: rgba(255, 255, 255, 0.6);
}

.dashboard-domain-filter__search svg {
    width: 0.875rem;
    height: 0.875rem;
    flex: 0 0 auto;
}

.dashboard-domain-filter__search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 0.8125rem;
}

.dashboard-domain-filter__search input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.dashboard-domain-filter__clear {
    color: rgba(248, 113, 113, 0.9);
}

@media (max-width: 767px) {
    .dashboard-domain-filter {
        justify-content: stretch;
    }

    .dashboard-domain-filter__ranges,
    .dashboard-domain-filter__search,
    .dashboard-domain-filter__facets {
        width: 100%;
    }

    .dashboard-domain-filter__ranges {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .dashboard-domain-filter__range {
        padding-inline: 0.25rem;
    }
}
