/* AegisOps Styles */
body {
    background-color: #f5f6f8;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navbar-brand strong {
    letter-spacing: 0.5px;
}

/* Keep role-switcher dropdown absolutely positioned at all breakpoints.
   Bootstrap sets .navbar-nav .dropdown-menu to position:static below lg,
   which causes the navbar to expand when the dropdown opens on split-screen. */
#role-switcher .dropdown-menu {
    position: absolute !important;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 2px solid #0d6efd;
}

#view-login .card {
    border-top: 3px solid #0d6efd;
}

/* Badges */
.badge-role {
    font-size: 0.8rem;
    margin: 2px;
}

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #6c757d;
}

.table-hover tbody tr[data-id] {
    cursor: pointer;
}

/* Sidebar */
.sidebar-nav {
    position: sticky;
    top: 70px;
}

.sidebar-group-label {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-top: 0.5rem;
}

.sidebar-group-label:first-child {
    margin-top: 0;
}

.sidebar-nav .list-group-item {
    border: none;
    border-radius: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    color: #333;
}

.sidebar-nav .list-group-item:hover {
    background-color: #e9ecef;
}

.sidebar-nav .list-group-item.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Alert Container (toasts) */
.alert-container {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.alert-container .alert {
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Status colors for monitoring cards */
.status-card {
    border-left: 4px solid #dee2e6;
    transition: border-color 0.3s;
}

.status-card.status-active,
.status-card.status-healthy {
    border-left-color: #198754;
}

.status-card.status-degraded,
.status-card.status-maintenance {
    border-left-color: #ffc107;
}

.status-card.status-inactive,
.status-card.status-error {
    border-left-color: #dc3545;
}

/* Filter bar */
.filter-bar {
    background: #fff;
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-bar .form-select,
.filter-bar .form-control {
    font-size: 0.875rem;
}

/* Detail view */
.detail-label {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Action buttons row */
.action-bar {
    padding: 0.75rem 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar-nav {
        position: static;
        margin-bottom: 1rem;
        max-height: 220px;
        overflow-y: auto;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        background: #fff;
    }

    .alert-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }

    /* Let tables scroll horizontally instead of clipping on narrow viewports. */
    .card-body > table,
    .card-body > .table-responsive,
    #content-area table.table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Dashboard / page header tightening */
    h4 { font-size: 1.15rem; }
    h5 { font-size: 1.05rem; }
    h6 { font-size: 0.95rem; }
    .card-body { padding: 0.75rem; }
    .navbar-brand { font-size: 0.95rem; }
    .navbar-brand small { display: none; }

    /* Hide the in-nav search below md — reachable via /search */
    #nav-search-form { display: none !important; }

    /* Gantt / timeline: force horizontal scroll inside a fixed-height viewport */
    .gantt-canvas,
    .pt-container {
        overflow-x: auto;
    }

    /* Stack filter bars */
    .filter-bar .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 480px) {
    body { font-size: 0.9rem; }
    .btn { padding: 0.3rem 0.5rem; font-size: 0.85rem; }
    .table th, .table td { padding: 0.4rem; font-size: 0.8rem; }
}

/* Pass Timeline ribbon */
.pt-container {
    position: relative;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.pt-axis {
    position: relative;
    height: 22px;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
    margin-left: 160px;
}

.pt-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: #6c757d;
    white-space: nowrap;
}

.pt-now {
    position: absolute;
    top: 0.75rem;
    bottom: 2.5rem;
    width: 2px;
    background: #dc3545;
    z-index: 5;
    pointer-events: none;
}

.pt-now::before {
    content: "now";
    position: absolute;
    top: -1.1rem;
    left: -1.1rem;
    font-size: 0.65rem;
    color: #dc3545;
    background: #fff;
    padding: 0 3px;
    border-radius: 2px;
    border: 1px solid #dc3545;
}

.pt-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.pt-lane-label {
    width: 160px;
    flex: 0 0 160px;
    font-size: 0.85rem;
    padding-right: 0.5rem;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pt-lane {
    position: relative;
    flex: 1 1 auto;
    height: 24px;
    background: repeating-linear-gradient(90deg, #f8f9fa 0, #f8f9fa 49px, #eceff3 49px, #eceff3 50px);
    border-radius: 3px;
}

.pt-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: transform 0.1s;
}

.pt-bar:hover { transform: scale(1.02); z-index: 2; }

.pt-bar-label {
    color: #fff;
    font-size: 0.7rem;
    padding: 0 4px;
    line-height: 20px;
    white-space: nowrap;
    overflow: hidden;
}

.pt-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 3px;
}

/* Print report (Reports view + Shift Briefing) */
@media print {
    .print-report table { page-break-inside: avoid; }
    #sidebar, .navbar, .no-print { display: none !important; }
    #content-area { width: 100% !important; }
}

/* Extra-small button (Bootstrap 5 removed btn-xs) */
.btn-xs {
    padding: 0.1rem 0.35rem;
    font-size: 0.75rem;
    line-height: 1.4;
    border-radius: 0.2rem;
}

/* JSON/code display */
.json-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #198754;
    margin-right: 4px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Help & Docs */
.help-content {
    font-size: 0.92rem;
    line-height: 1.6;
}

.help-content h5 {
    color: #0d6efd;
    margin-bottom: 0.75rem;
}

.help-content h6 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.help-content dl dt {
    font-weight: 600;
    color: #495057;
}

.help-content code {
    background: #f0f0f0;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Use Cases */
.uc-item {
    border-left: 3px solid transparent;
    transition: border-color 0.2s;
}

.uc-item:hover {
    border-left-color: #0d6efd;
}

.uc-item.active {
    border-left-color: #0d6efd;
    background-color: #e7f1ff;
}

.uc-steps li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.uc-req-badge {
    cursor: pointer;
    transition: background-color 0.15s;
}

.uc-req-badge:hover {
    background-color: #e2e6ea !important;
}

#help-tabs {
    scrollbar-width: thin;
}

#help-tabs .nav-link {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.bg-purple {
    background-color: #6f42c1 !important;
    color: #fff;
}

/* Guide placeholder cards */
.guide-preview-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.guide-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Compliance tabs */
#compliance-tabs .nav-link {
    font-size: 0.875rem;
}

#compliance-content .progress {
    border-radius: 6px;
}

#compliance-content .sticky-top th {
    z-index: 1;
}
