@import url('inter.css');

/* Global Font Override */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #334155;
    background-color: #f8fafc;
}

/* Header Styles */
.header-bar {
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0 !important;
    flex-shrink: 0;
}

/* Footer Styles */
.app-footer {
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0 !important;
    flex-shrink: 0;
}

/* Sidebar Styles */
.sidebar {
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0 !important;
}

@media (min-width: 992px) {
    .sidebar {
        width: 250px;
        position: sticky;
        top: 0;
        align-self: flex-start;
        max-height: calc(100vh - 45px);
        overflow-y: auto;
        flex-shrink: 0;
    }
}

/* Override white text classes for light sidebar */
.sidebar.text-white {
    color: #475569 !important;
}

.sidebar .text-white {
    color: #475569 !important;
}

.sidebar .text-white-50 {
    color: #64748b !important;
}

.sidebar .border-secondary {
    border-color: #e2e8f0 !important;
}

.main-content {
    min-height: 100vh;
    background-color: #f8fafc;
}

/* Navigation section headers */
.nav-section-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155 !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-section-header:hover {
    background-color: #f1f5f9;
    color: #0f172a !important;
}

/* Chevron rotation for collapse */
.nav-section-header[aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

.nav-section-header .bi-chevron-down {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: #64748b;
}

/* Nav links */
.sidebar .nav-link {
    font-size: 0.85rem;
    border-radius: 6px;
    color: #475569 !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link:hover:not(.disabled) {
    background-color: #f1f5f9;
    color: #0f172a !important;
}

.sidebar .nav-link.active,
.sidebar .nav-section-header.active {
    background-color: rgba(13, 110, 253, 0.08) !important;
    color: #0d6efd !important;
    font-weight: 600;
}

.sidebar .nav-link.active i,
.sidebar .nav-section-header.active i {
    color: #0d6efd !important;
}

/* Disabled links */
.sidebar .nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cursor pointer for clickable table rows */
.cursor-pointer {
    cursor: pointer;
}

/* Card Overrides (Softer borders and shadows) */
.card {
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background-color: #ffffff;
}

.card.border-dark-subtle {
    border-color: #e2e8f0 !important;
}

.card.border-2 {
    border-width: 1px !important;
}

.card.shadow {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05) !important;
}

.card-header.bg-primary-subtle {
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-top-left-radius: 11px !important;
    border-top-right-radius: 11px !important;
    color: #1e293b;
}

/* Card hover effect for clickable cards */
.card-hover {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
}

/* Keyboard-navigable search result cards */
.result-card-link:focus { outline: none; }

.result-card-link:focus-visible .card-hover {
    transform: translateY(-2px);
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* Markdown body - compact typography for rendered markdown content (reports) */
.markdown-body {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #334155;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
    line-height: 1.3;
    color: #1e293b;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
    margin-top: 0;
}

.markdown-body h1 {
    font-size: 1.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid #e2e8f0;
}

.markdown-body h2 {
    font-size: 1.15rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #e2e8f0;
}

.markdown-body h3 {
    font-size: 1rem;
}

.markdown-body h4 {
    font-size: 0.925rem;
}

.markdown-body h5,
.markdown-body h6 {
    font-size: 0.875rem;
    color: #64748b;
}

.markdown-body p {
    margin-bottom: 0.65rem;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.65rem;
}

.markdown-body li {
    margin-bottom: 0.2rem;
}

/* Markdown table styling (Sleek Spreadsheet Look) */
.markdown-body table {
    width: 100%;
    margin-bottom: 1.5rem;
    border-collapse: collapse;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.markdown-body table th,
.markdown-body table td {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.markdown-body table thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}

.markdown-body table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.markdown-body table tbody tr:hover {
    background-color: #f1f5f9;
}

/* Global Table Overrides */
.table {
    --bs-table-border-color: #e2e8f0 !important;
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #64748b;
    background-color: #f8fafc !important;
    padding: 0.75rem 1rem !important;
    border-bottom: 2px solid #e2e8f0 !important;
}

.table td {
    padding: 0.75rem 1rem !important;
    vertical-align: middle;
}

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

.table-hover tbody tr:hover {
    background-color: #f1f5f9 !important;
}

/* Code Snippet Styles */
.markdown-body pre,
pre {
    padding: 1rem 1.25rem;
    background-color: #f8fafc !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.markdown-body pre code,
pre code {
    padding: 0;
    background-color: transparent !important;
    border-radius: 0;
    font-size: 0.875rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    color: #1e293b !important;
}

.markdown-body code,
code {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.85em !important;
    background-color: #f1f5f9 !important;
    border-radius: 4px !important;
    color: #0f172a !important;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.markdown-body blockquote {
    padding: 0.4rem 0.85rem;
    margin-bottom: 0.65rem;
    border-left: 4px solid #0d6efd;
    color: #64748b;
    background-color: #f8fafc;
    border-radius: 0 6px 6px 0;
}

.markdown-body hr {
    border-color: #e2e8f0;
    margin: 1rem 0;
}

.markdown-body a {
    color: #0d6efd;
}

.markdown-body a:hover {
    color: #0b5ed7;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
}

/* Modern Badge Styling (Soft colors) */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 4px;
}

.badge.bg-success {
    background-color: #dcfce7 !important;
    color: #15803d !important;
}

.badge.bg-danger {
    background-color: #fee2e2 !important;
    color: #b91c1c !important;
}

.badge.bg-warning {
    background-color: #fef9c3 !important;
    color: #a16207 !important;
}

.badge.bg-info {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
}

.badge.bg-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Global Search Modal */
.gsearch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.gsearch-card {
    width: 100%;
    max-width: 600px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.gsearch-results {
    overflow-y: auto;
    flex: 1;
}

.gsearch-result-item.active {
    background-color: rgba(13, 110, 253, 0.08) !important;
    border-left: 3px solid #0d6efd;
}

.gsearch-group-header:hover {
    background-color: #f1f5f9;
    color: #0f172a !important;
}

.gsearch-group:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

@keyframes gsearch-debounce {
    from { width: 0%; }
    to { width: 100%; }
}

.gsearch-debounce-bar {
    height: 2px;
    background: #0d6efd;
    animation: gsearch-debounce 300ms linear forwards;
}

/* Flash highlight when a card is freshly mounted */
@keyframes flash-on-load {
    0%   { box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.55); }
    60%  { box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25); }
    100% { box-shadow: 0 0 0 0   rgba(13, 110, 253, 0);    }
}

.flash-on-load {
    animation: flash-on-load 900ms ease-out 1;
}

/* Mobile responsive adjustments */
@media (max-width: 575.98px) {
    .gsearch-overlay {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    #nav-conn-status {
        display: none !important;
    }
}

/* Sleek Keyboard shortcuts bar */
.keyboard-shortcuts-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.keyboard-shortcuts-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    border-right: 1px solid #e2e8f0;
    padding-right: 0.75rem;
    margin-right: 0.25rem;
    height: 1.2rem;
    white-space: nowrap;
}

.keyboard-shortcuts-items {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: #64748b;
    font-size: 0.8rem;
}

.keyboard-shortcuts-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.keyboard-shortcuts-items span.separator {
    color: #cbd5e1;
    opacity: 0.5;
    font-weight: 300;
}

/* Sleek Keyboard Key (kbd) styling */
kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    border-bottom: 2px solid #94a3b8;
    border-radius: 5px;
    padding: 0.12rem 0.35rem;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.725rem;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04), inset 0 1px 0 #ffffff;
    vertical-align: middle;
}

/* Animation for alerting warning icons */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    display: inline-block;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .4;
    }
}

/* Responsive border utilities */
@media (min-width: 992px) {
    .border-end-lg {
        border-right: 1px solid #e2e8f0 !important;
    }
}
