/* Drillhole Viewer Styles */

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

body {
    font-family: var(--graiph-font);
    background: var(--graiph-bg-primary);
    color: var(--graiph-text-primary);
    overflow: hidden;
}

/* =========================================================================
   LOGIN OVERLAY
   ========================================================================= */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--graiph-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#loginOverlay.hidden {
    display: none;
}

.login-card {
    background: var(--graiph-bg-surface);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--graiph-border);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.login-card h2 {
    color: var(--graiph-accent-text);
    margin-bottom: 24px;
    text-align: center;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: var(--graiph-bg-tertiary);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    color: var(--graiph-text-primary);
    font-size: 1rem;
}

.login-card input:focus {
    outline: none;
    border-color: var(--graiph-accent);
}

#loginBtn {
    width: 100%;
    padding: 12px;
    background: var(--graiph-accent);
    color: var(--graiph-accent-ink);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#loginBtn:hover {
    background: var(--graiph-accent-hover);
}

#loginBtn:disabled {
    background: var(--graiph-border-hover);
    cursor: not-allowed;
}

#loginMsg {
    margin-top: 12px;
    text-align: center;
    font-size: 0.9rem;
}

#loginMsg.error {
    color: var(--graiph-alert-error);
}

#loginMsg.success {
    color: var(--graiph-accent-text);
}

/* =========================================================================
   APP LAYOUT
   ========================================================================= */
#app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: 100vh;
}

/* =========================================================================
   TOP BAR (now uses shared/header.css .graiph-header)
   Viewer-specific overrides only.
   ========================================================================= */

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary {
    background: var(--graiph-accent);
    color: var(--graiph-accent-ink);
}

.btn.primary:hover:not(:disabled) {
    background: var(--graiph-accent-hover);
}

.btn.primary.active {
    background: var(--graiph-accent-hover);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn.success {
    background: var(--graiph-alert-success);
    color: var(--graiph-accent-ink);
}

.btn.success:hover:not(:disabled) {
    background: var(--graiph-accent-hover);
}

.btn.warning {
    background: var(--graiph-alert-warning);
    color: white;
}

.btn.warning:hover:not(:disabled) {
    background: var(--graiph-alert-warning);
}

.btn.purple {
    background: #8b5cf6;
    color: white;
}

.btn.purple:hover:not(:disabled) {
    background: #7c3aed;
}

.btn.hidden {
    display: none;
}

/* Save button - keep enabled state styling */
#saveChangesBtn:not(:disabled) {
    background: var(--graiph-alert-success);
    border-color: var(--graiph-alert-success);
    color: var(--graiph-accent-ink);
}

#saveChangesBtn:not(:disabled):hover {
    background: var(--graiph-accent-hover);
    border-color: var(--graiph-accent-hover);
}

/* Export, toggle, status — now handled by shared/header.css (.gh-export-*, .gh-status-text, .gh-toggle-active) */

/* Control Bar - Vertical sidebar positioned at right edge of center panel */
.control-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--graiph-bg-elevated);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    padding: 4px;
}

/* Vertical layout for control bar in center panel */
.control-bar.vertical {
    position: absolute;
    top: 8px;
    right: 8px; /* Position at far right edge */
    flex-direction: column;
    z-index: 10;
    padding: 6px 4px;
}

/* When 3D column is hidden, move control bar to right edge */
#centerPanel:has(#threeDColumn.hidden) .control-bar.vertical {
    right: 8px;
}

.ctrl-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--graiph-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ctrl-icon-btn:hover {
    background: rgba(51, 204, 102, 0.2);
    color: var(--graiph-text-secondary);
}

.ctrl-icon-btn.active {
    color: var(--graiph-accent-text);
    background: rgba(51, 204, 102, 0.15);
    border-color: var(--graiph-accent);
}

.ctrl-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ctrl-icon-btn:disabled:hover {
    background: transparent;
    color: var(--graiph-text-muted);
}

.ctrl-icon-btn.loading {
    animation: pulse 1s infinite;
    pointer-events: none;
}

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

/* HD toggle specific - show green when active to indicate HD mode */
#hdToggleBtn.active {
    color: #34d399;
    background: rgba(52, 211, 153, 0.15);
    border-color: #34d399;
}

.ctrl-separator {
    width: 24px;
    height: 1px;
    background: var(--graiph-border);
    margin: 4px 0;
}

/* Columns Panel - Dropdown panel */
.columns-panel {
    position: absolute;
    right: 100%;
    top: 0;
    margin-right: 8px;
    background: var(--graiph-bg-elevated);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    padding: 8px 0;
    min-width: 160px;
    z-index: 20;
}

.columns-panel.hidden {
    display: none;
}

.columns-panel-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--graiph-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px 4px;
    border-top: 1px solid var(--graiph-border);
    margin-top: 4px;
}

.columns-panel-header:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 4px;
}

.column-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    color: var(--graiph-text-primary);
    transition: background 0.15s;
}

.column-checkbox:hover {
    background: rgba(51, 204, 102, 0.1);
}

.column-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--graiph-accent);
    cursor: pointer;
}

.column-checkbox span {
    flex: 1;
}

/* Placement toggle button (L/R) */
.placement-toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    margin-left: auto;
    background: var(--graiph-border);
    border: 1px solid var(--graiph-border-hover);
    border-radius: 3px;
    color: var(--graiph-text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.placement-toggle:hover {
    background: var(--graiph-border-hover);
    color: var(--graiph-text-primary);
}

.placement-toggle.right {
    background: var(--graiph-accent);
    border-color: var(--graiph-accent-hover);
    color: var(--graiph-accent-ink);
}

.header-hint {
    font-size: 10px;
    color: var(--graiph-text-muted);
    font-weight: normal;
}

.column-setting {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--graiph-text-primary);
}

.column-setting span {
    color: var(--graiph-text-secondary);
}

.column-setting input[type="number"] {
    width: 50px;
    padding: 4px 6px;
    background: var(--graiph-bg-tertiary);
    border: 1px solid var(--graiph-border);
    border-radius: 4px;
    color: var(--graiph-text-primary);
    font-size: 12px;
}

.column-setting .unit {
    color: var(--graiph-text-muted);
}

.col-settings-panel label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--graiph-text-secondary);
}

.col-settings-panel input {
    width: 50px;
    padding: 4px 6px;
    background: var(--graiph-bg-tertiary);
    border: 1px solid var(--graiph-border);
    border-radius: 4px;
    color: var(--graiph-text-primary);
    font-size: 0.75rem;
}

.col-settings-panel .unit {
    color: var(--graiph-text-muted);
    font-size: 0.7rem;
}

/* View Mode Dropdown */
.view-mode-dropdown {
    display: flex;
    align-items: center;
}

.view-mode-dropdown select {
    background: var(--graiph-bg-surface);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    color: var(--graiph-text-primary);
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.view-mode-dropdown select:hover {
    border-color: var(--graiph-accent);
}

.view-mode-dropdown select:focus {
    border-color: var(--graiph-accent);
    box-shadow: 0 0 0 2px rgba(51, 204, 102, 0.3);
}

.view-mode-dropdown select option {
    background: var(--graiph-bg-surface);
    color: var(--graiph-text-primary);
}

/* Tray Selector — Container styles now in shared/header.css (.gh-tray-selector-*)
   Item styles below are for dynamically generated tray list items */
.tray-selector-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
}

.tray-selector-item:last-child {
    border-bottom: none;
}

.tray-selector-item:hover {
    background: rgba(51, 204, 102, 0.1);
}

.tray-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    cursor: pointer;
}

.tray-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--graiph-accent);
    cursor: pointer;
}

.tray-checkbox .tray-name {
    font-size: 12px;
    color: var(--graiph-text-primary);
}

.tray-checkbox .tray-depth {
    font-size: 10px;
    color: var(--graiph-text-muted);
    margin-left: auto;
}

.tray-visibility-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--graiph-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tray-visibility-btn:hover {
    background: rgba(51, 204, 102, 0.2);
    color: var(--graiph-text-secondary);
}

.tray-visibility-btn.visible {
    color: var(--graiph-accent-text);
}

.tray-visibility-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tray-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--graiph-border);
    color: var(--graiph-text-secondary);
}

.tray-status.loaded {
    background: rgba(51, 204, 102, 0.2);
    color: var(--graiph-accent-text);
}

/* =========================================================================
   MAIN CONTENT - 3 PANEL LAYOUT (Left | Center | Scrollbar)
   3D is now rendered as a column inside centerPanel
   ========================================================================= */
#mainContent {
    display: grid;
    grid-template-columns: 3fr 1fr;
    overflow: hidden;
    height: 100%;
}

#mainContent.context-hidden {
    grid-template-columns: 1fr;
}

#mainContent.context-hidden #unifiedScrollContainer {
    grid-template-columns: 180px 1fr 16px;
}

/* Unified Scroll Container: Overview | Center | Scrollbar */
#unifiedScrollContainer {
    display: grid;
    grid-template-columns: 180px 1fr 16px;
    overflow: hidden;
    position: relative;
    height: 100%;
}

/* Left Panel - Three equal columns: Overview | RQD | FF (60px each = 180px total) */
#leftPanel {
    background: var(--graiph-bg-secondary);
    border-right: 1px solid var(--graiph-border);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-columns: 60px 60px 60px;
}

/* Overview Section - First column in left panel */
#overviewSection {
    width: 100%;
    height: 100%;
    position: relative;
    background: var(--graiph-bg-primary);
}

#overviewCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* RQD and FF columns in left panel */
#leftRQDColumn,
#leftFFColumn {
    background: var(--graiph-bg-secondary);
    border-left: 1px solid var(--graiph-border);
    overflow: hidden;
    position: relative;
}

/* Hidden state for left panel columns */
#overviewSection.hidden,
#leftRQDColumn.hidden,
#leftFFColumn.hidden {
    display: none;
}

#leftRQDCanvas,
#leftFFCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#viewportIndicator {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(51, 204, 102, 0.25);
    border: 2px solid var(--graiph-accent);
    pointer-events: none;
    box-sizing: border-box;
    z-index: 10;
}

/* Detail Section - Bottom portion of left panel */
#detailSection {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

#detailWrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

#detailCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* Center Panel */
#centerPanel {
    background: var(--graiph-bg-secondary);
    overflow: hidden;
    position: relative;
}

/* Content Area: 2D + 3D side by side */
#centerContentArea {
    display: flex;
    flex-direction: row;
    justify-content: center;
    height: 100%;
    position: relative;
}

/* Balancing spacer - matches right columns width to keep gutter visually centered */
/* Width is set dynamically via CSS variable updated by JavaScript */
#centerContentArea::before {
    content: '';
    width: var(--right-columns-width, 150px);
    flex-shrink: 0;
}

#centerWrapper {
    flex: none; /* Don't expand - size to content */
    height: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    position: relative;
    /* Hide native scrollbar - we use unified scrollbar instead */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

#centerWrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* 3D Column - Flows after 2D content */
#threeDColumn {
    width: 150px;
    height: 100%;
    background: var(--graiph-bg-secondary);
    border-left: 1px solid var(--graiph-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

#threeDColumn.hidden {
    display: none;
}

/* View Mode Toggle - 2D/3D switching */
/* When in 3D mode, 3D overlays the gutter images area while columns remain visible on canvas */

/* CSS custom properties for dynamic positioning (set by JS) */
:root {
    --gutter-area-left: 0px;
    --gutter-area-width: 300px;
    --bottombar-height: 56px;
}

/* In 3D mode: position 3D as fixed overlay over the gutter area */
body[data-view-mode="3d"] #threeDColumn {
    position: fixed;
    left: var(--gutter-area-left);
    width: var(--gutter-area-width);
    top: var(--topbar-height, 56px);
    bottom: var(--bottombar-height, 56px);
    height: auto; /* Override base height: 100% to use top/bottom positioning */
    border-left: 1px solid var(--graiph-border);
    border-right: 1px solid var(--graiph-border);
    z-index: 15; /* Above canvas but below controls */
    background: var(--graiph-bg-secondary);
}

/* Keep the ::before spacer visible in 3D mode to maintain stable layout */
/* The 3D overlay positions itself over the gutter area without shifting the canvas */

/* SVG icon visibility for view mode toggle */
#viewModeToggleBtn svg.hidden {
    display: none;
}

/* Hide 3D-specific controls in 2D mode */
body[data-view-mode="2d"] .threeD-fracture-toggle {
    display: none;
}

#threeDColumn #threeDContainer {
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Adjust fracture legend position within 3D column */
#threeDColumn .fracture-legend {
    left: 8px;
    bottom: 8px;
}

#imageCanvas {
    display: block;
    margin: 0 auto;
}

/* Fracture Overlay Canvas - positioned above imageCanvas for interactive fractures */
/* Uses margin: 0 auto centering to match imageCanvas positioning during zoom */
#fractureOverlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    pointer-events: auto;
    z-index: 10;
}

#threeDContainer {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fracture Category Legend */
.fracture-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 100;
    background: var(--graiph-bg-elevated);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 11px;
    min-width: 100px;
}

.fracture-legend .legend-title {
    color: var(--graiph-text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.5px;
}

.fracture-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.fracture-legend .legend-item:last-child {
    margin-bottom: 0;
}

.fracture-legend .legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
}

.fracture-legend .legend-label {
    color: var(--graiph-text-primary);
    white-space: nowrap;
}

.fracture-legend .legend-divider {
    height: 1px;
    background: var(--graiph-border);
    margin: 8px 0;
}

/* Legend visibility control */
#fractureLegend.hidden {
    display: none;
}

/* Context Panel */
#contextPanel {
    background: var(--graiph-bg-surface);
    border-left: 1px solid var(--graiph-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    height: 100%;
}

#contextPanel.hidden {
    display: none !important;
    width: 0;
    min-width: 0;
}

#contextHeader {
    padding: 12px;
    border-bottom: 1px solid var(--graiph-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#contextHeader h3 {
    font-size: 0.9rem;
    color: var(--graiph-accent-text);
}

#contextImagesContainer {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.context-tray {
    margin-bottom: 8px;
    border-radius: 6px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.context-tray.active {
    border-color: var(--graiph-accent);
    box-shadow: 0 0 12px rgba(51, 204, 102, 0.5);
}

.context-tray.depth-issue {
    border-color: var(--graiph-alert-warning);
}

.context-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
}

.context-tray-label {
    font-size: 0.7rem;
    color: var(--graiph-text-secondary);
}

.context-tray-hd-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.context-hd-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #8b5cf6;
}

.context-hd-label {
    font-size: 0.65rem;
    color: #a78bfa;
    cursor: pointer;
    font-weight: 600;
}

.context-hd-checkbox:checked + .context-hd-label {
    color: #8b5cf6;
}

.context-hd-checkbox:disabled + .context-hd-label {
    color: var(--graiph-text-muted);
}

.context-tray-img-wrapper {
    position: relative;
    width: 100%;
}

.context-tray-img {
    width: 100%;
    display: block;
}

.context-focus-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.context-focus-rect {
    position: absolute;
    border: 2px solid var(--graiph-accent);
    background: rgba(51, 204, 102, 0.15);
    box-shadow: 0 0 8px rgba(51, 204, 102, 0.6);
    pointer-events: none;
}

/* Loading overlay */
#loadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--graiph-overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#loadingOverlay.hidden {
    display: none;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--graiph-border);
    border-top-color: var(--graiph-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loadingMessage {
    margin-top: 16px;
    color: var(--graiph-text-secondary);
    font-size: 0.9rem;
}

/* =========================================================================
   UNIFIED SCROLLBAR - Positioned to left of center panel
   ========================================================================= */
#unifiedScrollbar {
    background: var(--graiph-bg-tertiary);
    border-left: 1px solid var(--graiph-border);
    border-right: 1px solid var(--graiph-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#unifiedScrollThumb {
    position: absolute;
    left: 2px;
    right: 2px;
    width: auto;
    min-height: 30px;
    background: rgba(51, 204, 102, 0.6);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

#unifiedScrollThumb:hover,
#unifiedScrollThumb.dragging {
    background: rgba(51, 204, 102, 0.9);
}

/* =========================================================================
   TOGGLE CONTAINER - Vertical stack between left panel and scrollbar
   ========================================================================= */
#toggleContainer {
    background: var(--graiph-bg-tertiary);
    border-left: 1px solid var(--graiph-border);
    border-right: 1px solid var(--graiph-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 4px;
    gap: 8px;
}

.vertical-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 4px;
    background: var(--graiph-bg-surface);
    border-radius: 4px;
    border: 1px solid var(--graiph-border);
    cursor: pointer;
    transition: all 0.2s;
}

.vertical-toggle:hover {
    background: rgba(51, 204, 102, 0.2);
    border-color: var(--graiph-accent);
}

.vertical-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--graiph-accent);
}

.vertical-toggle .toggle-label {
    font-size: 0.6rem;
    color: var(--graiph-text-secondary);
    text-align: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
}

.vertical-toggle:has(input:checked) .toggle-label {
    color: var(--graiph-accent-text);
}

.toggle-divider {
    width: 80%;
    height: 1px;
    background: var(--graiph-border);
    margin: 4px 0;
}

.toggle-section-label {
    font-size: 0.55rem;
    color: var(--graiph-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

/* Comparison toggle special styling */
.comparison-toggle:has(input:checked) .toggle-label {
    background: #7c3aed;
    border-color: #8b5cf6;
}

/* Corrections status indicator */
.corrections-status {
    font-size: 0.55rem;
    color: var(--graiph-alert-warning);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding: 4px 2px;
    background: rgba(245, 166, 35, 0.1);
    border-radius: 4px;
    cursor: help;
}

.corrections-status.hidden {
    display: none;
}

/* =========================================================================
   BOTTOM BAR
   ========================================================================= */
#bottomBar {
    background: var(--graiph-bg-surface);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 24px;
    border-top: 1px solid var(--graiph-border);
    flex-wrap: wrap;
}

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

.control-section h4 {
    font-size: 0.8rem;
    color: var(--graiph-accent-text);
    margin-right: 8px;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-group label {
    font-size: 0.75rem;
    color: var(--graiph-text-secondary);
    min-width: 50px;
}

.slider-group input[type="range"] {
    width: 120px;
    cursor: pointer;
}

.slider-group .value {
    font-size: 0.75rem;
    color: var(--graiph-text-primary);
    min-width: 50px;
    text-align: right;
}

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

.btn.sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

#depthDisplay {
    font-size: 0.85rem;
    color: var(--graiph-text-primary);
    font-weight: 600;
    min-width: 80px;
}

/* Object Colors */
:root {
    --color-intact-rock: #ef4444;
    --color-exposed-rock: #ef4444;
    --color-grinding: #a855f7;
    --color-depth-block: #d4a574;
    --color-false-depth-block: #d4a574;
    --color-fracture: #00FFFF;
    --color-small-rock: #f97316;
}

/* =========================================================================
   CONTEXT MENU - Right-click menu for class section operations
   ========================================================================= */
.context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 150px;
    background: var(--graiph-bg-surface);
    border: 1px solid var(--graiph-border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    padding: 4px 0;
    font-size: 0.85rem;
}

.context-menu.hidden {
    display: none;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--graiph-text-primary);
    transition: background 0.15s ease, color 0.15s ease;
}

.context-menu-item:hover {
    background: rgba(51, 204, 102, 0.3);
    color: #ffffff;
}

.context-menu-item.delete-item:hover {
    background: rgba(229, 57, 53, 0.3);
    color: #ff8a80;
}

.context-menu-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.context-menu-separator {
    height: 1px;
    background: var(--graiph-border);
    margin: 4px 0;
}

/* =========================================================================
   DEPTH MARK INPUT - Input for adding depth marks to IntactRock
   ========================================================================= */
.depth-mark-input {
    position: fixed;
    z-index: 10001;
    background: var(--graiph-bg-surface);
    border: 1px solid var(--graiph-border-hover);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    font-size: 0.85rem;
}

.depth-mark-input label {
    color: var(--graiph-text-secondary);
    white-space: nowrap;
}

.depth-mark-input input {
    width: 90px;
    background: var(--graiph-bg-secondary);
    border: 1px solid var(--graiph-border);
    color: var(--graiph-text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.depth-mark-input input:focus {
    outline: none;
    border-color: var(--graiph-accent);
}

.depth-mark-input button {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.15s ease;
}

.depth-mark-input button:hover {
    opacity: 0.85;
}

.depth-mark-input button.confirm {
    background: var(--graiph-accent);
    color: var(--graiph-accent-ink);
}

.depth-mark-input button.cancel {
    background: var(--graiph-alert-error);
    color: white;
}

/* Depth Mark Mode */
.depth-mark-mode {
    cursor: crosshair !important;
}

#addDepthMarkBtn.active {
    background: var(--graiph-alert-warning);
    /* The ink has to flip with the fill: --graiph-alert-warning is #F5A623 in dark and
       #A05F00 in light (TEL-50), so a fixed #000 goes from 10:1 to 4.1:1. The page
       background is the ink that is always furthest from the fill — same trick as
       .fd-stats-run-btn[data-state="stale"] in the field describer. */
    color: var(--graiph-bg-primary);
    box-shadow: 0 0 8px rgba(245, 166, 35, 0.5);
}

#depthMarkStatus {
    font-size: 11px;
    color: var(--graiph-alert-warning);
    margin-left: 8px;
}

.status-text {
    font-size: 11px;
    color: var(--graiph-text-secondary);
}

/* =========================================================================
   DEPTH BLOCK EDITOR - Click-to-edit panel for DepthBlock/FalseDepthBlock
   ========================================================================= */
.depth-block-editor {
    position: fixed;
    z-index: 10001;
    background: var(--graiph-bg-surface);
    border: 1px solid var(--graiph-border-hover);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 240px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    font-size: 0.85rem;
}

.depth-block-editor.hidden {
    display: none;
}

.depth-block-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--graiph-border);
}

.depth-block-editor-title {
    font-weight: 600;
    color: var(--graiph-alert-warning);
    font-size: 0.9rem;
}

.depth-block-editor-close {
    background: none;
    border: none;
    color: var(--graiph-text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.depth-block-editor-close:hover {
    color: var(--graiph-alert-error);
}

.depth-block-editor-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.depth-block-editor-field label {
    color: var(--graiph-text-secondary);
    min-width: 100px;
    font-size: 0.8rem;
}

.depth-block-editor-field input {
    flex: 1;
    background: var(--graiph-bg-secondary);
    border: 1px solid var(--graiph-border);
    color: var(--graiph-text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    width: 80px;
}

.depth-block-editor-field input:focus {
    outline: none;
    border-color: var(--graiph-accent);
}

.depth-block-editor-field .unit {
    color: var(--graiph-text-muted);
    font-size: 0.8rem;
    min-width: 20px;
}

.depth-block-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--graiph-border);
}

.depth-block-editor-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: opacity 0.15s ease;
}

.depth-block-editor-actions button:hover {
    opacity: 0.85;
}

.depth-block-editor-actions .save-btn {
    background: var(--graiph-accent);
    color: var(--graiph-accent-ink);
}

.depth-block-editor-actions .cancel-btn {
    background: var(--graiph-text-muted);
    color: white;
}


/* Tray nav controls — now in shared/header.css (.gh-tray-nav, .gh-tray-position, .gh-window-size) */

/* =========================================================================
   TRAY SELECTOR - JUMP TO DROPDOWN
   ========================================================================= */
.tray-selector-item.active {
    background: rgba(51, 204, 102, 0.2);
    border-left: 3px solid var(--graiph-accent);
}

.tray-selector-item.in-window {
    background: rgba(51, 204, 102, 0.1);
}

.tray-selector-item.active.in-window {
    background: rgba(51, 204, 102, 0.2);
}

.tray-jump-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s ease;
}

.tray-jump-btn:hover {
    background: rgba(51, 204, 102, 0.15);
}

.tray-jump-btn .tray-name {
    font-size: 12px;
    color: var(--graiph-text-primary);
    font-weight: 500;
}

.tray-jump-btn .tray-depth {
    font-size: 10px;
    color: var(--graiph-text-muted);
    margin-left: auto;
}

.tray-window-indicator {
    color: var(--graiph-accent-text);
    font-size: 10px;
    margin-left: 4px;
}

/* Depth overlap warning indicator */
.tray-selector-item.depth-issue {
    background: rgba(229, 57, 53, 0.1);
}

.tray-selector-item.depth-issue:hover {
    background: rgba(229, 57, 53, 0.2);
}

.depth-warning {
    color: var(--graiph-alert-warning);
    font-size: 12px;
    margin-left: 4px;
    cursor: help;
}

/* =========================================================================
   NAVIGATION MODAL - Unsaved Changes Warning
   ========================================================================= */
.nav-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.nav-modal {
    background: var(--graiph-bg-surface);
    border: 1px solid var(--graiph-border);
    border-radius: 12px;
    padding: 24px;
    min-width: 360px;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.nav-modal-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--graiph-alert-warning);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-modal-header::before {
    content: '⚠️';
}

.nav-modal-body {
    color: var(--graiph-text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.nav-modal-body p {
    margin: 0 0 8px 0;
}

.nav-modal-body .dirty-trays {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: var(--graiph-text-secondary);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-top: 8px;
}

.nav-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.nav-modal-actions .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
}

.nav-modal-actions .btn.secondary {
    background: var(--graiph-border-hover);
    color: white;
}

.nav-modal-actions .btn.secondary:hover {
    background: var(--graiph-text-muted);
}

/* =========================================================================
   HELP BUTTON & MODAL
   ========================================================================= */
.btn.icon-btn {
    padding: 6px 8px;
    background: transparent;
    border: 1px solid var(--graiph-border-hover);
    border-radius: 4px;
    color: var(--graiph-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

/* Help Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--graiph-bg-surface);
    border-radius: 12px;
    border: 1px solid var(--graiph-border);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.help-modal-content {
    width: 800px;
}

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

.modal-header h2 {
    color: var(--graiph-accent-text);
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--graiph-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #f87171;
}

.modal-body {
    padding: 24px;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.shortcuts-section h3 {
    color: var(--graiph-accent-text);
    font-size: 0.9rem;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--graiph-border);
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.shortcut-item kbd {
    background: var(--graiph-border);
    border: 1px solid var(--graiph-border-hover);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    color: var(--graiph-alert-warning);
    min-width: 24px;
    text-align: center;
}

.shortcut-item span {
    color: var(--graiph-text-primary);
}
