/* styles.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: #131924;
    --bg-header: #172030;
    --bg-hover: #1e293b;
    --border-color: #243249;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-accent: #10b981; /* Emerald Green from Logo */
    --color-accent-hover: #059669;
    --color-dimension: #10b981; /* Emerald */
    --color-dimension-bg: rgba(16, 185, 129, 0.1);
    --color-measure: #06b6d4; /* Cyan */
    --color-measure-bg: rgba(6, 182, 212, 0.1);
    --color-filter: #f59e0b; /* Amber */
    --color-filter-bg: rgba(245, 158, 11, 0.1);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px rgba(16, 185, 129, 0.15);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Hide number input spin buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

/* Header */
header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: var(--shadow-sm);
    position: relative;
}

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

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.logo-section h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-file-section {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-file-section .file-icon {
    width: 14px;
    height: 14px;
    color: var(--color-accent);
}

.header-filename-active {
    color: var(--text-primary) !important;
    font-weight: 500;
    background-color: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.2);
}

.header-datasource-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-datasource-section label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-datasource-section select {
    min-width: 160px;
    height: 32px;
    font-size: 0.8rem;
    padding: 4px 28px 4px 10px;
}

.db-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-badge.connected i {
    color: #10b981;
}

.status-badge.disconnected i {
    color: #ef4444;
}

.btn-upload {
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-upload:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

/* App Layout */
.app-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

select.table-select {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

select.table-select:focus {
    border-color: var(--color-accent);
}

.search-container {
    position: relative;
}

.search-container i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px 8px 32px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--color-accent);
}

.fields-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fields-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fields-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.fields-section-title:hover {
    color: var(--color-accent);
}

.fields-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Draggable Cards */
.field-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 6px 6px 6px 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    user-select: none;
    transition: var(--transition);
}

.field-card:hover {
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.field-card:active {
    cursor: grabbing;
}

.field-info {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-info i,
.field-info svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.field-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
    font-size: 0.78rem;
    font-weight: 500;
}

.field-card.dimension .field-info i,
.field-card.dimension .field-info svg {
    color: var(--color-dimension);
}

.field-card.measure .field-info i,
.field-card.measure .field-info svg {
    color: var(--color-measure);
}

.field-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    flex-shrink: 0;
}

/* Workspace Canvas */
.workspace-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-main);
}

/* Drop Zones Panel */
.drop-zones-panel {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.drop-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    flex: 1;
}

.drop-label {
    width: 80px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.drop-label i {
    font-size: 0.8rem;
}

.drop-zone {
    flex: 1;
    min-height: 28px;
    background-color: var(--bg-main);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    transition: var(--transition);
    position: relative;
}

.drop-zone.dragover {
    border-color: var(--color-accent);
    background-color: rgba(16, 185, 129, 0.05);
    box-shadow: var(--shadow-glow);
}

.drop-placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: var(--transition);
}

.drop-zone:not(:empty) .drop-placeholder {
    display: none;
}

/* Dropped Pill Cards */
.pill-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: grab;
    user-select: none;
    animation: scaleIn 0.15s ease-out;
}

.pill-card:active {
    cursor: grabbing;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.pill-card.dimension {
    border-left: 3px solid var(--color-dimension);
    background-color: var(--color-dimension-bg);
}

.pill-card.measure {
    border-left: 3px solid var(--color-measure);
    background-color: var(--color-measure-bg);
}

.pill-card.filter {
    border-left: 3px solid var(--color-filter);
    background-color: var(--color-filter-bg);
}

.pill-card select.agg-select {
    background: transparent;
    border: none;
    color: var(--color-measure);
    font-weight: 600;
    cursor: pointer;
    outline: none;
    font-size: 0.75rem;
    padding-right: 4px;
}

.pill-card select.agg-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.pill-remove {
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.pill-remove:hover {
    color: #ef4444;
}

/* Toolbar */
.toolbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.view-tabs {
    display: flex;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.tab-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn {
    background-color: rgba(16, 185, 129, 0.12); /* Greenish back fill color from the logo */
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn:hover {
    background-color: rgba(16, 185, 129, 0.22);
    border-color: rgba(16, 185, 129, 0.55);
    color: var(--text-primary);
}

.btn-primary {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #0b0f19; /* High-contrast dark text for green background */
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #0b0f19;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow: auto;
    position: relative;
    padding: 24px;
}

.tab-panel {
    display: none;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.2s ease-out;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Empty State / Initial Landing */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.empty-state h3 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    max-width: 400px;
    margin-bottom: 24px;
}

/* Pivot Table Styles */
.pivot-table-container {
    width: 100%;
    max-height: 100%;
    overflow: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

table.pivot-grid {
    width: max-content;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
    table-layout: fixed;
}

table.pivot-grid th, table.pivot-grid td {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table.pivot-grid th {
    background-color: var(--bg-header);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Sticky row headers */
table.pivot-grid th.row-header {
    background-color: var(--bg-header);
    color: var(--text-primary);
    font-weight: 500;
    position: sticky;
    left: 0;
    z-index: 3;
}

table.pivot-grid th.row-header-title {
    background-color: var(--bg-header);
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 4; /* Higher than regular row headers */
}

/* Vertical Drag Resize Handle */
.resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    z-index: 10;
    transition: background-color 0.1s ease;
}

.resize-handle:hover,
.resize-handle.resizing {
    background-color: var(--color-accent);
}

table.pivot-grid tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Totals styling */
table.pivot-grid td.total-cell, table.pivot-grid th.total-cell {
    font-weight: 700;
    background-color: rgba(16, 185, 129, 0.05);
    color: var(--text-primary);
}

table.pivot-grid tr.grand-total-row td {
    font-weight: 700;
    background-color: rgba(16, 185, 129, 0.08);
    border-top: 2px double var(--border-color);
    color: var(--text-primary);
}

/* Chart Canvas Wrapper */
.chart-wrapper {
    width: 100%;
    height: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.chart-controls label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chart-controls select {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
}

.chart-container {
    flex: 1;
    position: relative;
    min-height: 350px;
}

/* Raw Preview Table */
.raw-preview-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

table.raw-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

table.raw-grid th, table.raw-grid td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.raw-grid th {
    background-color: var(--bg-header);
    position: sticky;
    top: 0;
    z-index: 1;
}

table.raw-grid tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Filter Modal/Dropdown */
.filter-dropdown-container {
    position: relative;
}

.filter-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    width: 220px;
    max-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-menu-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    padding: 4px;
    cursor: pointer;
}

.filter-item input {
    cursor: pointer;
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: 4px;
}

.filter-actions button {
    background: transparent;
    border: none;
    color: var(--color-accent);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.filter-actions button:hover {
    text-decoration: underline;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background-color: var(--bg-card);
    border-left: 4px solid var(--color-accent);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.success {
    border-left-color: #10b981;
}

/* Drop Zone Overrides for drag feedback */
.can-drop {
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Modal styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 1000px;
    max-width: 95%;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
    transform: scale(1);
}

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

.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-row {
    display: flex;
    gap: 16px;
}

.modal-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.modal-input {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.modal-input:focus {
    border-color: var(--color-accent);
}

.formula-editor-container {
    display: flex;
    gap: 16px;
    height: 360px;
}

.formula-editor-main {
    flex: 3.5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.formula-textarea {
    flex: 1;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    outline: none;
    resize: none;
    transition: var(--transition);
    line-height: 1.4;
}

.formula-textarea:focus {
    border-color: var(--color-accent);
}

.formula-columns-panel {
    flex: 1.8;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 140px;
}

.formula-functions-panel {
    flex: 4.8;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 440px;
}

.helper-scroll-list {
    flex: 1;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Functions Panel 2-Column Grid Layout */
#helper-functions-groups.helper-scroll-list {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
    align-content: start;
}

/* Expand alphabetical sorted box to fill both columns */
#helper-functions-groups.helper-scroll-list > .function-group-box:only-child {
    grid-column: span 2;
}

.modal-input::placeholder {
    font-style: italic !important;
    opacity: 0.55 !important;
}

/* Scrollable items styling */
.helper-column-item {
    padding: 6px 10px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 500;
}

.helper-column-item:hover {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: var(--color-accent);
    color: var(--text-primary);
}

/* Function box styling */
.function-group-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: rgba(255, 255, 255, 0.01);
    overflow: hidden;
    margin-bottom: 6px;
}

.function-group-header {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.function-group-body {
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Function pill badges */
.function-pill {
    padding: 4px 10px;
    background-color: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--color-accent);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
}

.function-pill:hover {
    background-color: var(--color-accent);
    color: #0b0f19;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Autocomplete Suggestion Popup */
.autocomplete-suggestions {
    position: absolute;
    bottom: 8px;
    left: 8px;
    width: calc(100% - 16px);
    background-color: var(--bg-card);
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    max-height: 140px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.autocomplete-suggestion {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--text-primary);
}

.autocomplete-suggestion strong {
    font-family: 'Courier New', Courier, monospace;
}

.autocomplete-suggestion .suggestion-type {
    font-size: 0.7rem;
    color: var(--color-accent);
    background-color: rgba(16, 185, 129, 0.1);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-weight: 500;
}

/* Custom Field Hover Box Tooltip */
.custom-field-tooltip {
    position: fixed;
    background-color: #0f172a;
    color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease-out;
    white-space: nowrap;
}

/* ----------------------------------------------------
/* Navigation Mode Toggle Buttons in Header
/* ---------------------------------------------------- */
.mode-toggle-group {
    display: flex;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 2px;
}

.mode-btn {
    background: none;
    border: none;
    padding: 6px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background-color: var(--color-accent);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

#mode-admin {
    color: var(--color-accent);
}
#mode-admin:hover {
    color: var(--color-accent);
    filter: brightness(1.2);
}
#mode-admin.active {
    background-color: var(--color-accent);
    color: #ffffff;
}

/* Custom Toggle Switch for Admin Inbox */
.switch-container input:checked + .switch-slider {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}
.switch-container input:checked + .switch-slider:before {
    transform: translateX(14px);
}
.switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

/* Data Source Bar (Row 2 Header) */
.data-source-bar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* User Profile Badge in Header */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
}

.user-email {
    color: var(--text-secondary);
    font-weight: 500;
}

.user-admin-badge {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ----------------------------------------------------
/* Prep Mode Workspace Layout
/* ---------------------------------------------------- */
.prep-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Prep Palette Container */
.prep-palette-container {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    user-select: none;
}

/* Palette Header: Tabs & Search */
.palette-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    gap: 16px;
    background-color: rgba(0, 0, 0, 0.1);
}

.palette-tabs-container {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.palette-tabs-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.palette-tab {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.palette-tab:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.palette-tab.active {
    color: #ffffff;
    background-color: var(--color-accent);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Prep Palette (ETL Tools Panel) */
.prep-palette {
    background-color: transparent;
    padding: 10px 24px;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: flex-start;
    gap: 16px;
    min-height: 85px;
    user-select: none;
    scrollbar-width: thin;
}

/* Custom scrollbar for prep-palette */
.prep-palette::-webkit-scrollbar {
    height: 6px;
}
.prep-palette::-webkit-scrollbar-track {
    background: var(--bg-main);
}
.prep-palette::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.prep-palette::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.palette-category {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-name {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.category-name:hover {
    color: var(--text-primary);
}

.category-name::before {
    content: "▼";
    font-size: 0.55rem;
    display: inline-block;
    transition: transform 0.15s ease;
}

.palette-category.collapsed .category-name::before {
    content: "▶";
}

.prep-palette.show-all .palette-category.collapsed .palette-tools {
    display: none !important;
}

.prep-palette.show-all .palette-category.collapsed + .palette-separator {
    display: none !important;
}

.palette-tools {
    display: flex;
    gap: 16px;
}

.prep-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.prep-tool.ai-tool-disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

.prep-tool.ai-tool-disabled:hover .tool-icon {
    transform: none !important;
}

.tool-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease;
}

.prep-tool:hover .tool-icon {
    transform: scale(1.1);
}

.tool-inout {
    background-color: #10b981; /* Green */
}

.tool-prep {
    background-color: #3b82f6; /* Blue */
}

.tool-join {
    background-color: #8b5cf6; /* Purple */
}

.tool-transform {
    background-color: #f97316; /* Orange */
}

.tool-advprep {
    background-color: #14b8a6; /* Teal */
}

.tool-advformula {
    background-color: #6366f1; /* Indigo */
}

.tool-metadata {
    background-color: #eab308; /* Yellow */
}

.tool-masterdata {
    background-color: #f59e0b; /* Amber */
}

.tool-ai {
    background-color: #ec4899; /* Pink */
}

.prep-tool span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Node Order Indicator Badge */
.node-order-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--bg-card);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.node-order-badge:hover {
    transform: scale(1.2);
    background-color: #fbbf24;
}

/* Connection Paths interactivity */
.connection-path {
    cursor: pointer;
    pointer-events: stroke;
    transition: stroke 0.1s ease, stroke-width 0.1s ease;
}

.connection-path:hover {
    stroke: #fbbf24 !important;
    stroke-width: 5px !important;
}

.connection-path.selected {
    stroke: #ef4444 !important;
    stroke-width: 5px !important;
}

/* Labeled Multi-port anchors (T, F, L, J, R) */
.node-anchor-labeled {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #1e293b;
    border: 1.5px solid #475569;
    color: #94a3b8;
    font-size: 0.55rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    z-index: 5;
    user-select: none;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color 0.1s ease, transform 0.1s ease, color 0.1s ease;
}

.node-anchor-labeled:hover {
    background-color: var(--color-accent);
    color: #ffffff;
    border-color: #ffffff;
    transform: translateY(-50%) scale(1.25);
}

.palette-separator {
    width: 1px;
    height: 32px;
    background-color: var(--border-color);
    align-self: flex-end;
}

/* Prep Canvas (ETL Node Grid Area) */
.prep-canvas {
    flex: 1;
    position: relative;
    overflow: auto;
    background-color: var(--bg-main);
    user-select: none;
    min-height: 100px;
}

.canvas-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 2000px;
    height: 2000px;
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
}

.canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    max-width: 400px;
    line-height: 1.5;
    pointer-events: none;
}

.canvas-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 2000px;
    height: 2000px;
    pointer-events: none;
    z-index: 1;
}

/* ETL Canvas Node Cards */
.canvas-node {
    position: absolute;
    width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    z-index: 2;
    cursor: move;
    padding: 4px;
}

.canvas-node.selected {
    background-color: rgba(16, 185, 129, 0.08);
    outline: 1.5px dashed var(--color-accent);
    outline-offset: 2px;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.canvas-node.selected .node-icon-wrapper {
    box-shadow: 0 0 0 3px var(--color-accent);
}

.node-icon-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #ffffff;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--bg-card);
    transition: box-shadow 0.15s ease;
    background-color: var(--bg-card);
}

.node-label {
    font-size: 0.7rem;
    color: var(--text-primary);
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    background-color: rgba(15, 23, 42, 0.85);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
}

/* Connector anchor circles */
.node-anchor {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #cbd5e1;
    border: 1.5px solid #475569;
    top: 50%;
    transform: translateY(-50%);
    cursor: crosshair;
    z-index: 5;
    transition: background-color 0.1s ease, transform 0.1s ease;
}

.node-anchor-in {
    left: -5px;
}

.node-anchor-out {
    right: -5px;
}

.node-anchor:hover {
    background-color: var(--color-accent);
    transform: translateY(-50%) scale(1.3);
}

/* Left panel for tool properties in Prep Mode */
.prep-config-panel {
    flex: 1.8;
    max-width: 320px;
    min-width: 250px;
    border-right: 1px solid var(--border-color);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
}

/* Bottom panel: ETL Results */
.prep-results {
    flex: none;
    height: 200px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    min-height: 40px;
}

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

.results-tabs {
    display: flex;
    gap: 16px;
}

.results-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s ease;
}

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

.results-tab.active {
    color: var(--color-accent);
    border-bottom: 2px solid var(--color-accent);
}

.results-table-container {
    flex: 1;
    overflow: auto;
}

/* Split panel resizer styling */
.panel-resizer-v:hover, .panel-resizer-v.resizing {
    background-color: var(--color-accent) !important;
}
.panel-resizer-h:hover, .panel-resizer-h.resizing {
    background-color: var(--color-accent) !important;
}

/* Ensure canvas node wrapper backgrounds match palette colors exactly */
.node-icon-wrapper.tool-inout { background-color: #10b981 !important; }
.node-icon-wrapper.tool-prep { background-color: #3b82f6 !important; }
.node-icon-wrapper.tool-join { background-color: #8b5cf6 !important; }
.node-icon-wrapper.tool-transform { background-color: #f97316 !important; }
.node-icon-wrapper.tool-advprep { background-color: #14b8a6 !important; }
.node-icon-wrapper.tool-advformula { background-color: #6366f1 !important; }
.node-icon-wrapper.tool-metadata { background-color: #eab308 !important; }
.node-icon-wrapper.tool-masterdata { background-color: #f59e0b !important; }
.node-icon-wrapper.tool-ai { background-color: #ec4899 !important; }

/* Canvas node execution status effects */
.canvas-node.processing-glow .node-icon-wrapper {
    box-shadow: 0 0 15px 5px #f97316 !important;
    animation: pulse-orange-glow 1s infinite alternate;
}
@keyframes pulse-orange-glow {
    0% { box-shadow: 0 0 8px 1px #f97316; }
    100% { box-shadow: 0 0 20px 6px #f97316; }
}

.canvas-node.completed-box {
    border: 2px solid #10b981 !important;
    border-radius: 6px;
    background-color: rgba(16, 185, 129, 0.04);
}

/* Excel Grid styles for Create mode */
.excel-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    width: max-content;
    font-family: inherit;
    font-size: 0.75rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.excel-th {
    background: rgba(0,0,0,0.3);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 6px;
    font-weight: bold;
    color: var(--text-secondary);
    user-select: none;
    position: relative;
    text-align: center;
}

.excel-th-input {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px dashed rgba(255,255,255,0.2) !important;
    color: var(--text-primary) !important;
    font-size: 0.75rem !important;
    font-weight: bold !important;
    width: 100% !important;
    padding: 2px 0 !important;
    outline: none !important;
    text-align: center;
}

.excel-th-input:focus {
    border-bottom: 1px solid var(--color-accent) !important;
}

.excel-th-select {
    background: rgba(0,0,0,0.5) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: var(--text-muted) !important;
    font-size: 0.65rem !important;
    width: 100% !important;
    margin-top: 4px !important;
    padding: 1px 4px !important;
    border-radius: 3px !important;
    outline: none !important;
    cursor: pointer;
}

.excel-row-num {
    background: rgba(0,0,0,0.25);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: bold;
    text-align: center;
    padding: 6px;
    width: 45px;
    user-select: none;
    cursor: pointer;
}

.excel-td {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 6px;
    word-break: break-all;
    outline: none;
    cursor: cell;
    background: transparent;
    transition: background 0.1s ease;
}

.excel-td:focus {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px var(--color-accent);
}

.excel-td:hover {
    background: rgba(255, 255, 255, 0.03);
}

.excel-col-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0 4px;
    transition: color 0.1s;
}

.excel-col-btn:hover {
    color: #f87171;
}

.table-list-item {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.table-list-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.table-list-item.active {
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
}

.legend-cell-input {
    border: none !important;
    background: transparent !important;
    color: var(--text-primary) !important;
    outline: none !important;
    font-family: inherit !important;
    font-size: 0.75rem !important;
    width: 100% !important;
    padding: 6px 8px !important;
    border-radius: 2px !important;
    transition: background-color 0.15s, box-shadow 0.15s !important;
}

.legend-cell-input:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

.legend-cell-input:focus {
    background-color: rgba(255, 255, 255, 0.05) !important;
    box-shadow: inset 0 0 0 1px var(--color-accent) !important;
}

/* Resources Monitor Button States */
.resources-status-btn-healthy {
    border-color: #10b981 !important;
    color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.12) !important;
}
.resources-status-btn-healthy:hover {
    background-color: rgba(16, 185, 129, 0.22) !important;
}

.resources-status-btn-medium {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
    background-color: rgba(245, 158, 11, 0.12) !important;
}
.resources-status-btn-medium:hover {
    background-color: rgba(245, 158, 11, 0.22) !important;
}

.resources-status-btn-critical {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.12) !important;
    animation: resources-pulse 2s infinite;
}
.resources-status-btn-critical:hover {
    background-color: rgba(239, 68, 68, 0.22) !important;
}

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

/* Landing Page Grid layout */
.landing-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: row;
    background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.98) 0%, rgba(9, 15, 28, 1) 90%);
    overflow: hidden;
}

.landing-left-pane {
    flex: 1.25;
    padding: 48px 64px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    border-right: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    box-sizing: border-box;
}

.landing-right-pane {
    flex: 0.75;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    background: rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

@media (max-width: 992px) {
    .landing-left-pane {
        display: none !important;
    }
    .landing-right-pane {
        flex: 1 !important;
        background: radial-gradient(circle at 10% 20%, rgba(15, 23, 42, 0.98) 0%, rgba(9, 15, 28, 1) 90%) !important;
    }
}

@media (min-width: 992px) {
    .landing-mobile-footer {
        display: none !important;
    }
}

/* Info Module Styling */
.info-category-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
}

.info-category-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.info-category-btn.active {
    background-color: rgba(16, 185, 129, 0.12);
    color: #34d399;
    font-weight: 600;
    border-left: 3px solid var(--color-accent);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.info-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

.info-card:hover {
    border-color: var(--color-accent);
    background-color: rgba(255, 255, 255, 0.01);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.info-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.info-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.info-card-meta {
    font-size: 0.7rem;
    color: var(--color-accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Rich help content custom elements */
.help-article-content {
    line-height: 1.6;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.help-article-content h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 16px 0;
}

.help-article-content h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 28px 0 12px 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.help-article-content h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 20px 0 8px 0;
}

.help-article-content p {
    margin: 0 0 16px 0;
}

.help-article-content ul, .help-article-content ol {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

.help-article-content li {
    margin-bottom: 6px;
}

.help-article-content code {
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    padding: 2px 5px;
    font-size: 0.8rem;
    color: #a5b4fc;
}

.help-article-content pre {
    background-color: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
    box-sizing: border-box;
}

.help-article-content pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.8rem;
    line-height: 1.5;
}

.help-article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0 24px 0;
    font-size: 0.8rem;
}

.help-article-content th, .help-article-content td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
}

.help-article-content th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    font-weight: 600;
}

.help-article-content blockquote {
    margin: 16px 0;
    padding: 12px 18px;
    background-color: rgba(16, 185, 129, 0.05);
    border-left: 4px solid var(--color-accent);
    border-radius: var(--radius-sm);
    font-style: italic;
    color: var(--text-primary);
}

/* Custom Canvas Grid Context Menu */
.canvas-grid-contextmenu {
    position: fixed;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border-radius: var(--radius-md);
    padding: 4px 0;
    z-index: 9999;
    user-select: none;
    min-width: 150px;
    font-size: 0.8rem;
}

.canvas-grid-contextmenu .contextmenu-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
}

.canvas-grid-contextmenu .contextmenu-item:hover {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--text-primary);
}

.canvas-grid-contextmenu .contextmenu-item .submenu-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.canvas-grid-contextmenu .contextmenu-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border-radius: var(--radius-md);
    padding: 12px;
    z-index: 10000;
    flex-direction: row;
    gap: 20px;
    max-height: 450px;
    overflow-y: auto;
}

.canvas-grid-contextmenu .contextmenu-item.has-submenu:hover .contextmenu-submenu {
    display: flex;
}

.canvas-grid-contextmenu .submenu-column {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 130px;
}

.canvas-grid-contextmenu .submenu-category-title {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.canvas-grid-contextmenu .submenu-tool-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.canvas-grid-contextmenu .submenu-tool-item:hover {
    background-color: rgba(16, 185, 129, 0.12);
    color: var(--text-primary);
}

.canvas-grid-contextmenu .submenu-tool-item .tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.75rem;
}

/* Custom Dropdown for Color Palettes */
.custom-palette-dropdown {
    position: relative;
    display: inline-block;
    min-width: 170px;
    font-size: 0.75rem;
    user-select: none;
}

.custom-palette-trigger {
    height: 28px;
    padding: 2px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: var(--text-primary);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.custom-palette-trigger:hover {
    border-color: var(--color-accent);
}

.custom-palette-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}

.custom-palette-options.show {
    display: block;
}

.custom-palette-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    color: var(--text-secondary);
}

.custom-palette-option:hover,
.custom-palette-option.selected {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.custom-palette-option.selected {
    border-left: 2px solid var(--color-accent);
    padding-left: 8px;
}

.custom-palette-band {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-shrink: 0;
}

.custom-palette-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Custom Field Context Menu */
.custom-contextmenu {
    position: fixed;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.5);
    border-radius: var(--radius-md);
    padding: 4px 0;
    z-index: 9999;
    user-select: none;
    min-width: 185px;
    font-size: 0.75rem;
    animation: fadeIn 0.1s ease-out;
}

.custom-contextmenu .contextmenu-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color 0.15s, color 0.15s;
}

.custom-contextmenu .contextmenu-item:hover {
    background-color: rgba(99, 102, 241, 0.12);
    color: var(--text-primary);
}

.custom-contextmenu .contextmenu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

/* Hierarchy Folders in Sidebar */
.hierarchy-folder-header {
    transition: background-color 0.15s, border-color 0.15s;
}

.hierarchy-folder-header:hover {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: var(--text-muted) !important;
}

.hierarchy-order-item {
    transition: border-color 0.15s, background-color 0.15s;
}

.hierarchy-order-item:hover {
    border-color: var(--text-muted) !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
}

/* Custom Context Menu Submenus */
.custom-contextmenu .contextmenu-item.has-submenu {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-contextmenu .contextmenu-item.has-submenu:hover .contextmenu-submenu {
    display: block;
}

.custom-contextmenu .contextmenu-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -2px rgba(0,0,0,0.5);
    border-radius: var(--radius-md);
    padding: 4px 0;
    min-width: 175px;
    z-index: 10001;
}

/* Dashboard Drag and Drop styles */
.dashboard-card {
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    cursor: grab;
    user-select: none;
}
.dashboard-card:active {
    cursor: grabbing;
}
.dashboard-card.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}
.dashboard-card.drag-hover {
    border: 2px dashed var(--color-accent) !important;
    background-color: rgba(16, 185, 129, 0.04) !important;
}
