/* ========================================
   ROOT VARIABLES
   ======================================== */
:root {
    --split-left: 46%;
    --edge-pad: 4px;
    --redlist-primary: #be302a;
    --redlist-primary-hover: #a02823;
    --redlist-primary-light: rgba(190, 48, 42, 0.1);
    --redlist-gray: #999999;
    --redlist-black: #000000;
}

@media (min-width: 1400px) {
    :root { --edge-pad: 6px; }
}

/* ========================================
   BASE STYLES
   ======================================== */
body {
    overflow-x: hidden;
}

body.waiting * {
    cursor: progress;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

.mono {
    font-family: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    font-size: 0.9em;
}

.table-sm {
    font-size: 12px;
}

thead input {
    width: 100%;
}

.borderless > thead > tr > th,
.borderless > tbody > tr > th,
.borderless > tfoot > tr > th,
.borderless > thead > tr > td,
.borderless > tbody > tr > td,
.borderless > tfoot > tr > td {
    border-top: none;
}

.dt-control {
    cursor: pointer;
}

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

.schema-xml {
    display: none;
}

.top10-click tbody tr {
    cursor: pointer;
}

/* ========================================
   LAYOUT
   ======================================== */
.navbar, .navbar .container-fluid, .container-fluid {
    padding-left: var(--edge-pad) !important;
    padding-right: var(--edge-pad) !important;
}

.app-container {
    display: flex;
    padding-top: 4rem;
    min-height: 100vh;
}

.content-wrapper {
    flex-grow: 1;
    padding: 1rem;
    overflow-y: auto;
    width: 100%;
}

.content-page {
    display: none;
}

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

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: 250px;
    transition: margin-left 0.3s ease;
    background-color: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.sidebar.collapsed {
    margin-left: -190px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    color: var(--bs-body-color);
}

.sidebar.collapsed .nav-link .link-text {
    opacity: 0;
}

.sidebar .nav-link .fa-fw {
    font-size: 1.25rem;
    width: 40px;
    text-align: center;
}

/* ========================================
   SPLIT PANE
   ======================================== */
.split {
    display: grid;
    grid-template-columns: clamp(280px, var(--split-left, 46%), calc(100% - 320px)) 8px minmax(320px, 1fr);
    gap: 0;
    column-gap: .75rem;
    align-items: stretch;
    height: calc(100vh - 6rem);
}

.split .gutter {
    width: 8px;
    cursor: col-resize;
    padding: 0 6px;
    margin: 0 -6px;
    background: var(--bs-border-color);
    background-clip: content-box;
    border-radius: 999px;
    position: relative;
    touch-action: none;
}

.split .gutter::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, var(--bs-border-color), transparent);
    opacity: .4;
    pointer-events: none;
    border-radius: 999px;
}

/* Ensure left and right panels fill height */
.split > .left,
.split > .right {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Make cards fill their container */
.split .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Ensure card-body fills and allows scrolling */
.split .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Tab content should fill remaining space */
.split .tab-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Each tab pane should fill and handle its own scrolling */
.split .tab-pane {
    height: 100%;
    overflow: auto;
}

@media (max-width: 992px) {
    .split {
        grid-template-columns: 1fr;
    }
    .split .gutter {
        display: none;
    }
}

/* ========================================
   TRANSACTION VIEW PANES
   ======================================== */
#tx-json-pre, #tx-hex-pre {
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    max-height: calc(100vh - 18rem);
    overflow-y: auto;
    margin: 0;
}

#tx-string-pane {
    max-height: calc(100vh - 18rem);
    overflow: auto;
}

#xml-code, #poslog-code {
    display: block;
    padding: 1rem;
    overflow-x: auto;
    background: transparent;
}

/* ========================================
   TRANSACTION TABLE (#txTable)
   ======================================== */
#txTable {
    font-size: 0.9375rem; /* 15px */
    border: none;
}

#txTable thead th {
    border-bottom: 2px solid var(--bs-border-color);
    padding: 0.6rem 0.6rem;
    font-weight: 600;
    background: var(--bs-tertiary-bg);
    vertical-align: middle;
}

#txTable tbody td {
    padding: 0.85rem 0.6rem;
    border-bottom: 1px solid var(--bs-border-color-translucent, #e9ecef);
    vertical-align: middle;
    line-height: 1.4;
}

#txTable tbody tr {
    transition: background-color 0.15s ease;
}

#txTable tbody tr:hover {
    background-color: var(--bs-tertiary-bg) !important;
}
/* replaced with new code below
#txTable tbody tr.row-selected {
    background-color: var(--redlist-primary-light) !important;
    border-left: 3px solid var(--redlist-primary);
}
*/
#txTable tbody tr.table-primary {
    background-color: var(--bs-primary-bg-subtle) !important;
}

/*
#txTable tbody tr.table-primary.row-selected {
    background-color: var(--redlist-primary) !important;
    color: white;
}
*/

#txTable tbody tr:hover .row-actions-btn {
    opacity: 1;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] #txTable tbody td {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] #txTable tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* ========================================
   TABLE CONTROLS & CHECKBOXES
   ======================================== */
.row-checkbox, #headerCheckbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

#headerCheckbox:indeterminate {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.row-actions-btn {
    padding: 4px 8px;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.row-actions-btn:hover {
    opacity: 1;
}

/* ========================================
   SORTABLE HEADERS
   ======================================== */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px !important;
    transition: background-color 0.15s ease;
}

.sortable-header:hover {
    background-color: var(--bs-secondary-bg);
}

.sortable-header::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 0.85em;
}

.sortable-header.sort-asc::after {
    content: '▲';
    opacity: 1;
    color: var(--redlist-primary);
}

.sortable-header.sort-desc::after {
    content: '▼';
    opacity: 1;
    color: var(--redlist-primary);
}

/* ========================================
   SELECTION TOOLBAR
   ======================================== */
.selection-toolbar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bs-primary-bg-subtle);
    border: 1px solid var(--bs-primary);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.selection-toolbar.active {
    display: flex;
}

.selection-toolbar .badge {
    background-color: var(--redlist-primary);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* ========================================
   CONTEXT MENU
   ======================================== */
.context-menu {
    position: fixed;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    z-index: 9999;
    padding: 0.25rem 0;
    min-width: 180px;
    display: none;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bs-body-color);
    text-decoration: none;
}

.context-menu-item:hover {
    background: var(--bs-tertiary-bg);
}

.context-menu-divider {
    height: 1px;
    background: var(--bs-border-color);
    margin: 0.25rem 0;
}

/* ========================================
   DEPARTMENT SIDEBAR
   ======================================== */
.dept-sidebar {
    position: fixed;
    right: 0;
    top: 56px;
    width: 400px;
    height: calc(100vh - 56px);
    background: var(--bs-body-bg);
    border-left: 1px solid var(--bs-border-color);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.dept-sidebar.open {
    transform: translateX(0);
}

.dept-toggle-btn {
    position: fixed;
    right: 10px;
    top: 70px;
    z-index: 999;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.dept-stat-card {
    background: var(--bs-tertiary-bg);
    border-radius: 0.5rem;
    padding: 12px;
    margin-bottom: 12px;
}

.dept-stat-label {
    font-size: 11px;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dept-stat-value {
    font-size: 20px;
    font-weight: 700;
}

/* ========================================
   DEPARTMENT TABLE SIDEBAR
   ======================================== */
.dept-table-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 560px;
    max-width: 90vw;
    height: 100%;
    background-color: var(--bs-body-bg);
    z-index: 1040;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--bs-border-color);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
}

.dept-table-sidebar.open {
    transform: translateX(0);
}

.dept-table-sidebar .sidebar-body {
    flex-grow: 1;
    overflow-y: auto;
}

.dept-table-sidebar .sortable-table {
    width: 100%;
    font-size: 14px;
}

.dept-table-sidebar .sortable-table th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

.dept-table-sidebar .sortable-table th::after {
    content: '\f0dc';
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: #ccc;
}

.dept-table-sidebar .sortable-table th.sort-asc::after {
    content: '\f0de';
    color: var(--bs-primary);
}

.dept-table-sidebar .sortable-table th.sort-desc::after {
    content: '\f0dd';
    color: var(--bs-primary);
}

/* Operator table sidebar - wider version */
.oper-table-sidebar.sidebar.open {
    width: 800px;
}

.oper-table-sidebar .table .mono {
    white-space: nowrap;
}

/* ========================================
   TREEMAP
   ======================================== */
.treemap-container {
    width: 100%;
    height: 400px;
    position: relative;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.treemap-container svg {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 11px;
}

.treemap-container .tile rect {
    stroke: #fff;
    stroke-width: 1px;
}

.treemap-container .tile text {
    fill: #fff;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.treemap-container .tile-label {
    font-weight: 600;
}

.treemap-container .tile-value {
    font-size: 10px;
    opacity: 0.9;
}

.treemap-item {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px;
    font-size: 11px;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: opacity 0.2s;
    overflow: hidden;
}

.treemap-item:hover {
    opacity: 0.9;
    outline: 2px solid white;
    z-index: 10;
}

.treemap-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.treemap-value {
    font-size: 10px;
    opacity: 0.9;
}

.treemap-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 1050;
}

/* ========================================
   BAR CHARTS
   ======================================== */
.bar-chart {
    width: 100%;
}

.bar-chart-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.bar-label {
    min-width: 140px;
    font-size: 12px;
    font-family: monospace;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--bs-tertiary-bg);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #999, #666);
    border-radius: 4px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    padding-left: 8px;
}

.bar-value {
    font-size: 12px;
    font-family: monospace;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

/* Stats microbars / sparklines */
.bar {
    height: .6rem;
    background: var(--bs-primary);
    opacity: .25;
    border-radius: .25rem;
    position: relative;
    overflow: hidden;
}

.bar > i {
    display: block;
    height: 100%;
    background: var(--bs-primary);
    border-radius: .25rem;
}

.spark {
    display: grid;
    grid-auto-flow: column;
    gap: 2px;
    align-items: end;
    height: 40px;
}

.spark > i {
    display: block;
    width: 6px;
    background: var(--bs-primary);
    opacity: .4;
    border-radius: 2px 2px 0 0;
}

/* ========================================
   UPLOAD PAGE
   ======================================== */
.upload-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.upload-page.hidden {
    display: none;
}

.upload-card {
    background: white;
    border: 1px solid rgba(190, 48, 42, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 90%;
    text-align: center;
}

.upload-logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.8s ease-out;
}

.upload-page-logo {
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.1));
}

.upload-title {
    color: var(--redlist-primary);
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.upload-subtitle {
    color: var(--redlist-gray);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.file-upload-area {
    border: 2px dashed rgba(190, 48, 42, 0.3);
    background: var(--redlist-primary-light);
    border-radius: 15px;
    padding: 40px 20px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: var(--redlist-primary);
    background: rgba(190, 48, 42, 0.15);
    transform: translateY(-2px);
}

.file-upload-area.dragover {
    border-color: var(--redlist-primary);
    background: rgba(190, 48, 42, 0.2);
    box-shadow: 0 8px 24px rgba(190, 48, 42, 0.2);
}

.upload-icon {
    font-size: 4rem;
    color: var(--redlist-primary);
    opacity: 0.8;
}

.upload-text {
    color: var(--redlist-primary);
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.upload-hint {
    color: var(--redlist-gray);
    font-size: 0.9rem;
}

.file-input-spa {
    display: none;
}

.selected-file-spa {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.selected-file-spa.show {
    display: block;
}

.file-info-spa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.file-name-spa {
    font-weight: 600;
    color: #4a5568;
}

.file-size-spa {
    color: #718096;
    font-size: 0.9rem;
}

.parse-button-spa {
    background: linear-gradient(135deg, var(--redlist-primary) 0%, #a02823 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(190, 48, 42, 0.3);
}

.parse-button-spa:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(190, 48, 42, 0.4);
}

.parse-button-spa:active:not(:disabled) {
    transform: translateY(0);
}

.parse-button-spa:disabled {
    background: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

.progress-container-spa {
    width: 100%;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 20px;
    display: none;
}

.progress-container-spa.show {
    display: block;
}

.progress-bar-spa {
    height: 8px;
    background: linear-gradient(90deg, var(--redlist-primary) 0%, #d63a33 100%);
    box-shadow: 0 0 10px rgba(190, 48, 42, 0.5);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text-spa {
    text-align: center;
    margin-top: 10px;
    color: #4a5568;
    font-size: 0.9rem;
}

.main-content {
    transition: opacity 0.3s ease;
}

.main-content.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ========================================
   BUTTONS
   ======================================== */
.new-file-btn {
    background: var(--redlist-primary);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(190, 48, 42, 0.3);
    font-size: 0.9rem;
}

.new-file-btn:hover {
    background: var(--redlist-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(190, 48, 42, 0.4);
}

.new-file-btn:active {
    transform: translateY(0);
}

.btn-outline-primary {
    color: var(--redlist-primary);
    border-color: var(--redlist-primary);
}

.btn-outline-primary:hover {
    background-color: var(--redlist-primary);
    border-color: var(--redlist-primary);
    color: white;
}

/* ========================================
   NAVBAR & LOGOS
   ======================================== */
#navbarLogo {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: opacity 0.3s ease;
}

/* ========================================
   REDLIST BRAND COLORS
   ======================================== */
.badge.bg-primary {
    background-color: var(--redlist-primary) !important;
}

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

.table-primary {
    --bs-table-bg: var(--redlist-primary-light);
    --bs-table-border-color: rgba(190, 48, 42, 0.2);
}
/*
.row-selected {
    background-color: var(--redlist-primary-light) !important;
    border-left: 3px solid var(--redlist-primary);
}
*/

/* ========================================
   EXPORT MODAL
   ======================================== */
.export-step-item {
    flex: 1;
    text-align: center;
    padding: 10px;
    opacity: 0.5;
}

.export-step-item.active {
    opacity: 1;
}

.export-step-item.completed {
    opacity: 1;
}

.export-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bs-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: bold;
}

.export-step-item.active .export-step-number {
    background: var(--redlist-primary);
}

.export-step-item.completed .export-step-number {
    background: #4CAF50;
}

.export-step-label {
    font-size: 14px;
    font-weight: 500;
}

.export-step-content {
    display: none;
}

.export-step-content.active {
    display: block;
}

.export-format-card,
.export-datatype-card {
    border: 2px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.export-format-card:hover,
.export-datatype-card:hover {
    border-color: var(--redlist-primary);
    background: var(--redlist-primary-light);
}

.export-format-card.selected,
.export-datatype-card.selected {
    border-color: var(--redlist-primary);
    background: var(--redlist-primary-light);
}

.export-format-card.disabled,
.export-datatype-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.export-format-card i {
    color: var(--redlist-primary);
}

.export-tender-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--redlist-primary);
    color: white;
    border-radius: 16px;
    font-size: 14px;
}

.export-tender-tag .remove {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
}

/* ========================================
   FIELD SEARCH
   ======================================== */
.field-search-container {
    background: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 12px;
    margin-bottom: 12px;
}

.search-criterion-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0d6efd;
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.875rem;
    margin: 4px;
}

.search-criterion-chip .remove-chip {
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}

.search-criterion-chip .remove-chip:hover {
    background: rgba(255,255,255,0.5);
}

.string-row-highlighted {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.field-match-badge {
    background: #ffc107;
    color: #000;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* ========================================
   STRING TABLE
   ======================================== */
#stringsTableBody tr[style*="color"] {
    color: inherit !important;
}

#stringsTableBody tr[style*="color"] td {
    color: inherit !important;
}

/* ========================================
   WELCOME SPLASH MODAL
   ======================================== */
#welcomeSplashModal .modal-content {
    border-radius: 12px;
    overflow: hidden;
}

#welcomeSplashModal .modal-header {
    background: linear-gradient(135deg, var(--redlist-primary) 0%, #8e1e1a 100%);
}

#welcomeSplashModal .card {
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 8px;
}

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

/* ========================================
   MISC UTILITIES
   ======================================== */
#dropZone {
    border: 2px dashed var(--bs-border-color);
    border-radius: .75rem;
    padding: 2rem;
    text-align: center;
}

#dropZone.dragover {
    background: var(--bs-body-bg);
    filter: brightness(0.97);
}

#item-download-csv-btn i {
    vertical-align: -0.125em;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.badge.bg-success {
    animation: pulse 2s ease-in-out infinite;
}

/* ========================================
   DARK MODE OVERRIDES
   ======================================== */
[data-bs-theme="dark"] .upload-page {
    background: linear-gradient(135deg, #1a1d20 0%, #2d3236 100%);
}

[data-bs-theme="dark"] .upload-card {
    background: #2d3236;
    border: 1px solid rgba(190, 48, 42, 0.2);
}

[data-bs-theme="dark"] .upload-title {
    color: #e74c46;
}

[data-bs-theme="dark"] .upload-icon {
    color: #e74c46;
}

[data-bs-theme="dark"] .upload-text {
    color: #e74c46;
}

[data-bs-theme="dark"] .file-upload-area {
    background: rgba(190, 48, 42, 0.15);
    border-color: rgba(190, 48, 42, 0.4);
}

[data-bs-theme="dark"] .file-upload-area:hover {
    background: rgba(190, 48, 42, 0.25);
    border-color: #e74c46;
}

/*
replaced with code below
[data-bs-theme="dark"] .row-selected {
    background-color: rgba(190, 48, 42, 0.2) !important;
    border-left-color: #e74c46;
}
*/

/* ========================================
   FIELD SEARCH PANEL (BUTTON STYLE)
   ======================================== */
.field-search-container {
    animation: slideDown 0.3s ease;
}

.field-search-container .card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Highlight the search button when panel is open */
#fieldSearchBtn.active {
    background-color: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Table header styling for better readability */
.table thead.table-secondary {
    background-color: var(--bs-secondary-bg);
    border-bottom: 2px solid var(--bs-border-color);
}

.table thead.table-secondary th {
    font-weight: 600;
    padding: 0.75rem 0.5rem;
}

/* ========================================
   PAGINATION BUTTONS - STYLE 5 (ELEVATED CARD)
   ======================================== */
#pagerGroup {
    gap: 8px;
}

#pagerGroup .btn {
    border: none;
    background: white;
    padding: 10px 18px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    transition: all 0.3s ease;
    color: #495057;
}

#pagerGroup .btn:hover:not(:disabled) {
    background: var(--redlist-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(190, 48, 42, 0.3);
    transform: translateY(-3px);
}

#pagerGroup .btn:active:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(190, 48, 42, 0.3);
}

#pagerGroup .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#pagerGroup .btn i {
    font-size: 0.9em;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] #pagerGroup .btn {
    background: #2d3236;
    color: #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] #pagerGroup .btn:hover:not(:disabled) {
    background: var(--redlist-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(190, 48, 42, 0.4);
}

[data-bs-theme="dark"] #pagerGroup .btn:disabled {
    background: #1a1d20;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
/* ========================================
   PAGINATION CONTAINER SPACING FIX
   ======================================== */
.card-body > .d-flex.justify-content-between.align-items-center {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    padding-right: 8px; /* Keeps Last button away from scrollbar */
}

/* Extra spacing above pagination row */
#pageInfo {
    padding-right: 12px;
}

#pagerGroup {
    margin-right: 4px; /* Additional buffer from edge */
}

/* Add margin above the rows-per-page selector */
.card-body > .d-flex.align-items-center.gap-2 {
    margin-top: 0.75rem;
}

/* ========================================
   SELECTED ROW TEXT FIX - FINAL
   ======================================== */

/* Light mode - selected row */
#txTable tbody tr.row-selected {
    background-color: var(--redlist-primary-light) !important;
    border-left: 3px solid var(--redlist-primary) !important;
    color: #212529 !important;
}

#txTable tbody tr.row-selected td {
    color: #212529 !important;
}

/* Light mode - hover on selected row */
#txTable tbody tr.row-selected:hover {
    background-color: rgba(190, 48, 42, 0.25) !important;
    color: #212529 !important;
}

#txTable tbody tr.row-selected:hover td {
    color: #212529 !important;
}

/* Dark mode - selected row with WHITE TEXT */
[data-bs-theme="dark"] #txTable tbody tr.row-selected {
    background-color: rgba(190, 48, 42, 0.45) !important;
    border-left: 3px solid #e74c46 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #txTable tbody tr.row-selected td {
    color: #ffffff !important;
}

/* Dark mode - hover on selected row keeps WHITE TEXT */
[data-bs-theme="dark"] #txTable tbody tr.row-selected:hover {
    background-color: rgba(190, 48, 42, 0.65) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #txTable tbody tr.row-selected:hover td {
    color: #ffffff !important;
}

/* Fix for table-primary rows */
#txTable tbody tr.table-primary.row-selected {
    background-color: rgba(190, 48, 42, 0.3) !important;
    color: #212529 !important;
}

#txTable tbody tr.table-primary.row-selected td {
    color: #212529 !important;
}

[data-bs-theme="dark"] #txTable tbody tr.table-primary.row-selected {
    background-color: rgba(190, 48, 42, 0.5) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #txTable tbody tr.table-primary.row-selected td {
    color: #ffffff !important;
}

/* Checkbox visibility */
#txTable tbody tr.row-selected .row-checkbox {
    filter: contrast(1.2);
}

[data-bs-theme="dark"] #txTable tbody tr.row-selected .row-checkbox {
    filter: brightness(1.4) contrast(1.3);
}

/* ========================================
   FIX FOR table-primary CLASS (ACTUAL SELECTION CLASS)
   ======================================== */

/* Light mode - table-primary rows IN TRANSACTION TABLE ONLY */
#txTable tbody tr.table-primary {
    background-color: var(--redlist-primary-light) !important;
    border-left: 3px solid var(--redlist-primary) !important;
    color: #212529 !important;
}

#txTable tbody tr.table-primary td {
    color: #212529 !important;
}

/* Light mode - hover on table-primary row */
#txTable tbody tr.table-primary:hover {
    background-color: rgba(190, 48, 42, 0.25) !important;
    color: #212529 !important;
}

#txTable tbody tr.table-primary:hover td {
    color: #212529 !important;
}

/* Dark mode - table-primary row with WHITE TEXT */
[data-bs-theme="dark"] #txTable tbody tr.table-primary {
    background-color: rgba(190, 48, 42, 0.45) !important;
    border-left: 3px solid #e74c46 !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #txTable tbody tr.table-primary td {
    color: #ffffff !important;
}

/* Dark mode - hover on table-primary row keeps WHITE TEXT */
[data-bs-theme="dark"] #txTable tbody tr.table-primary:hover {
    background-color: rgba(190, 48, 42, 0.65) !important;
    color: #ffffff !important;
}

[data-bs-theme="dark"] #txTable tbody tr.table-primary:hover td {
    color: #ffffff !important;
}

/* Checkbox visibility on table-primary rows */
#txTable tbody tr.table-primary .row-checkbox {
    filter: contrast(1.2);
}

[data-bs-theme="dark"] #txTable tbody tr.table-primary .row-checkbox {
    filter: brightness(1.4) contrast(1.3);
}
/* ========================================
   WELCOME MODAL DARK MODE FIX
   ======================================== */

/* Ensure modal cards have proper dark mode styling */
[data-bs-theme="dark"] #welcomeSplashModal .card {
    background-color: #2d3236 !important;
    color: #e9ecef !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .card-body {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .card-text {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .card-title {
    color: #ffffff !important;
}

/* Special styling for the green "NEW AI FEATURE" card */
[data-bs-theme="dark"] #welcomeSplashModal .card.border-success {
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%) !important;
    border-color: #66bb6a !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .card.border-success .card-body {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .card.border-success .card-text {
    color: #e9ecef !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .badge {
    background-color: #66bb6a !important;
    color: #ffffff !important;
}

/* Pro Tips section styling */
[data-bs-theme="dark"] #welcomeSplashModal .bg-light {
    background-color: #343a40 !important;
}

[data-bs-theme="dark"] #welcomeSplashModal .bg-light h6,
[data-bs-theme="dark"] #welcomeSplashModal .bg-light ul,
[data-bs-theme="dark"] #welcomeSplashModal .bg-light li {
    color: #e9ecef !important;
}

/* Modal footer checkbox label */
[data-bs-theme="dark"] #welcomeSplashModal .form-check-label {
    color: #e9ecef !important;
}
/* ========================================
   LOGO DARK MODE - IMAGE SWAP
   ======================================== */

/* Hide dark logos by default, show light logos */
.logo-light {
    display: block !important;
}

.logo-dark {
    display: none !important;
}

/* In dark mode, hide light logos and show dark logos */
[data-bs-theme="dark"] .logo-light {
    display: none !important;
}

[data-bs-theme="dark"] .logo-dark {
    display: block !important;
}

/* Navbar logo margin */
#navbarLogo,
.navbar-brand img {
    margin-left: 8px;
}

/* Center logos on upload page and welcome modal */
.upload-logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.8s ease-out;
}

.upload-logo-container img {
    display: block;
    margin: 0 auto;
}

/* Center welcome modal logo if it exists */
#welcomeSplashModal .modal-header img {
    display: block;
    margin: 0 auto;
}

/* Subtle hover effects */
.logo-light,
.logo-dark,
.upload-page-logo {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.logo-light:hover,
.logo-dark:hover,
.upload-page-logo:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* ========================================
   SUCCESS MESSAGE IN WELCOME MODAL
   ======================================== */
#welcomeSplashModal .modal-body .lead {
    color: #22c55e;
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

[data-bs-theme="dark"] #welcomeSplashModal .modal-body .lead {
    color: #4ade80;
    text-shadow: 0 2px 8px rgba(74, 222, 128, 0.5);
}
/* AI Samples Page Styles */
.ai-response-content {
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    font-size: 0.95rem;
}

.sample-prompt-btn {
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.sample-prompt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sample-prompt-btn.active {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

#ai-prompt {
    font-family: inherit;
    transition: border-color 0.2s ease;
}

#ai-prompt:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Markdown-like styling for AI responses */
.ai-response-content h1,
.ai-response-content h2,
.ai-response-content h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.ai-response-content ul,
.ai-response-content ol {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.ai-response-content strong {
    font-weight: 600;
    color: var(--bs-emphasis-color);
}

.ai-response-content code {
    background-color: var(--bs-secondary-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
}

.ai-response-content p {
    margin-bottom: 0.75rem;
}

/* Loading spinner animation */
#ai-loading .spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

/* Smooth transitions for alerts */
.alert {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ========================================
   AI INSIGHTS LINK STYLING
   ======================================== */

/* Target the AI link specifically */
.sidebar .nav-link[data-page="ai"] .link-text {
    color: var(--redlist-primary);
    font-weight: 600;
}

/* When active, use white text */
.sidebar .nav-link[data-page="ai"].active .link-text {
    color: white;
}

/* Hover state - keep red but slightly darker */
.sidebar .nav-link[data-page="ai"]:hover:not(.active) .link-text {
    color: var(--redlist-primary-hover);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .sidebar .nav-link[data-page="ai"] .link-text {
    color: #e74c46;
}

[data-bs-theme="dark"] .sidebar .nav-link[data-page="ai"].active .link-text {
    color: white;
}

[data-bs-theme="dark"] .sidebar .nav-link[data-page="ai"]:hover:not(.active) .link-text {
    color: #ff5a54;
}
#salesHeatmapContainer {
    width: 100%;
    height: 400px; /* Adjust the height as needed */
}

/* Floating Clerk UserButton (top-right of the viewport) */
.clerk-userbutton-global {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 10050;          /* higher than .upload-page (9999) */
    display: flex;
    justify-content: flex-end;
    pointer-events: auto;
}

@media (max-width: 576px) {
    .clerk-userbutton-global {
        top: 8px;
        right: 8px;
    }
    
    /* Mobile-optimized upload page */
    .upload-card {
        padding: 30px 20px;
        width: 95%;
        border-radius: 15px;
    }
    
    .upload-title {
        font-size: 1.75rem;
    }
    
    .upload-subtitle {
        font-size: 0.95rem;
    }
    
    .upload-page-logo {
        max-width: 200px;
    }
    
    .file-upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .upload-privacy {
        font-size: 0.75rem !important;
    }
}

/* keep it sleek */
.cl-userButtonBox {
    border: none !important;
    box-shadow: none !important;
}

/* Wait cursor styles */
body.filtering,
body.filtering * {
    cursor: wait !important;
}

/* Exception: Keep normal cursor on the progress indicator */
#filteringProgressIndicator,
#filteringProgressIndicator * {
    cursor: default !important;
}

/* Smooth cursor transitions */
body {
    transition: cursor 0.1s ease;
}

/* ========================================
   RECENT FILES DROPDOWN
   Add this section to styles.css
   ======================================== */

/* Container */
.recent-files-container {
    margin-top: 24px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header (always visible when container is shown) */
.recent-files-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--redlist-primary-light);
    border: 2px solid rgba(190, 48, 42, 0.2);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.recent-files-header:hover {
    background: rgba(190, 48, 42, 0.15);
    border-color: var(--redlist-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(190, 48, 42, 0.2);
}

.recent-files-icon {
    font-size: 1.2rem;
}

.recent-files-title {
    font-weight: 600;
    color: var(--redlist-primary);
    font-size: 1rem;
}

.recent-files-count {
    color: var(--redlist-gray);
    font-size: 0.9rem;
}

.recent-files-toggle {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--redlist-primary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.recent-files-toggle i {
    transition: transform 0.3s ease;
}

.recent-files-header.expanded .recent-files-toggle i {
    transform: rotate(180deg);
}

/* Dropdown (expands below header) */
.recent-files-dropdown {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    background: white;
    border: 2px solid rgba(190, 48, 42, 0.2);
    border-top: none;
    border-radius: 0 0 10px 10px;
    margin-top: -2px;
}

.recent-files-dropdown.expanded {
    max-height: 500px;
    opacity: 1;
}

/* Search Box */
.recent-files-search {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(190, 48, 42, 0.1);
    position: relative;
}

.recent-files-search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid rgba(190, 48, 42, 0.3);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.recent-files-search-input:focus {
    outline: none;
    border-color: var(--redlist-primary);
    box-shadow: 0 0 0 3px rgba(190, 48, 42, 0.1);
}

.recent-files-search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--redlist-gray);
    font-size: 0.9rem;
    pointer-events: none;
}

/* Files List */
.recent-files-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
}

/* Custom Scrollbar */
.recent-files-list::-webkit-scrollbar {
    width: 8px;
}

.recent-files-list::-webkit-scrollbar-track {
    background: rgba(190, 48, 42, 0.05);
    border-radius: 4px;
}

.recent-files-list::-webkit-scrollbar-thumb {
    background: rgba(190, 48, 42, 0.3);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.recent-files-list::-webkit-scrollbar-thumb:hover {
    background: var(--redlist-primary);
}

/* Individual File Item */
.recent-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.recent-file-item:hover {
    background: var(--redlist-primary-light);
    border-color: rgba(190, 48, 42, 0.2);
    transform: translateX(2px);
}

.recent-file-item.hidden {
    display: none;
}

.recent-file-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.recent-file-info {
    flex: 1;
    min-width: 0;
}

.recent-file-name {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.95rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-file-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--redlist-gray);
    margin-top: 2px;
}

.recent-file-size,
.recent-file-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.recent-file-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--redlist-gray);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: all 0.2s ease;
}

.recent-file-item:hover .recent-file-remove {
    opacity: 1;
}

.recent-file-remove:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* Empty State */
.recent-files-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--redlist-gray);
}

.recent-files-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.recent-files-empty-text {
    font-size: 0.95rem;
}

/* Footer */
.recent-files-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(190, 48, 42, 0.1);
    text-align: center;
}

.recent-files-clear-all {
    background: none;
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.recent-files-clear-all:hover {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    transform: translateY(-1px);
}

/* ========================================
   DARK MODE STYLES
   ======================================== */

[data-bs-theme="dark"] .recent-files-header {
    background: rgba(190, 48, 42, 0.2);
    border-color: rgba(190, 48, 42, 0.3);
}

[data-bs-theme="dark"] .recent-files-header:hover {
    background: rgba(190, 48, 42, 0.3);
    border-color: #e74c46;
}

[data-bs-theme="dark"] .recent-files-title {
    color: #e74c46;
}

[data-bs-theme="dark"] .recent-files-count {
    color: #adb5bd;
}

[data-bs-theme="dark"] .recent-files-toggle {
    color: #e74c46;
}

[data-bs-theme="dark"] .recent-files-dropdown {
    background: #2d3236;
    border-color: rgba(190, 48, 42, 0.3);
}

[data-bs-theme="dark"] .recent-files-search {
    border-bottom-color: rgba(190, 48, 42, 0.2);
}

[data-bs-theme="dark"] .recent-files-search-input {
    background: #1a1d20;
    color: #e9ecef;
    border-color: rgba(190, 48, 42, 0.4);
}

[data-bs-theme="dark"] .recent-files-search-input:focus {
    border-color: #e74c46;
    box-shadow: 0 0 0 3px rgba(231, 76, 70, 0.2);
}

[data-bs-theme="dark"] .recent-files-search-icon {
    color: #adb5bd;
}

[data-bs-theme="dark"] .recent-files-list::-webkit-scrollbar-track {
    background: rgba(190, 48, 42, 0.1);
}

[data-bs-theme="dark"] .recent-files-list::-webkit-scrollbar-thumb {
    background: rgba(190, 48, 42, 0.4);
}

[data-bs-theme="dark"] .recent-files-list::-webkit-scrollbar-thumb:hover {
    background: #e74c46;
}

[data-bs-theme="dark"] .recent-file-item:hover {
    background: rgba(190, 48, 42, 0.2);
    border-color: rgba(190, 48, 42, 0.4);
}

[data-bs-theme="dark"] .recent-file-name {
    color: #e9ecef;
}

[data-bs-theme="dark"] .recent-file-meta {
    color: #adb5bd;
}

[data-bs-theme="dark"] .recent-file-remove {
    color: #adb5bd;
}

[data-bs-theme="dark"] .recent-file-remove:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b7a;
}

[data-bs-theme="dark"] .recent-files-empty {
    color: #adb5bd;
}

[data-bs-theme="dark"] .recent-files-footer {
    border-top-color: rgba(190, 48, 42, 0.2);
}

[data-bs-theme="dark"] .recent-files-clear-all {
    border-color: rgba(220, 53, 69, 0.5);
    color: #ff6b7a;
}

[data-bs-theme="dark"] .recent-files-clear-all:hover {
    background: rgba(220, 53, 69, 0.2);
    border-color: #ff6b7a;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .recent-files-header {
        padding: 10px 14px;
    }

    .recent-files-title {
        font-size: 0.9rem;
    }

    .recent-file-name {
        font-size: 0.85rem;
    }

    .recent-file-meta {
        font-size: 0.75rem;
    }
    
    /* General mobile optimizations */
    .navbar-brand {
        font-size: 1rem;
    }
    
    #fileMeta {
        font-size: 0.7rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-card h3 {
        font-size: 1.5rem;
    }
}

/* Additional mobile breakpoint for very small screens */
@media (max-width: 480px) {
    .upload-card {
        padding: 20px 15px;
        width: 98%;
    }
    
    .upload-title {
        font-size: 1.5rem;
    }
    
    .upload-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }
    
    .upload-page-logo {
        max-width: 160px;
    }
    
    .file-upload-area {
        padding: 20px 10px;
        margin-bottom: 20px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .upload-text {
        font-size: 0.9rem;
    }
    
    .upload-hint {
        font-size: 0.8rem;
    }
    
    .recent-files-container {
        margin-top: 15px;
    }
    
    .recent-files-header {
        padding: 0.5rem;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

#clerk-auth {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #fef4f6 0%, #f8e8eb 50%, #f1d2dc 100%);
    position: relative;
    overflow: hidden;
}

#clerk-auth::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('login-artwork.svg');
    background-size: cover;
    background-position: center;
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

/* Ensure the Clerk component and mounted element appear above the artwork */
#clerk-auth > * {
    position: relative;
    z-index: 10;
}

/* Enhanced Clerk card styling */
.cl-card {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    border-radius: 0.75rem !important;
    box-shadow:
            0 10px 40px rgba(190, 48, 42, 0.1),
            0 0 0 1px rgba(190, 48, 42, 0.05) !important;
}
/**
 * OPTION 1: Status Badge on Deep Filter Button
 *
 * Add this CSS to styles.css
 */

/* ========================================
   DEEP FIELD FILTER BUTTON STATES
   ======================================== */

/* Make button position relative for badge positioning */
#deepFieldFilterBtn {
    position: relative;
    transition: all 0.2s ease;
}

/* Active state when filters are applied */
#deepFieldFilterBtn.filter-active {
    background-color: var(--redlist-primary);
    color: white;
    border-color: var(--redlist-primary);
}

#deepFieldFilterBtn.filter-active:hover {
    background-color: var(--redlist-primary-hover);
    border-color: var(--redlist-primary-hover);
}

#deepFieldFilterBtn.filter-active:focus {
    box-shadow: 0 0 0 0.25rem rgba(190, 48, 42, 0.25);
}

/* Filter count badge */
.filter-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bs-body-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    line-height: 1;
    padding: 0;
    animation: badgePop 0.3s ease-out;
}

/* Badge appearance animation */
@keyframes badgePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .filter-badge {
    border-color: var(--bs-dark);
}

[data-bs-theme="dark"] #deepFieldFilterBtn.filter-active {
    background-color: var(--redlist-primary);
    color: white;
}

/* Pulse animation when button is active (optional) */
@keyframes filterPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(190, 48, 42, 0.4);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(190, 48, 42, 0);
    }
}

#deepFieldFilterBtn.filter-active {
    animation: filterPulse 2s infinite;
}

/* Remove pulse on hover to avoid distraction */
#deepFieldFilterBtn.filter-active:hover {
    animation: none;
}

#deptTreemap {
    min-width: 300px;
    min-height: 400px;
    width: 100%;
    height: 600px; /* or use viewport units like 60vh */
}

/* Two-column layout for data page */
.data-page-grid {
    display: grid;
    grid-template-columns: 600px 1fr;
    gap: 1rem;
    height: calc(100vh - 140px);
    overflow: hidden;
}

.transaction-list-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.transaction-list-panel .card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.transaction-viewer-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Make table rows clickable with hover effect */
#txTbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#txTbody tr:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

#txTbody tr.table-primary {
    background-color: rgba(13, 110, 253, 0.25) !important;
}

#txTbody tr.row-selected {
    background-color: rgba(25, 135, 84, 0.1);
}

/* Responsive: stack on smaller screens */
@media (max-width: 1400px) {
    .data-page-grid {
        grid-template-columns: 500px 1fr;
    }
}

@media (max-width: 1200px) {
    .data-page-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 400px 1fr;
    }
}

/* ==== String tab: comfortable density + narrow columns ==== */
.string-embed.comfortable table th,
.string-embed.comfortable table td {
    padding: 8px 12px;       /* comfortable vertical rhythm */
    font-size: 14px;
}

/* Fixed layout so columns don't stretch apart */
.string-embed .table-fixed {
    table-layout: fixed;
    width: 100%;
}

/* Fields table column widths (ch keeps them visually close) */
.string-embed .fields-col-idx      { width: 8ch; }
.string-embed .fields-col-name     { width: 25ch; }
.string-embed .fields-col-type     { width: 13ch; }
.string-embed .fields-col-display  { width: 31ch; }
.string-embed .fields-col-hex      { width: auto; }
.string-embed .fields-col-actions  { width: 5ch; }

/* Breakout table column widths */
.string-embed .bo-col-value { width: 20ch; }
.string-embed .bo-col-name  { width: 26ch; }
.string-embed .bo-col-desc  { width: auto; }

/* Optional: trim long values gracefully */
.string-embed .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
}
// trial warning banners
.trial-warning-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 12px 24px;
    text-align: center;
    z-index: 999997;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.trial-warning-banner button {
    background: white;
    color: #d97706;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 16px;
}

/* Option C: thin brand ribbon separating the two navbars */
.nav-navbar::before {
    /* 3px brand bar across the very top of the subnav */
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--redlist-primary), #a02823);
    opacity: .95;
    pointer-events: none;
}
/* Make the trial badge look clickable when enabled */
#trial-badge.trial-badge-clickable,
#trial-badge.trial-badge-clickable .badge {
    cursor: pointer;
}

#trial-badge.trial-badge-clickable .badge:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease;
}
/* Ensure the welcome header sits above the Clerk sign-in surface */
#clerk-auth { position: relative; }
.login-welcome-header {
    position: relative;
    z-index: 1000;         /* above Clerk's content */
    pointer-events: auto;  /* allow clicks */
}

/* Trial Feature Box Styling */
.trial-feature-box {
   /* background: rgba(255, 255, 255, 0.15); */
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(10px);
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.trial-feature-title {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
    color: rgba(60, 60, 60, 0.95);
    font-size: 0.875rem;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.trial-feature-list {
    list-style: none;
    padding-left: 0;
    margin: 0.25rem 0 0 0;
    font-size: 0.8rem;
    text-align: left;
}

.trial-feature-list li {
    margin: 0.15rem 0;
    color: rgba(60, 60, 60, 0.9);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.trial-feature-list .text-success {
    color: #10b981 !important;
}

/* Make the button obviously interactive */
#btnLicenseInfo { cursor: pointer; }
#btnLicenseInfo:hover { transform: translateY(-1px); }

/* Metadata Schema css below */
/* Schema Status Indicator */
.schema-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.schema-indicator:hover {
    background: var(--bs-secondary-bg-subtle);
    border-color: var(--bs-secondary);
}

.schema-indicator.custom {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success);
    border-color: var(--bs-success);
}

.schema-indicator.custom:hover {
    background: var(--bs-success);
    color: white;
}

.schema-indicator i {
    font-size: 1rem;
}

/* Custom Schema Controls Card */
#customSchemaControls .card {
    border: 2px dashed var(--bs-border-color);
}

/* Schema Stats */
#schemaStats {
    font-family: var(--bs-font-monospace);
    font-size: 0.85rem;
}

/* Metadata Settings Section */
.metadata-settings {
    padding: 1rem;
    background: var(--bs-body-bg);
    border-radius: 0.5rem;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .schema-indicator {
    background: var(--bs-gray-800);
}

[data-bs-theme="dark"] .schema-indicator.custom {
    background: var(--bs-success-bg-subtle);
    color: var(--bs-success-text);
}

[data-bs-theme="dark"] #customSchemaControls .card {
    background: var(--bs-gray-900);
}
/* ============================================
   SETTINGS OFFCANVAS PANEL STYLES
   Add this to the end of your styles.css file
   ============================================ */

/* Offcanvas Settings Panel */
.offcanvas-settings {
    width: 420px !important;
    max-width: 100vw;
}

/* Gradient header for offcanvas */
.offcanvas-settings .offcanvas-header {
    background: linear-gradient(135deg, #be302a 0%, #d94842 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1.25rem 1.5rem;
}

.offcanvas-settings .offcanvas-title {
    font-weight: 600;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.offcanvas-settings .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.offcanvas-settings .btn-close:hover {
    opacity: 1;
}

/* Settings sections */
.settings-section {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h6 {
    color: var(--bs-primary);
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-section h6 i {
    font-size: 1.1rem;
}

/* Schema status badge in offcanvas */
.schema-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bs-success-bg-subtle);
    border: 1px solid var(--bs-success);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.schema-status-badge.embedded {
    background: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

.schema-status-badge i {
    font-size: 1rem;
}

/* Custom schema upload card */
#customSchemaControls .card {
    border: 2px dashed var(--bs-border-color);
    background: var(--bs-secondary-bg);
}

#customSchemaControls .card-body {
    padding: 1rem;
}

/* Form controls in offcanvas */
.settings-section .form-check-label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.settings-section .form-check-label strong {
    font-size: 0.95rem;
    margin-bottom: 0.125rem;
}

.settings-section .form-check-label small {
    font-size: 0.8rem;
    line-height: 1.3;
}

.settings-section .form-check {
    padding-left: 2.5rem;
}

.settings-section .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.25rem;
}

.settings-section .form-switch .form-check-input {
    width: 2.5rem;
    height: 1.25rem;
}

/* Error display */
#schemaError {
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

#schemaError i {
    margin-right: 0.25rem;
}

/* About section links */
.settings-section .btn-outline-secondary {
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}

.settings-section .btn-outline-secondary:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

/* Offcanvas backdrop blur effect (optional) */
.offcanvas-backdrop {
    backdrop-filter: blur(2px);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .offcanvas-settings .offcanvas-header {
    background: linear-gradient(135deg, #be302a 0%, #a02620 100%);
}

[data-bs-theme="dark"] .schema-status-badge {
    background: rgba(25, 135, 84, 0.2);
    border-color: rgba(25, 135, 84, 0.5);
    color: #75b798;
}

[data-bs-theme="dark"] .schema-status-badge.embedded {
    background: var(--bs-gray-800);
    border-color: var(--bs-gray-700);
    color: var(--bs-gray-300);
}

[data-bs-theme="dark"] #customSchemaControls .card {
    background: var(--bs-gray-900);
    border-color: var(--bs-gray-700);
}

[data-bs-theme="dark"] .settings-section {
    border-bottom-color: var(--bs-gray-800);
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .offcanvas-settings {
        width: 100vw !important;
    }

    .settings-section {
        padding: 1.25rem 1rem;
    }

    .offcanvas-settings .offcanvas-header {
        padding: 1rem 1.25rem;
    }
}

/* Settings button in navbar - consistent with other navbar buttons */
.navbar .btn[data-bs-toggle="offcanvas"] {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
}

.navbar .btn[data-bs-toggle="offcanvas"] i {
    font-size: 1.125rem;
}

/* Animation for offcanvas
.offcanvas-settings.show {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}
*/

/* Ensure proper scrolling in offcanvas body */
.offcanvas-settings .offcanvas-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for offcanvas (webkit browsers) */
.offcanvas-settings .offcanvas-body::-webkit-scrollbar {
    width: 8px;
}

.offcanvas-settings .offcanvas-body::-webkit-scrollbar-track {
    background: var(--bs-tertiary-bg);
}

.offcanvas-settings .offcanvas-body::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 4px;
}

.offcanvas-settings .offcanvas-body::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary);
}

/* Schema file input styling */
#metadataFileInput {
    font-size: 0.875rem;
}

#metadataFileInput::file-selector-button {
    padding: 0.375rem 0.75rem;
    margin-right: 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    border: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    cursor: pointer;
}

#metadataFileInput::file-selector-button:hover {
    background: var(--bs-tertiary-bg);
}

/* Current schema info card */
#currentSchemaInfo {
    margin-top: 1rem;
    border: 1px solid var(--bs-success);
    font-size: 0.875rem;
}

#currentSchemaInfo .btn-outline-danger {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Settings section background alternation for visual separation */
.settings-section:nth-child(even) {
    background: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .settings-section:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Improve touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .settings-section .form-check {
        padding: 0.75rem 0;
        padding-left: 2.5rem;
    }

    .settings-section .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
    }

    .settings-section .form-switch .form-check-input {
        width: 3rem;
        height: 1.5rem;
    }
}

/* Loading state for schema upload (optional - for future use) */
.schema-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bs-primary);
    font-size: 0.875rem;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Success/error states */
.schema-success {
    color: var(--bs-success);
    animation: fadeIn 0.3s ease-in;
}

.schema-error {
    color: var(--bs-danger);
    animation: shake 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
/* Ensure multiline formatting is preserved for HLJS in all browsers */
#xml-pre code,
#poslog-pre code,
code.hljs {
    white-space: pre;          /* or 'pre-wrap' if you prefer soft-wrapping */
    word-break: normal;
    overflow-wrap: normal;
    display: block;            /* belt-and-suspenders: some themes toggle this */
}

/* Optional: if you want soft-wrapping instead of horizontal scroll, use: */
#xml-pre code,
#poslog-pre code,
code.hljs {
  white-space: pre-wrap;
}
/* Force real newlines to render and avoid soft-wrapping */
#xml-pre code,
#poslog-pre code,
code.hljs.language-xml {
    white-space: pre;      /* preserve \n, no wrapping */
    overflow: auto;        /* horizontal scroll for long lines */
    display: block;
}

 */

/* ========================================
   METADATA SCHEMA HELP SECTION STYLES
   Add to styles.css (around line 2808 after offcanvas styles)
   ======================================== */

/* Help Icon Button */
.help-icon-button {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(190, 48, 42, 0.1);
    color: var(--redlist-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.help-icon-button:hover {
    background: var(--redlist-primary);
    color: white;
    transform: scale(1.05);
}

.help-icon-button:active {
    transform: scale(0.98);
}

/* Collapsible Help Card */
#schemaHelpCollapse .card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#schemaHelpCollapse .card-header {
    border-bottom: 1px solid rgba(13, 110, 253, 0.2);
}

#schemaHelpCollapse .btn-close-sm {
    width: 0.75rem;
    height: 0.75rem;
    padding: 0;
    background-size: 0.75rem;
    opacity: 0.6;
}

#schemaHelpCollapse .btn-close-sm:hover {
    opacity: 1;
}

/* Schema Help Content */
.schema-help-content {
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

.schema-help-content .help-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.schema-help-content .help-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.schema-help-content h6 {
    color: #495057;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schema-help-content h6 i {
    font-size: 1rem;
    color: var(--redlist-primary);
}

.schema-help-content p {
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.schema-help-content ul {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.schema-help-content li {
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.schema-help-content li::marker {
    color: var(--redlist-primary);
}

/* Code Example Styling */
.code-example {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.4;
    overflow-x: auto;
    margin-bottom: 0.5rem;
    border: 1px solid #2d2d2d;
}

.code-example code {
    color: #d4d4d4;
    font-family: 'Courier New', Courier, monospace;
}

/* Field Type Badges */
.field-type-badge {
    background: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.field-type-badge code {
    background: var(--redlist-primary);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.7rem;
}

/* Info Alert in Help Section */
.schema-help-content .alert-info {
    background: rgba(13, 110, 253, 0.05);
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-radius: 0.375rem;
}

.schema-help-content .alert-info i {
    color: #0d6efd;
}

/* Dark Mode Adjustments */
[data-bs-theme="dark"] .help-icon-button {
    background: rgba(190, 48, 42, 0.2);
    color: #ff6b6b;
}

[data-bs-theme="dark"] .help-icon-button:hover {
    background: var(--redlist-primary);
    color: white;
}

[data-bs-theme="dark"] #schemaHelpCollapse .card {
    background: var(--bs-gray-900);
    border-color: var(--bs-gray-700);
}

[data-bs-theme="dark"] #schemaHelpCollapse .card-header {
    background: rgba(13, 110, 253, 0.15) !important;
    border-bottom-color: rgba(13, 110, 253, 0.3);
}

[data-bs-theme="dark"] .schema-help-content h6 {
    color: var(--bs-gray-300);
}

[data-bs-theme="dark"] .schema-help-content p,
[data-bs-theme="dark"] .schema-help-content li {
    color: var(--bs-gray-400);
}

[data-bs-theme="dark"] .code-example {
    background: #0d1117;
    border-color: #30363d;
}

[data-bs-theme="dark"] .field-type-badge {
    background: var(--bs-gray-800);
    border-color: var(--bs-gray-700);
    color: var(--bs-gray-300);
}

[data-bs-theme="dark"] .schema-help-content .alert-info {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.3);
    color: var(--bs-gray-300);
}

[data-bs-theme="dark"] .schema-help-content .alert-info i {
    color: #58a6ff;
}

/* Scrollbar for Help Content */
.schema-help-content::-webkit-scrollbar {
    width: 6px;
}

.schema-help-content::-webkit-scrollbar-track {
    background: var(--bs-light);
    border-radius: 3px;
}

.schema-help-content::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 3px;
}

.schema-help-content::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-dark);
}

[data-bs-theme="dark"] .schema-help-content::-webkit-scrollbar-track {
    background: var(--bs-gray-800);
}

[data-bs-theme="dark"] .schema-help-content::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
}

/* Responsive Adjustments for Help Section */
@media (max-width: 576px) {
    .help-icon-button {
        width: 26px;
        height: 26px;
        font-size: 0.875rem;
    }

    .schema-help-content {
        font-size: 0.8125rem;
        max-height: 300px;
    }

    .code-example {
        font-size: 0.7rem;
    }

    .field-type-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.375rem;
    }
}

/* Animation for help button when content is expanded */
.help-icon-button[aria-expanded="true"] {
    background: var(--redlist-primary);
    color: white;
}

.help-icon-button[aria-expanded="true"] i {
    animation: pulse 2s infinite;
}

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

/* ========================================
   SEARCH TOGGLE BUTTON (Header Icon)
   ======================================== */
.toggle-search-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: var(--bs-secondary-color);
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border-radius: 4px;
}

.toggle-search-btn:hover {
    color: var(--redlist-primary);
    background: var(--bs-secondary-bg);
}

.toggle-search-btn.active {
    color: var(--redlist-primary);
    background: var(--redlist-primary-light);
}

/* Hide toggle button when sidebar is collapsed */
.tx-sidebar.collapsed .toggle-search-btn {
    display: none;
}

/* Search controls hidden state */
.sidebar-controls.search-hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-bottom: none;
    opacity: 0;
}
/* ========================================
   SEARCH HELP MODAL
   ======================================== */

.search-help-modal .modal-header {
    background: linear-gradient(135deg, var(--redlist-primary) 0%, #d63f38 100%);
    color: white;
    border: none;
}

.search-help-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-help-modal .btn-close {
    filter: invert(1);
}

.search-help-modal .modal-body {
    padding: 1.5rem;
}

/* Help Card Styling */
.help-card {
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fafbfc;
}

.help-card:last-child {
    margin-bottom: 0;
}

.help-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--redlist-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Tips */
.search-tip {
    display: flex;
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    padding: 0.3rem 0;
}

.search-tip:last-child {
    margin-bottom: 0;
}

.search-tip-bullet {
    color: var(--redlist-primary);
    font-weight: 600;
    margin-top: 0.1rem;
}

.search-tip-content {
    flex: 1;
}

.search-tip code,
.help-card code {
    background: #f8f9fa;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
    color: var(--redlist-primary);
    border: 1px solid rgba(190, 48, 42, 0.15);
}

/* Keyword Grid */
.keyword-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.keyword-badge {
    background: white;
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    text-align: center;
    transition: all 0.2s;
}

.keyword-badge:hover {
    border-color: var(--redlist-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(190, 48, 42, 0.15);
}

.keyword-badge code {
    display: block;
    font-weight: 600;
    color: var(--redlist-primary);
    margin-bottom: 0.25rem;
    background: transparent;
    border: none;
    padding: 0;
}

.keyword-badge .alias {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Search Examples */
.search-example {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    color: var(--redlist-primary);
    border: 1px solid rgba(190, 48, 42, 0.15);
}

.search-example:last-child {
    margin-bottom: 0;
}

/* Dark Mode Support */
[data-bs-theme="dark"] .help-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .keyword-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .keyword-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--redlist-primary);
}

[data-bs-theme="dark"] .search-example {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(190, 48, 42, 0.3);
}

[data-bs-theme="dark"] .search-tip code,
[data-bs-theme="dark"] .help-card code {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(190, 48, 42, 0.3);
}