/* ats-reporting.css — Scoped styles for V1 client-side reporting views.
   All classes prefixed v1- to avoid collision with Fluent/Blazor styles.
   Inherits priority colors from shell.css :root variables. */


/* ══════════════════════════════════════════════════════════════
   PRIORITY DOT / BADGE — shared across tree, table, item card
   ══════════════════════════════════════════════════════════════ */

.v1-priority-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: #888;
}

.v1-priority-dot[data-priority="1"] { background-color: var(--priority-1); }
.v1-priority-dot[data-priority="2"] { background-color: var(--priority-2); }
.v1-priority-dot[data-priority="3"] { background-color: var(--priority-3); }
.v1-priority-dot[data-priority="4"] { background-color: var(--priority-4); }
.v1-priority-dot[data-priority="5"] { background-color: var(--priority-5); }
.v1-priority-dot[data-priority="6"] { background-color: var(--priority-6); }

.v1-priority-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.v1-priority-badge[data-priority="1"] { background-color: var(--priority-1); }
.v1-priority-badge[data-priority="2"] { background-color: var(--priority-2); }
.v1-priority-badge[data-priority="3"] { background-color: var(--priority-3); color: #111; }
.v1-priority-badge[data-priority="4"] { background-color: var(--priority-4); }
.v1-priority-badge[data-priority="5"] { background-color: var(--priority-5); }
.v1-priority-badge[data-priority="6"] { background-color: var(--priority-6); }

.v1-empty {
    padding: 24px;
    text-align: center;
    color: var(--neutral-foreground-hint, #888);
    font-style: italic;
}


/* ══════════════════════════════════════════════════════════════
   HOME PAGE — company sections + location grid
   ══════════════════════════════════════════════════════════════ */

.v1-company-section {
    margin-bottom: 24px;
}

.v1-company-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--neutral-stroke-rest, #ddd);
}

.v1-location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.v1-location-card {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border: 1px solid var(--neutral-stroke-rest, #ddd);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.v1-location-card:hover {
    border-color: var(--accent-fill-rest, #0078d4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.v1-location-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.v1-location-count {
    font-size: 0.85rem;
    color: var(--neutral-foreground-hint, #888);
}


/* ══════════════════════════════════════════════════════════════
   LOCATION TREE — hierarchical navigation
   ══════════════════════════════════════════════════════════════ */

.v1-tree-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.9rem;
}

.v1-tree-search {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--neutral-stroke-rest, #ccc);
    border-radius: 4px;
    background: var(--neutral-fill-input-rest, #fff);
    color: inherit;
    font-size: inherit;
    box-sizing: border-box;
}

.v1-tree-search:focus {
    outline: 2px solid var(--accent-fill-rest, #0078d4);
    outline-offset: -1px;
}

.v1-tree-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    font-size: 0.85rem;
    cursor: pointer;
}

.v1-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.v1-tree-l1 { padding-left: 0; }
.v1-tree-l2 { padding-left: 16px; }
.v1-tree-l3 { padding-left: 32px; }
.v1-tree-l4 { padding-left: 48px; }

.v1-tree-node {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}

.v1-tree-node:hover,
.v1-tree-leaf:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.04));
}

.v1-tree-selected {
    background: var(--accent-fill-rest, #0078d4) !important;
    color: var(--accent-foreground-cut-rest, #fff);
}

.v1-tree-selected .v1-tree-badge {
    color: inherit;
    opacity: 0.85;
}

.v1-tree-arrow {
    all: unset;
    display: inline-flex;
    width: 16px;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.v1-tree-badge {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--neutral-foreground-hint, #888);
    flex-shrink: 0;
}

.v1-tree-children {
    /* animated expand could go here */
}

.v1-tree-leaf {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}


/* ══════════════════════════════════════════════════════════════
   ITEM TABLE — asset list with filter bar
   ══════════════════════════════════════════════════════════════ */

.v1-table-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.v1-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--neutral-stroke-rest, #ddd);
    background: var(--neutral-fill-stealth-rest, rgba(0, 0, 0, 0.02));
}

.v1-filter-search input {
    padding: 5px 10px;
    border: 1px solid var(--neutral-stroke-rest, #ccc);
    border-radius: 4px;
    background: var(--neutral-fill-input-rest, #fff);
    color: inherit;
    font-size: 0.85rem;
    min-width: 180px;
}

.v1-filter-search input:focus {
    outline: 2px solid var(--accent-fill-rest, #0078d4);
    outline-offset: -1px;
}

.v1-filter-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.v1-filter-group > summary {
    cursor: pointer;
    list-style: none;
}

.v1-filter-group > summary::-webkit-details-marker {
    display: none;
}

.v1-filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--neutral-foreground-hint, #888);
    white-space: nowrap;
}

.v1-filter-btn {
    all: unset;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    color: var(--accent-foreground-rest, #0078d4);
}

.v1-filter-btn:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.04));
}

.v1-filter-check {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.v1-filter-check input[type="checkbox"] {
    margin: 0;
}

.v1-filter-rec-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 6px 0;
}

.v1-filter-results {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--neutral-foreground-hint, #888);
    white-space: nowrap;
}

.v1-selection-count {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.v1-filter-group select {
    padding: 3px 6px;
    border: 1px solid var(--neutral-stroke-rest, #ccc);
    border-radius: 4px;
    background: var(--neutral-fill-input-rest, #fff);
    color: inherit;
    font-size: 0.8rem;
}

/* Asset rows */
.v1-table-rows {
    overflow-y: auto;
}

.v1-asset-row {
    display: grid;
    grid-template-columns: auto 10px 1fr 150px 120px 100px;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid var(--neutral-stroke-rest, #eee);
    cursor: pointer;
    user-select: none;
}

.v1-asset-row:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.04));
}

.v1-asset-row.v1-selected {
    background: var(--accent-fill-rest, #0078d4);
    color: var(--accent-foreground-cut-rest, #fff);
}

.v1-row-check {
    margin: 0;
}

.v1-row-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v1-row-area,
.v1-row-rec,
.v1-row-date {
    font-size: 0.85rem;
    color: var(--neutral-foreground-hint, #888);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v1-selected .v1-row-area,
.v1-selected .v1-row-rec,
.v1-selected .v1-row-date {
    color: inherit;
    opacity: 0.85;
}

/* When no checkbox column, adjust grid */
.v1-asset-row:not(:has(.v1-row-check)) {
    grid-template-columns: 10px 1fr 150px 120px 100px;
}


/* ══════════════════════════════════════════════════════════════
   ITEM DETAIL CARD — full item view
   ══════════════════════════════════════════════════════════════ */

.v1-item-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.v1-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.v1-item-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.v1-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.v1-crumb {
    color: var(--neutral-foreground-hint, #888);
    text-decoration: none;
}

a.v1-crumb:hover {
    color: var(--accent-foreground-rest, #0078d4);
    text-decoration: underline;
}

.v1-crumb + .v1-crumb::before {
    content: "›";
    margin-right: 4px;
    color: var(--neutral-foreground-hint, #aaa);
}

.v1-badge-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.v1-badge {
    display: inline-block;
    padding: 2px 8px;
    border: 1px solid var(--neutral-stroke-rest, #ccc);
    border-radius: 3px;
    font-size: 0.8rem;
    font-family: monospace;
    cursor: pointer;
    user-select: none;
}

.v1-badge:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.04));
}

.v1-downtime-rate {
    display: flex;
    gap: 6px;
    font-size: 0.9rem;
}

.v1-label {
    color: var(--neutral-foreground-hint, #888);
}

.v1-value {
    font-weight: 600;
}

/* Two-column body */
.v1-item-body {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .v1-item-body {
        grid-template-columns: 1fr;
    }
}

.v1-item-left {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.v1-item-image {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--neutral-fill-stealth-rest, rgba(0, 0, 0, 0.02));
}

.v1-motor-props h4,
.v1-sensor-summary h4,
.v1-rec-summaries h4 {
    font-size: 0.9rem;
    margin: 0 0 6px;
}

.v1-motor-props dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 12px;
    margin: 0;
    font-size: 0.85rem;
}

.v1-motor-props dt {
    color: var(--neutral-foreground-hint, #888);
    font-weight: 500;
}

.v1-motor-props dd {
    margin: 0;
}

.v1-sensor-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.v1-sensor-tag {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Signal strength color classes */
.v1-signal-e { background: #E01020; color: #fff; }  /* Extreme */
.v1-signal-g { background: #FF5F1F; color: #fff; }  /* High (G for "great concern") */
.v1-signal-f { background: #fae102; color: #111; }  /* Fair */
.v1-signal-w { background: #299602; color: #fff; }  /* Within limits */
.v1-signal-n { background: #888; color: #fff; }      /* No data */
.v1-signal-h { background: #555; color: #fff; }      /* Historical */

.v1-rec-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.v1-rec-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: var(--neutral-fill-stealth-rest, rgba(0, 0, 0, 0.04));
    border: 1px solid var(--neutral-stroke-rest, #ddd);
}

/* Right column — report content + timeline */
.v1-item-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.v1-item-right.v1-collapsed {
    display: none;
}

.v1-timeline-section h4,
.v1-report-content h4 {
    font-size: 0.9rem;
    margin: 0 0 6px;
}

.v1-report-content h5 {
    font-size: 0.85rem;
    margin: 8px 0 4px;
}

.v1-chart-container {
    position: relative;
    width: 100%;
}

.v1-chart-container canvas {
    width: 100% !important;
}

.v1-report-results {
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.v1-report-recs ul {
    margin: 4px 0;
    padding-left: 20px;
    font-size: 0.9rem;
}

.v1-report-recs li {
    margin-bottom: 4px;
}

.v1-ca-amount {
    font-weight: 600;
    color: var(--priority-4, #299602);
}

.v1-spectrum-image img {
    max-width: 100%;
    border-radius: 4px;
    border: 1px solid var(--neutral-stroke-rest, #ddd);
}


/* ══════════════════════════════════════════════════════════════
   EQUIPMENT DASHBOARD — KPI cards + charts
   ══════════════════════════════════════════════════════════════ */

.v1-dashboard {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.v1-dashboard-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.v1-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.v1-kpi-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid var(--neutral-stroke-rest, #ddd);
    border-radius: 6px;
    text-align: center;
}

.v1-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.v1-kpi-label {
    font-size: 0.8rem;
    color: var(--neutral-foreground-hint, #888);
    margin-top: 4px;
}

.v1-kpi-alert .v1-kpi-value {
    color: var(--priority-1, #E01020);
}

.v1-kpi-positive .v1-kpi-value {
    color: var(--priority-4, #299602);
}

.v1-kpi-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v1-kpi-section h4 {
    font-size: 0.9rem;
    margin: 0;
}

/* Priority distribution bar */
.v1-priority-bar {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
}

.v1-priority-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.v1-priority-segment:hover {
    opacity: 0.85;
}

.v1-priority-segment[data-priority="1"] { background-color: var(--priority-1); }
.v1-priority-segment[data-priority="2"] { background-color: var(--priority-2); }
.v1-priority-segment[data-priority="3"] { background-color: var(--priority-3); color: #111; }
.v1-priority-segment[data-priority="4"] { background-color: var(--priority-4); }
.v1-priority-segment[data-priority="5"] { background-color: var(--priority-5); }
.v1-priority-segment[data-priority="6"] { background-color: var(--priority-6); }

.v1-chart-small {
    max-height: 180px;
}

/* Recommendation table */
.v1-rec-table {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.v1-rec-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.85rem;
}

.v1-rec-row:nth-child(odd) {
    background: var(--neutral-fill-stealth-rest, rgba(0, 0, 0, 0.02));
}

.v1-rec-category {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v1-rec-count {
    font-weight: 600;
    text-align: right;
}

.v1-rec-ca {
    color: var(--priority-4, #299602);
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════
   PLAYLIST — layout + controls + sidebar
   ══════════════════════════════════════════════════════════════ */

.v1-playlist-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .v1-playlist-layout {
        grid-template-columns: 1fr;
    }
    .v1-playlist-sidebar {
        display: none;
    }
}

.v1-playlist-sidebar {
    border-right: 1px solid var(--neutral-stroke-rest, #ddd);
    overflow-y: auto;
}

.v1-playlist-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.v1-playlist-controls {
    flex-shrink: 0;
}

.v1-playlist-display {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.v1-playback-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--neutral-stroke-rest, #ddd);
    background: var(--neutral-fill-stealth-rest, rgba(0, 0, 0, 0.02));
}

.v1-playback-bar button {
    all: unset;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 1rem;
}

.v1-playback-bar button:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.06));
}

.v1-playback-position {
    font-size: 0.85rem;
    color: var(--neutral-foreground-hint, #888);
    margin-left: auto;
}

.v1-playback-speed {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.v1-playback-speed button {
    font-size: 0.85rem;
    padding: 2px 6px;
}

.v1-playlist-item-list {
    padding: 8px;
}

.v1-playlist-item-list h3 {
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.v1-playlist-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.v1-playlist-item:hover {
    background: var(--neutral-fill-stealth-hover, rgba(0, 0, 0, 0.04));
}

.v1-playlist-item.current {
    background: var(--accent-fill-rest, #0078d4);
    color: var(--accent-foreground-cut-rest, #fff);
}

.v1-playlist-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ══════════════════════════════════════════════════════════════
   V1 SHELL PAGE — container for JS-mounted views
   ══════════════════════════════════════════════════════════════ */

.v1-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 102px);
    overflow: hidden;
}

.v1-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--neutral-stroke-rest, #ddd);
    flex-shrink: 0;
}

.v1-page-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.v1-page-split {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
}

.v1-page-split > :first-child {
    border-right: 1px solid var(--neutral-stroke-rest, #ddd);
    overflow-y: auto;
    padding: 8px;
}

.v1-page-split > :last-child {
    overflow-y: auto;
    padding: 16px;
}

@media (max-width: 768px) {
    .v1-page-split {
        grid-template-columns: 1fr;
    }
    .v1-page-split > :first-child {
        display: none;
    }
}

/* Offline status banner */
.v1-offline-banner {
    padding: 6px 16px;
    background: var(--priority-2, #FF5F1F);
    color: #fff;
    font-size: 0.85rem;
    text-align: center;
}

.v1-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--neutral-foreground-hint, #888);
}

.v1-sync-indicator.syncing {
    color: var(--accent-foreground-rest, #0078d4);
}
