/* Shared list-table card: the home page's plant list and the incident
   history (moved verbatim from index.html; page-specific columns stay
   in each page). */

@keyframes rowSlideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Section Title Bar ── */
.tab-bar {
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: var(--color-surface);
    margin: 0 20px;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    border-bottom: 1px solid var(--color-border-strong);
    box-shadow: 0 -1px 4px rgba(0,0,0,0.04);
}
.tab-title {
    margin: 0;
    padding: 14px 24px 14px 0;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-primary);
    font-family: var(--font-family);
    letter-spacing: 0.3px;
}

/* ── Tab Content ── */
.tab-content-area {
    background: var(--color-surface);
    margin: 0 20px;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 0;
    margin-bottom: 24px;
}
.tab-pane {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tab-pane.active {
    display: block;
    opacity: 1;
}

/* ── Filter Bar ── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.filter-select {
    padding: 7px 12px;
    min-height: 40px;
    border: 1px solid var(--color-border-strong);
    /* Controls sit inside the 8px card surface - inner radius token. */
    border-radius: var(--card-radius-inner);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    background: var(--color-surface);
    min-width: 100px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(70,172,102,0.12);
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}
.data-table th {
    background: #f5f6f8;
    color: #666;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: none;
    letter-spacing: 0.2px;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    /* Rows slide under the header - give it depth so it reads as a layer. */
    box-shadow: 0 1px 0 rgba(19,59,107,0.10), 0 6px 12px -10px rgba(19,59,107,0.45);
}
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--color-text);
    font-size: 0.88em;
    text-align: left;
    white-space: nowrap;
}
/* Compact variant for plant list */
.data-table-compact th {
    padding: 8px 10px;
    font-size: 0.8125rem;
}
.data-table-compact td {
    padding: 8px 10px;
    font-size: var(--font-size-sm);
}

/* Column dividers on every column */
.data-table-compact th + th,
.data-table-compact td + td {
    border-left: 1px solid #e8e8e8;
}
/* Zebra striping */
.data-table-compact tbody tr:nth-child(even) {
    background: #fafbfc;
}
.data-table-compact tbody tr:hover {
    background: #eef5f0 !important;
}

.data-table tbody tr {
    transition: background-color 0.18s ease;
}
.data-table tbody tr:hover { background: #f8faf9; }
.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr.row-enter {
    animation: rowSlideIn 0.35s ease forwards;
}

.data-table td a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    padding: 8px 0;
    display: inline-block;
    min-height: 44px;
    line-height: 28px;
}
.data-table td a:hover { color: var(--color-accent); }

.status-icon {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    vertical-align: middle;
    transition: transform 0.2s ease;
    /* White glyph on the filled discs, slate on the hollow one. */
    color: #fff;
}
.status-icon-online  { background: var(--color-accent); }
.status-icon-offline { background: var(--status-disc-offline); }
.status-icon-alarm   { background: #F5A100; }
.status-icon-warning { background: #F5A100; }
.status-icon-fault   { background: var(--color-error); }
.status-icon-off     { background: #6b7280; }
.status-icon-unknown { background: var(--color-surface); box-shadow: inset 0 0 0 2px var(--color-border-strong); color: #94a3b8; }
.status-icon svg {
    /* Centred by transform rather than by flex: the disc can land on a
       fractional x (the column width is fractional), and flex centring
       leaves the thin glyph strokes on a different pixel phase to the
       circle behind them, which reads as a shift to the left. A
       transform renders with subpixel precision and stays centred. */
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 15px;
}
.data-table tbody tr:hover .status-icon {
    transform: scale(1.15);
}

/* ── Status Legend ── */
.status-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    border-top: 1px solid var(--color-border-strong);
    font-size: 0.78em;
    color: var(--color-text-secondary);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-item:hover .legend-dot { transform: scale(1.2); }

/* ── Pagination placeholder ── */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--color-border-strong);
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}
.empty-state-icon {
    font-size: 2.4em;
    margin-bottom: 12px;
    opacity: 0.4;
}
.empty-state-text {
    font-size: 0.88em;
    font-weight: 500;
}

@media (max-width: 768px) {
    .tab-bar { margin: 0 10px; padding: 0 10px; }
    .tab-content-area { margin: 0 10px; margin-bottom: 16px; }
    .filter-bar { flex-wrap: wrap; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 0.8125rem; }
}
@media (max-width: 480px) {
    .tab-title { padding: 10px 14px 10px 0; font-size: 0.78em; }
}
