/* Admin Dashboard Custom Styles */

:root {
    --sidebar-width: 250px;
    --navbar-height: 56px;
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: #212529;
    padding-top: calc(var(--navbar-height) + 1rem);
    padding-bottom: 1rem;
    overflow-y: auto;
    z-index: 100;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    border-radius: 0;
}

.sidebar .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    color: #fff;
    background-color: var(--primary-color);
}

.sidebar .nav-link svg {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Sidebar section headers */
.sidebar .sidebar-section-header {
    color: #adb5bd !important;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 1rem 1rem 0.5rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .sidebar-section-header:first-child {
    padding-top: 0.5rem;
}

.sidebar .sidebar-section-header svg {
    color: #adb5bd !important;
    opacity: 0.7;
}

/* Indented nav items under sections */
.sidebar .nav-link-item {
    padding-left: 1.5rem;
    font-size: 0.875rem;
}

/* Main content area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    min-height: calc(100vh - var(--navbar-height));
    margin-top: var(--navbar-height);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height);
    z-index: 1030;
}

/* Stats cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card.pending {
    border-left-color: var(--warning-color);
}

.stat-card.active {
    border-left-color: var(--info-color);
}

.stat-card.completed {
    border-left-color: var(--success-color);
}

.stat-card.failed {
    border-left-color: var(--danger-color);
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: bold;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
}

/* Status badges */
.badge-job-pending {
    background-color: var(--warning-color);
    color: #212529;
}

.badge-job-active {
    background-color: var(--info-color);
    color: #212529;
}

.badge-job-completed {
    background-color: var(--success-color);
}

.badge-job-failed {
    background-color: var(--danger-color);
}

.badge-job-paused {
    background-color: #6c757d;
}

/* Health status indicators */
.health-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.health-indicator.healthy {
    background-color: var(--success-color);
}

.health-indicator.unhealthy {
    background-color: var(--danger-color);
}

.health-indicator.unknown {
    background-color: #6c757d;
}

/* Progress bars */
.progress-thin {
    height: 6px;
}

/* Action buttons */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Tables */
.table-hover tbody tr {
    cursor: pointer;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: calc(var(--navbar-height) + 1rem);
    right: 1rem;
    z-index: 1050;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Card improvements */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Table improvements */
.table th {
    font-weight: 600;
    background-color: #f8f9fa;
}

/* Form improvements */
.form-label {
    font-weight: 500;
}

/* Fields with default values - subtle visual distinction */
.form-control.form-default,
.form-select.form-default {
    background-color: #f9fafb;
}

.form-control.form-default:focus,
.form-select.form-default:focus {
    background-color: #fff;
}

/* Utility classes */
.text-muted-light {
    color: #adb5bd;
}

.cursor-pointer {
    cursor: pointer;
}

/* Refresh Control Component */
.refresh-control .badge {
    font-size: 0.7rem;
    transition: background-color 0.2s ease;
}

.refresh-control .form-check-input {
    cursor: pointer;
}

.refresh-control .form-check-label {
    cursor: pointer;
}

/* Job Timeline Styles */
.job-timeline {
    padding: 20px 0;
}

.timeline-stage {
    position: relative;
    min-width: 80px;
}

.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1rem;
}

.stage-connector {
    position: absolute;
    top: 20px;
    left: calc(50% + 25px);
    width: calc(100% - 50px);
    height: 2px;
    background-color: #dee2e6;
}

.connector-completed {
    background-color: #198754;
}

.stage-in-progress .icon-circle {
    animation: timeline-pulse 1.5s infinite;
}

@keyframes timeline-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.stage-failed .icon-circle {
    animation: timeline-shake 0.5s;
}

@keyframes timeline-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================
   v2 Navigation Styles
   ============================ */

/* Main navigation links (4 main sections) */
.sidebar .nav-link-main {
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .nav-link-main:hover {
    border-left-color: rgba(255, 255, 255, 0.3);
}

.sidebar .nav-link-main.active {
    border-left-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.15);
}

.sidebar .nav-link-main svg {
    flex-shrink: 0;
}

/* Sidebar divider */
.sidebar .sidebar-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

/* ============================
   Overview Page Styles
   ============================ */

/* Status cards */
.status-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Health score circle */
.status-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-circle .status-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

/* Status numbers */
.status-number {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1.2;
}

.status-label {
    color: #6c757d;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mini stats in sidebar */
.stat-mini {
    padding: 0.25rem;
}

.stat-mini-number {
    font-size: 1.25rem;
    font-weight: bold;
    line-height: 1.2;
}

.stat-mini-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
}

/* Queue breakdown */
.queue-breakdown {
    font-size: 0.75rem;
}

/* ============================
   Tab Navigation Styles
   ============================ */

.nav-tabs .nav-link {
    color: #495057;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.75rem 1.25rem;
}

.nav-tabs .nav-link:hover {
    border-bottom-color: #dee2e6;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: transparent;
}

/* ============================
   Grafana Embed Styles
   ============================ */

.grafana-panel-container,
.grafana-dashboard-container {
    position: relative;
    overflow: hidden;
    background-color: #f8f9fa;
}

.grafana-panel-container iframe,
.grafana-dashboard-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ============================
   Alert List Styles
   ============================ */

.list-group-item .badge {
    font-size: 0.7rem;
}

/* ============================
   Queue Stats Styles
   ============================ */

.queue-stat {
    padding: 0.5rem;
}

.queue-stat-number {
    font-size: 2rem;
    font-weight: bold;
    line-height: 1.2;
}

.queue-stat-label {
    font-family: monospace;
    font-size: 0.875rem;
    color: #495057;
}

/* ============================
   Expandable Navigation Submenu
   ============================ */

/* Nav section wrapper for collapsible items */
.sidebar .nav-section {
    position: relative;
}

/* Chevron icon for expandable sections */
.sidebar .nav-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.sidebar .nav-section.expanded .nav-chevron {
    transform: rotate(90deg);
}

/* Submenu styles */
.sidebar .nav-submenu {
    padding-left: 1rem;
    background-color: rgba(0, 0, 0, 0.15);
}

.sidebar .nav-submenu .nav-link {
    padding: 0.5rem 1rem 0.5rem 2rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    border-left: 2px solid transparent;
}

.sidebar .nav-submenu .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.sidebar .nav-submenu .nav-link.active {
    color: #fff;
    background-color: rgba(13, 110, 253, 0.2);
    border-left-color: var(--primary-color);
}

/* Ensure the main nav link in expandable sections doesn't get active styles when submenu is open */
.sidebar .nav-section .nav-link-main {
    cursor: pointer;
}

.sidebar .nav-section.expanded .nav-link-main {
    background-color: rgba(255, 255, 255, 0.05);
}

/* ============================
   Workflow Graph Styles
   ============================ */

/* Full-height observe page layout */
/* Account for: navbar (56px), main-content padding (1.5rem top + 1.5rem bottom), heading + margin (~3rem) */
.observe-fullheight {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--navbar-height) - 6rem);
    max-height: calc(100vh - var(--navbar-height) - 6rem);
    overflow: hidden;
}

.observe-workflow-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

.observe-workflow-card .card-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Cytoscape canvas container */
.workflow-graph-container {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.workflow-canvas {
    width: 100%;
    flex: 1;
    min-height: 400px;
    background: transparent;
    border-radius: 0;
    border: none;
}

/* Legend */
.workflow-legend {
    text-align: center;
}

.workflow-legend .badge {
    font-weight: normal;
    font-size: 0.75rem;
}

.workflow-legend .badge i {
    font-size: 0.5rem;
    vertical-align: middle;
}

/* Infrastructure row */
.workflow-infrastructure {
    border-top-color: #dee2e6 !important;
}

.workflow-infra-node {
    text-decoration: none;
    color: inherit;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.workflow-infra-node:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.workflow-infra-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 0.875rem;
    color: white;
    transition: transform 0.2s;
}

.workflow-infra-node:hover .workflow-infra-icon {
    transform: scale(1.1);
}

.workflow-infra-label {
    color: #6c757d;
}

.workflow-infra-status {
    font-size: 0.7rem;
}

/* Status colors */
.bg-healthy {
    background-color: var(--success-color);
}

.bg-degraded {
    background-color: var(--warning-color);
}

.bg-unhealthy {
    background-color: var(--danger-color);
}

.bg-unknown {
    background-color: #6c757d;
}

/* Pulse animation for degraded status */
.bg-degraded {
    animation: workflow-pulse-warning 2s infinite;
}

@keyframes workflow-pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Pulse animation for unhealthy status */
.bg-unhealthy {
    animation: workflow-pulse-danger 1s infinite;
}

@keyframes workflow-pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================
   MetricStat Component Styles
   ============================ */

.metric-stat {
    padding: 0.5rem;
}

.metric-stat-value {
    font-weight: bold;
    line-height: 1.2;
}

.metric-stat-unit {
    font-size: 0.6em;
    font-weight: normal;
    opacity: 0.8;
}

.metric-stat-label {
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Size variants */
.metric-stat-sm .metric-stat-value {
    font-size: 1.25rem;
}

.metric-stat-sm .metric-stat-label {
    font-size: 0.65rem;
}

.metric-stat-md .metric-stat-value {
    font-size: 1.75rem;
}

.metric-stat-md .metric-stat-label {
    font-size: 0.75rem;
}

.metric-stat-lg .metric-stat-value {
    font-size: 2.5rem;
}

.metric-stat-lg .metric-stat-label {
    font-size: 0.875rem;
}

/* ============================
   InfrastructureGrid Component Styles
   ============================ */

.infrastructure-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.infrastructure-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 60px;
}

.infrastructure-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.infrastructure-label {
    font-size: 0.7rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
