/* SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/* SPDX-License-Identifier: LicenseRef-NvidiaProprietary */
/*
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

/* ============================================
   Aether UI - Modern Dashboard Styles
   ============================================ */

/* CSS Variables for consistent theming */
:root {
    --sidebar-width: 220px;
    --sidebar-bg: #1a1f36;
    --sidebar-text: #a0aec0;
    --sidebar-text-active: #ffffff;
    --sidebar-accent: #3b82f6;
    --header-bg: #1e2a3a;
    --header-height: 60px;
    --content-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-radius: 12px;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --primary-color: #3b82f6;
    --success-color: #22c55e;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
    overflow-x: hidden; /* Prevent horizontal scroll on body */
}

/* App Layout - Sidebar + Main Content */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll at app level */
}

/* ============================================
   Sidebar Styles
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nvidia-text {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #76B900;
    text-transform: uppercase;
}

.brand-name-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    width: 20px;
    height: 20px;
    color: var(--sidebar-accent);
}

.brand-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--sidebar-text-active);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-text-active);
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-text-active);
    border-left-color: var(--sidebar-accent);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
    max-width: calc(100vw - var(--sidebar-width)); /* Constrain width */
}

.main-header {
    background-color: var(--header-bg);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.content-area {
    flex: 1;
    padding: 24px 32px;
    overflow-x: hidden; /* Prevent horizontal scroll at content area level */
}

/* ============================================
   Content Panels (Tab Replacement)
   ============================================ */
.content-panel {
    display: none;
}

.content-panel.active {
    display: block;
}

/* ============================================
   Dashboard Cards
   ============================================ */
.dashboard-card {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
}

.card-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 20px 0;
}

.card-header-with-control {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.card-header-with-control .card-section-title {
    margin-bottom: 0;
}

/* ============================================
   Metrics Display
   ============================================ */
.metrics-row {
    display: flex;
    gap: 32px;
}

.metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-item.primary {
    min-width: 140px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.metrics-grid.compact {
    grid-template-columns: repeat(2, 1fr);
}

.qualification-rate-card {
    grid-column: 1 / -1;
}

.metric-card {
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.metric-card-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Color classes for values */
.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

/* ============================================
   Compact KPI Dashboard Styles
   ============================================ */

/* Control Bar */
.kpi-control-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 16px;
    background-color: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.kpi-control-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kpi-control-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.kpi-slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-slider-min,
.kpi-slider-max {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.kpi-slider {
    width: 180px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.kpi-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.kpi-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.kpi-slider-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
    background-color: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

/* KPI Metrics Strip */
.kpi-metrics-strip {
    display: flex;
    gap: 16px;
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.kpi-metric-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    border-radius: 8px;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-metric-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kpi-metric-box.primary {
    background-color: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.kpi-metric-box.primary .kpi-metric-value {
    color: var(--primary-color);
}

.kpi-metric-box.success {
    background-color: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
}

.kpi-metric-box.success .kpi-metric-value {
    color: var(--success-color);
}

.kpi-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.kpi-metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ============================================
   KPI Category Cards (Two-Column Layout)
   ============================================ */
.kpi-category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .kpi-category-grid {
        grid-template-columns: 1fr;
    }
}

.kpi-category-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
}

.kpi-category-card.speedup {
    border-top: 4px solid var(--primary-color);
}

.kpi-category-card.savings {
    border-top: 4px solid var(--success-color);
}

.kpi-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.kpi-category-icon {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
}

.kpi-category-card.speedup .kpi-category-icon {
    color: var(--primary-color);
}

.kpi-category-card.savings .kpi-category-icon {
    color: var(--success-color);
}

.kpi-category-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.kpi-category-content {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    flex: 1;
}

.kpi-headline-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-headline-value {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.kpi-category-card.speedup .kpi-headline-value {
    color: var(--primary-color);
}

.kpi-category-card.savings .kpi-headline-value {
    color: var(--success-color);
}

.kpi-headline-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-category-details {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--border-color);
}

.kpi-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-detail-label {
    font-size: 0.625rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.kpi-detail-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* Compact Card Styles */
.compact-card {
    padding: 16px 20px;
}

.compact-metrics-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.compact-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}

.compact-metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.compact-metric-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Threshold Control
   ============================================ */
.threshold-control {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.threshold-control.inline {
    flex-wrap: nowrap;
}

.threshold-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.threshold-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.threshold-min,
.threshold-max {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.threshold-slider {
    width: 180px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.threshold-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.threshold-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.threshold-value-display {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    min-width: 40px;
}

.btn-update {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-update:hover {
    background-color: #2563eb;
}

/* ============================================
   Migration Page
   ============================================ */
.migration-header {
    margin-bottom: 20px;
}

.migration-header .card-section-title {
    margin-bottom: 8px;
}

.migration-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.readiness-app-name {
    color: var(--text-primary);
    font-weight: 600;
}

.readiness-job-id {
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    margin-top: 2px;
}

.migration-decision-table {
    min-width: 960px;
}

.migration-decision-table th:first-child {
    width: 21%;
}

.migration-decision-table th:last-child {
    width: 23%;
}

.migration-cell-detail,
.decision-reason-label,
.decision-reason-code {
    display: block;
}

.migration-cell-detail {
    color: var(--text-secondary);
    font-size: 0.6875rem;
    margin-top: 5px;
    white-space: nowrap;
}

.shadow-evidence-cell {
    color: #475569;
    font-size: 0.8125rem !important;
    white-space: nowrap;
}

.decision-reason-label {
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.decision-reason-code {
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.625rem;
    margin-top: 4px;
}

.status-badge {
    align-items: center;
    background-color: #f1f5f9;
    border-radius: 999px;
    color: #475569;
    display: inline-flex;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    padding: 4px 9px;
    white-space: nowrap;
}

.status-badge.readiness-rapids,
.status-badge.runtime-gpu,
.status-badge.status-success {
    background-color: #dcfce7;
    color: #166534;
}

.status-badge.readiness-shadow_rapids,
.status-badge.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.readiness-cpu,
.status-badge.runtime-cpu {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-badge.status-failed {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.status-neutral {
    background-color: #f1f5f9;
    color: #475569;
}

.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px 20px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.threshold-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.threshold-value-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 36px;
    height: 28px;
    padding: 0 8px;
    border-radius: 4px;
}

.threshold-unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ============================================
   Charts
   ============================================ */
.chart-container {
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}

.chart-wrapper {
    position: relative;
}

canvas {
    max-width: 100%;
}

/* ============================================
   Tables
   ============================================ */
.table {
    width: 100%;
    margin-bottom: 0;
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    font-size: 0.875rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

/* Empty table state */
.table-empty-row td {
    text-align: center;
    color: var(--text-secondary);
    padding: 32px 16px;
    font-style: italic;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.5);
}

.table-responsive {
    overflow-x: auto;
    margin: 0 -24px;
    padding: 0 24px;
}

.summary-table {
    min-width: 880px;
    table-layout: fixed;
}

.summary-table th[data-column="summary-identity"] {
    width: 25%;
}

.summary-table th[data-column="summary-recommendation"] {
    width: 15%;
}

.summary-table th[data-column="summary-runtime"],
.summary-table th[data-column="summary-cost"] {
    width: 21%;
}

.summary-table th[data-column="summary-validation"] {
    width: 18%;
}

.summary-identity-cell,
.summary-comparison-cell {
    vertical-align: top !important;
}

.summary-identity-cell {
    min-width: 0;
    overflow: hidden;
}

.summary-identity-name {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.35;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.summary-identity-id {
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.75rem;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.summary-row-link {
    cursor: pointer;
}

.summary-row-link:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: -3px;
}

.summary-row-link:hover .summary-row-hint,
.summary-row-link:focus-visible .summary-row-hint {
    color: var(--primary-color);
    opacity: 1;
}

.summary-row-hint {
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 600;
    margin-top: 8px;
    opacity: 0.72;
}

.summary-comparison-line {
    display: grid;
    grid-template-columns: minmax(64px, auto) 1fr;
    gap: 10px;
    align-items: baseline;
    padding: 3px 0;
}

.summary-comparison-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.summary-comparison-value {
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.summary-comparison-outcome .summary-comparison-value {
    font-weight: 600;
}

.summary-comparison-outcome {
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    margin-top: 3px;
    padding-top: 6px;
}

.summary-outcome-positive .summary-comparison-value {
    color: var(--success-color);
}

.summary-outcome-negative .summary-comparison-value {
    color: #ef4444;
}

/* ============================================
   Database Tables View
   ============================================ */
.db-tables-layout {
    display: flex;
    gap: 24px;
    min-height: calc(100vh - 200px);
}

.db-tables-sidebar {
    width: 280px;
    flex-shrink: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-border-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    align-self: flex-start;
    max-height: calc(100vh - 200px);
}

.db-tables-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.db-tables-sidebar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.db-tables-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #e2e8f0;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
}

.db-tables-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.db-tables-search-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #f8fafc;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.db-tables-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background-color: #ffffff;
}

.db-tables-search-input::placeholder {
    color: #94a3b8;
}

.db-tables-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.db-table-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: left;
}

.db-table-item:hover {
    background-color: #f1f5f9;
}

.db-table-item.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

.db-table-item-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.db-table-item.active .db-table-item-icon {
    opacity: 1;
}

.db-table-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.db-tables-content {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 304px); /* 280px sidebar + 24px gap */
    overflow: hidden; /* Contain overflow - table-responsive inside handles scroll */
}

.db-tables-content .dashboard-card {
    overflow: hidden;
    max-width: 100%;
}

.db-tables-content .table-responsive {
    overflow-x: auto;
    max-width: 100%;
}

/* Ensure tables don't cause overflow */
#tables-content {
    overflow: hidden;
}

.db-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.db-table-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.db-table-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.db-table-row-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.db-table-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.db-table-empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.db-table-empty-state p {
    font-size: 0.9375rem;
    margin: 0;
}

/* Legacy list-group support */
.list-group {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.list-group-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    font-size: 0.875rem;
    transition: background-color 0.15s ease;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background-color: #f1f5f9;
}

.list-group-item.active {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* ============================================
   Form Controls
   ============================================ */
.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.875rem;
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ============================================
   Alerts
   ============================================ */
.alert {
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 0.875rem;
}

.alert-danger {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ============================================
   Spinner / Loading
   ============================================ */
.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--primary-color);
}

/* ============================================
   Bootstrap Overrides / Card Compatibility
   ============================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.card-header h4,
.card-header h3,
.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* ============================================
   Modal Styles
   ============================================ */
.modal-content {
    border-radius: var(--card-radius);
    border: none;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 16px 24px;
}

/* ============================================
   Config Diff Modal Styles
   ============================================ */
#configDiffModal .modal-dialog {
    max-width: 90%;
}

#configDiffModal .modal-body {
    max-height: 80vh;
    overflow-y: auto;
}

#configDiffModal .card {
    margin-bottom: 1rem;
}

#configDiffModal .table-sm td,
#configDiffModal .table-sm th {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* ============================================
   View Links (unified style for all viewable content)
   ============================================ */
.view-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.08);
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.view-link:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
    text-decoration: none;
}

.view-link svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Legacy link support (for backwards compatibility) */
.spark-config-link,
.qualification-link,
.run-link,
.profile-link,
.validation-link {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.spark-config-link:hover,
.qualification-link:hover,
.run-link:hover,
.profile-link:hover,
.validation-link:hover {
    text-decoration: underline;
}

/* ============================================
   Table Options Section
   ============================================ */
.table-options-section {
    background-color: #f8fafc !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px;
}

.table-options-section h6 {
    font-size: 0.8125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.view-control-item {
    padding: 8px 12px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

/* ============================================
   JSON Field Styling
   ============================================ */
.json-field {
    max-height: 200px;
    overflow-y: auto;
    background-color: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   Row Highlighting
   ============================================ */
.table-success {
    background-color: rgba(34, 197, 94, 0.1) !important;
}

.table-danger {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.table-warning {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.table-info {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted {
    color: var(--text-secondary) !important;
}

.mb-4 {
    margin-bottom: 24px !important;
}

.mt-4 {
    margin-top: 24px !important;
}

.py-5 {
    padding-top: 48px !important;
    padding-bottom: 48px !important;
}

.d-none {
    display: none !important;
}

/* ============================================
   Tooltip Styles
   ============================================ */
.tooltip-inner {
    max-width: 350px;
    text-align: left;
    font-size: 0.8125rem;
    padding: 8px 12px;
    border-radius: 6px;
}

/* ============================================
   Job Details Page - Job Selector
   ============================================ */
.job-selector-card {
    background-color: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 16px 20px;
    max-width: 520px;
}

.job-details-back {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--primary-color);
    display: inline-flex;
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 6px;
    margin: -2px 0 12px;
    padding: 2px 0;
}

.job-details-back:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.job-details-back:focus-visible {
    border-radius: 4px;
    outline: 3px solid rgba(59, 130, 246, 0.25);
    outline-offset: 3px;
}

.job-selector-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.job-selector-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.job-selector-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

.job-selector-input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    background-color: #ffffff;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.job-selector-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.job-selector-options {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    left: 0;
    margin-top: 6px;
    max-height: 320px;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1050;
}

.job-selector-option {
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    padding: 10px 12px;
}

.job-selector-option:last-child {
    border-bottom: 0;
}

.job-selector-option:hover,
.job-selector-option.active {
    background: #eff6ff;
}

.job-selector-option-name,
.job-selector-option-id {
    display: block;
    overflow-wrap: anywhere;
}

.job-selector-option-name {
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.job-selector-option-id {
    color: var(--text-secondary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.6875rem;
    margin-top: 3px;
}

.job-selector-empty {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    padding: 14px 12px;
}

.shadow-reference-value {
    display: block;
    font-weight: 600;
}

.shadow-reference-label {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ============================================
   Job Details Page - App Summary
   ============================================ */
.app-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.job-overview-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-section-description,
.chart-description {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: -8px 0 16px;
}

@media (max-width: 992px) {
    .job-overview-grid {
        grid-template-columns: 1fr;
    }
}

.app-summary-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.app-summary-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.app-summary-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    word-break: break-all;
}

/* ============================================
   Job Details Page - Table Header Bar
   ============================================ */
.table-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.table-header-left {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.table-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Run Type Filter Tabs */
.run-type-tabs {
    display: flex;
    background-color: #f1f5f9;
    border-radius: 8px;
    padding: 4px;
}

.run-type-tab {
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.run-type-tab:hover {
    color: var(--text-primary);
}

.run-type-tab.active {
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Config Diff Control */
.config-diff-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-diff-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.config-diff-select {
    padding: 6px 28px 6px 12px;
    font-size: 0.8125rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #ffffff;
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}

.config-diff-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ============================================
   Job Details Page - Chart Header Bar
   ============================================ */
.chart-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* ============================================
   Job Details Page - Run Type Badges
   ============================================ */
.run-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.run-type-badge.cpu {
    background-color: #dbeafe;
    color: #1e40af;
}

.run-type-badge.gpu {
    background-color: #d1fae5;
    color: #065f46;
}

.run-type-badge.shadow {
    background-color: #cbd5e1;
    border: 1px solid #94a3b8;
    color: #334155;
}

#job-metadata-table .run-cpu > * {
    background-color: #eff6ff !important;
}

#job-metadata-table .run-gpu > * {
    background-color: #f0fdf4 !important;
}

#job-metadata-table .run-shadow > * {
    background-color: #e9eef3 !important;
}

#job-metadata-table .run-cpu > *:first-child {
    box-shadow: inset 4px 0 #3b82f6;
}

#job-metadata-table .run-gpu > *:first-child {
    box-shadow: inset 4px 0 #16a34a;
}

#job-metadata-table .run-shadow > *:first-child {
    box-shadow: inset 4px 0 #64748b;
}

#job-metadata-table .run-failed > * {
    background-color: #fef2f2 !important;
}

#job-metadata-table .run-failed > *:first-child {
    box-shadow: inset 4px 0 #ef4444;
}

/* ============================================
   Job Details Page - Value Colors
   ============================================ */
.value-positive {
    color: var(--success-color);
    font-weight: 600;
}

.value-negative {
    color: #ef4444;
    font-weight: 600;
}

.value-neutral {
    color: var(--text-secondary);
}


/* ============================================
   Content View Modal
   ============================================ */
.content-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.content-modal {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
        width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.content-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.content-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.content-modal-close:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

.content-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Properties table inside modal */
.content-properties-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.content-properties-table tr {
    border-bottom: 1px solid var(--border-color);
}

.content-properties-table tr:last-child {
    border-bottom: none;
}

.content-prop-key {
    padding: 10px 12px;
    font-weight: 500;
    color: var(--text-primary);
    background-color: #f8fafc;
    width: 35%;
    vertical-align: top;
    word-break: break-word;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
}

.content-prop-value {
    padding: 10px 12px;
    color: var(--text-secondary);
    vertical-align: top;
    word-break: break-word;
}

/* Nested tables */
.content-prop-value .content-properties-table {
    margin: -10px -12px;
    width: calc(100% + 24px);
}

.content-prop-value .content-properties-table .content-prop-key {
    background-color: #f1f5f9;
    padding-left: 24px;
}

/* JSON and text content */
.content-json,
.content-text,
.content-array {
    margin: 0;
    padding: 16px;
    background-color: #1e293b;
    color: #e2e8f0;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.content-array {
    padding: 8px 12px;
    background-color: #f1f5f9;
    color: var(--text-primary);
    font-size: 0.75rem;
}

/* ============================================
   I/O Metrics Styles
   ============================================ */

/* I/O Metrics Cell in Table */
.io-metric-cell {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* I/O Metrics Summary Card */
.io-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.io-metrics-section {
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #e2e8f0;
}

.io-metrics-section.io-metrics-cpu {
    border-left-color: #3b82f6;
    background-color: #eff6ff;
}

.io-metrics-section.io-metrics-gpu {
    border-left-color: #22c55e;
    background-color: #f0fdf4;
}

.io-metrics-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.io-metrics-data {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.io-metric-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.io-metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.io-metric-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
}

/* Responsive adjustments for I/O metrics */
@media (max-width: 768px) {
    .io-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .io-metric-cell {
        font-size: 0.75rem;
    }
}
