/* VesselBoost Styles */

:root {
  --color-bg: #0f1419;
  --color-surface: #1a2332;
  --color-surface-elevated: #232f42;
  --color-border: #2d3f5a;
  --color-border-light: #3d5275;

  --color-text: #e8edf4;
  --color-text-muted: #8b99ad;
  --color-text-dim: #5c6b7f;

  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-glow: rgba(59, 130, 246, 0.25);

  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.1);

  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);

  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.1);

  --color-accent: #8b5cf6;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px var(--color-primary-glow);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--color-bg); color: var(--color-text); line-height: 1.5; }

.app-container { display: grid; grid-template-columns: 320px 1fr; grid-template-rows: auto 1fr auto; height: 100vh; max-height: 100vh; gap: 0; overflow: hidden; }

.app-header { grid-column: 1 / -1; background: var(--color-surface); border-bottom: 1px solid var(--color-border); padding: var(--space-sm) var(--space-lg); display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: var(--space-sm); }
.logo h1 { font-size: 1rem; font-weight: 600; letter-spacing: -0.02em; }
.logo span { color: var(--color-text-muted); font-weight: 400; font-size: 0.85rem; margin-left: var(--space-xs); }
.logo .version { font-size: 0.7rem; opacity: 0.6; margin-left: var(--space-xs); }

.app-sidebar { background: var(--color-surface); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-status { flex-shrink: 0; padding: var(--space-sm) var(--space-md); background: var(--color-surface-elevated); border-top: 1px solid var(--color-border); }
.status-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-xs); }
.status-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.status-value { font-size: 0.7rem; color: var(--color-text); font-weight: 500; }
.status-right { display: flex; align-items: center; gap: var(--space-sm); }

.btn-status-cancel { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; background: transparent; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-muted); cursor: pointer; transition: all var(--transition-fast); opacity: 0; pointer-events: none; }
.btn-status-cancel:not(:disabled) { opacity: 1; pointer-events: auto; border-color: var(--color-error); color: var(--color-error); }
.btn-status-cancel:not(:disabled):hover { background: var(--color-error); color: white; }

.sidebar-section { border-bottom: 1px solid var(--color-border); }
.sidebar-section:last-child { border-bottom: none; }
.section-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); padding: var(--space-md); margin: 0; display: flex; align-items: center; gap: var(--space-sm); cursor: pointer; user-select: none; transition: background var(--transition-fast), color var(--transition-fast); }
.section-title:hover { background: var(--color-surface-elevated); color: var(--color-text); }
.section-title svg { width: 14px; height: 14px; flex-shrink: 0; }
.section-title::after { content: ''; margin-left: auto; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; transition: transform var(--transition-fast); }
.sidebar-section.collapsed .section-title::after { transform: rotate(-90deg); }
.section-content { padding: 0 var(--space-md) var(--space-md); overflow: hidden; transition: max-height 0.25s ease-out, padding 0.25s ease-out, opacity 0.2s ease-out; max-height: 1000px; opacity: 1; }
.sidebar-section.collapsed .section-content { max-height: 0; padding-top: 0; padding-bottom: 0; opacity: 0; }

.input-mode-tabs { display: flex; gap: 2px; margin-bottom: var(--space-sm); background: var(--color-surface); border-radius: var(--radius-sm); padding: 2px; border: 1px solid var(--color-border); }
.input-mode-tab { flex: 1; padding: 5px 4px; font-size: 0.65rem; font-weight: 500; color: var(--color-text-muted); background: transparent; border: none; border-radius: calc(var(--radius-sm) - 2px); cursor: pointer; transition: all 0.15s ease; white-space: nowrap; }
.input-mode-tab:hover { color: var(--color-text); background: rgba(255, 255, 255, 0.05); }
.input-mode-tab.active { color: var(--color-text); background: var(--color-primary); font-weight: 600; }
.input-mode-content { display: none; }
.input-mode-content.active { display: block; }

.file-upload-group { margin-bottom: var(--space-sm); }
.file-upload-group:last-child { margin-bottom: 0; }
.file-upload-zone { position: relative; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); padding: var(--space-sm) var(--space-md); text-align: center; cursor: pointer; transition: all var(--transition-fast); background: transparent; display: flex; align-items: center; gap: var(--space-sm); }
.file-upload-zone:hover { border-color: var(--color-primary); background: var(--color-primary-glow); }
.file-upload-zone.dragover { border-color: var(--color-primary); background: var(--color-primary-glow); border-style: solid; }
.file-upload-zone.has-files { border-color: var(--color-success); border-style: solid; background: var(--color-success-bg); }
.file-upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--color-text-muted); }
.file-upload-zone:hover .upload-icon { color: var(--color-primary); }
.upload-text { font-size: 0.75rem; color: var(--color-text-muted); }

.file-list { margin-top: var(--space-xs); max-height: 60px; overflow-y: auto; }
.file-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-xs) var(--space-sm); background: var(--color-surface-elevated); border-radius: var(--radius-sm); margin-bottom: var(--space-xs); font-size: 0.75rem; }
.file-item:last-child { margin-bottom: 0; }
.file-remove { background: none; border: none; color: var(--color-text-dim); cursor: pointer; padding: 2px; display: flex; transition: color var(--transition-fast); }
.file-remove:hover { color: var(--color-error); }

.param-group { margin-bottom: var(--space-sm); }
.param-group:last-child { margin-bottom: 0; }
.param-label { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 500; margin-bottom: 2px; }

.info-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--color-text-muted); color: var(--color-text-muted); font-size: 9px; font-weight: 700; font-style: normal; cursor: help; flex-shrink: 0; }
.info-icon .info-tooltip { display: none; position: fixed; background: var(--color-surface-elevated); border: 1px solid var(--color-border-light); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 0.75rem; font-weight: 400; color: var(--color-text); white-space: normal; width: 200px; line-height: 1.4; z-index: 10000; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); pointer-events: none; }

input[type="number"], input[type="text"], select { width: 100%; padding: var(--space-xs) var(--space-sm); background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); font-size: 0.8rem; transition: all var(--transition-fast); }
input[type="number"]:focus, input[type="text"]:focus, select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-glow); }
select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b99ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-lg); font-size: 0.875rem; font-weight: 500; border-radius: var(--radius-md); border: none; cursor: pointer; transition: all var(--transition-fast); }
.btn-primary { background: var(--color-primary); color: white; width: 100%; padding: var(--space-sm) var(--space-md); }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); box-shadow: var(--shadow-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--color-surface-elevated); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover:not(:disabled) { background: var(--color-border); border-color: var(--color-border-light); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: var(--space-xs) var(--space-sm); font-size: 0.75rem; }
.btn-icon { background: transparent; border: none; color: var(--color-text-muted); padding: 2px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: color 0.15s, background 0.15s; }
.btn-icon:hover:not(:disabled) { color: var(--color-primary); background: var(--color-surface-elevated); }
.btn-icon:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.viewer-checkbox { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; color: var(--color-text-muted); cursor: pointer; white-space: nowrap; }
.viewer-checkbox input[type="checkbox"] { width: 12px; height: 12px; cursor: pointer; accent-color: var(--color-primary); }

.progress-bar { height: 4px; background: var(--color-border); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); border-radius: 2px; transition: width var(--transition-normal); }

.app-main { display: flex; flex-direction: column; background: var(--color-bg); overflow: hidden; }
.viewer-toolbar { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-xs) var(--space-md); background: var(--color-surface); border-bottom: 1px solid var(--color-border); flex-wrap: wrap; }
.view-tabs { display: flex; gap: 2px; }
.view-tab { padding: var(--space-xs) var(--space-sm); font-size: 0.75rem; font-weight: 500; color: var(--color-text-muted); background: transparent; border: none; border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast); }
.view-tab:hover { color: var(--color-text); background: var(--color-surface-elevated); }
.view-tab.active { color: var(--color-primary); background: var(--color-primary-glow); }
.view-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.viewer-actions { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }

.window-controls { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; }
.window-input { width: 80px; max-width: 80px; padding: 3px 3px; font-size: 0.7rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); text-align: center; -moz-appearance: textfield; }
.window-input::-webkit-outer-spin-button, .window-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.window-input::placeholder { color: var(--color-text-muted); font-size: 0.65rem; }
.window-controls .btn-sm { padding: 3px 8px; font-size: 0.65rem; }

.range-slider-container { position: relative; width: 135px; height: 20px; display: flex; align-items: center; }
.range-track { position: absolute; width: 100%; height: 4px; background: var(--color-border); border-radius: 2px; pointer-events: none; z-index: 1; }
.range-selected { position: absolute; height: 4px; background: var(--color-primary); border-radius: 2px; pointer-events: none; z-index: 2; }
.range-slider { position: absolute; width: 100%; height: 20px; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; margin: 0; z-index: 3; }
.range-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background: var(--color-primary); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid white; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); position: relative; z-index: 10; }
.range-slider::-moz-range-thumb { width: 16px; height: 16px; background: var(--color-primary); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid white; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.range-min { z-index: 4; }
.range-max { z-index: 3; }

.viewer-canvas-wrapper { flex: 1; position: relative; background: #000; min-height: 0; }
.viewer-canvas-wrapper canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

.viewer-info { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-xs) var(--space-md); background: var(--color-surface); border-top: 1px solid var(--color-border); font-size: 0.7rem; font-family: 'SF Mono', 'Consolas', monospace; color: var(--color-text-muted); }
.viewer-info-primary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-info-label { flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-dim); }

.console-container { height: 120px; flex-shrink: 0; background: var(--color-surface); border-top: 1px solid var(--color-border); display: flex; flex-direction: column; }
.console-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.console-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.console-clear { font-size: 0.7rem; color: var(--color-text-dim); background: none; border: none; cursor: pointer; transition: color var(--transition-fast); }
.console-clear:hover { color: var(--color-text-muted); }
.console-output { flex: 1; overflow-y: auto; padding: var(--space-xs) var(--space-md); font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.7rem; line-height: 1.5; }
.console-line { display: flex; gap: var(--space-md); }
.console-time { color: var(--color-text-dim); flex-shrink: 0; }
.console-message { color: var(--color-text-muted); }

.app-footer { grid-column: 1 / -1; background: var(--color-surface); border-top: 1px solid var(--color-border); padding: var(--space-xs) var(--space-lg); font-size: 0.65rem; color: var(--color-text-dim); display: flex; align-items: center; justify-content: space-between; }

.opacity-control { display: flex; align-items: center; gap: var(--space-xs); font-size: 0.7rem; color: var(--color-text-muted); margin-left: var(--space-sm); }
.opacity-control input[type="range"] { width: 60px; height: 4px; -webkit-appearance: none; appearance: none; background: var(--color-border); border-radius: 2px; cursor: pointer; }
.opacity-control input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 10px; height: 10px; background: var(--color-primary); border-radius: 50%; cursor: pointer; }
.opacity-control input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; background: var(--color-primary); border-radius: 50%; border: none; cursor: pointer; }
input[type="range"]:disabled { opacity: 0.4; cursor: not-allowed; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-surface); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-border-light); }

.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); max-width: 600px; width: 90%; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: var(--space-lg); border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-muted); transition: color var(--transition-fast); }
.modal-close:hover { color: var(--color-text); }
.modal-body { padding: var(--space-lg); }
.modal-body p { margin-bottom: var(--space-md); font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.6; }
.modal-body p:last-child { margin-bottom: 0; }

.stage-buttons-grid { display: flex; flex-direction: column; gap: var(--space-xs); }
.volume-toggle { display: flex; align-items: center; gap: 6px; }
.volume-toggle .viewer-checkbox { flex: 1; }
.volume-toggle .stage-label { flex: 1; font-size: 0.82rem; color: var(--color-text-muted); }
.volume-toggle .view-btn { padding: var(--space-xs); background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-muted); cursor: pointer; opacity: 0.5; transition: all var(--transition-fast); display: flex; align-items: center; }
.volume-toggle .view-btn:hover { opacity: 1; border-color: var(--color-border-light); }
.volume-toggle .view-btn.active { opacity: 1; border-color: var(--color-primary); color: var(--color-primary); }
.volume-toggle .view-btn svg { width: 12px; height: 12px; }
.volume-toggle .download-btn { padding: var(--space-xs); background: var(--color-surface-elevated); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-muted); cursor: pointer; opacity: 0.6; transition: all var(--transition-fast); display: flex; align-items: center; margin-left: auto; }
.volume-toggle .download-btn:hover { opacity: 1; border-color: var(--color-border-light); }
.volume-toggle .download-btn svg { width: 12px; height: 12px; }

.header-links { display: flex; align-items: center; gap: var(--space-sm); }
.header-link { color: white; text-decoration: none; display: flex; align-items: center; gap: var(--space-xs); background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: opacity 0.15s; opacity: 0.8; font-size: 0.85rem; font-weight: 500; }
.header-link:hover { opacity: 1; }
.header-link svg { display: block; }
.colormap-select { width: auto; padding: var(--space-xs) var(--space-lg) var(--space-xs) var(--space-sm); font-size: 0.75rem; }

.about-modal { max-width: 480px; }
.about-highlight { display: flex; align-items: center; gap: var(--space-md); background: var(--color-surface-elevated); border: 1px solid var(--color-primary); border-radius: var(--radius-md); padding: var(--space-md); margin-bottom: var(--space-lg); }
.about-highlight strong { font-size: 1.1rem; color: var(--color-primary); display: block; margin-bottom: 2px; }
.about-highlight p { font-size: 0.85rem; color: var(--color-text-muted); margin: 0; line-height: 1.4; }
.about-modal h4 { font-size: 0.9rem; margin: var(--space-md) 0 var(--space-sm); color: var(--color-text); }
.about-version-table { display: flex; flex-direction: column; gap: var(--space-xs); }
.about-version-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-xs) var(--space-sm); background: var(--color-surface-elevated); border-radius: var(--radius-sm); font-size: 0.85rem; }
.about-version-label { color: var(--color-text-muted); }
.about-version-value { color: var(--color-text); font-weight: 500; font-variant-numeric: tabular-nums; }

.privacy-modal { max-width: 550px; }
.privacy-highlight { display: flex; align-items: flex-start; gap: var(--space-md); background: var(--color-surface-elevated); border: 1px solid var(--color-primary); border-radius: var(--radius-md); padding: var(--space-md); margin-bottom: var(--space-lg); }
.privacy-highlight strong { font-size: 1rem; color: var(--color-primary); display: block; margin-bottom: var(--space-xs); }
.privacy-highlight p { font-size: 0.85rem; color: var(--color-text-muted); margin: 0; line-height: 1.5; }
.privacy-modal h4 { font-size: 0.9rem; margin: var(--space-md) 0 var(--space-xs); color: var(--color-text); }
.privacy-modal p { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.6; margin: 0 0 var(--space-sm); }
.privacy-list { font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.8; padding-left: var(--space-lg); margin: 0 0 var(--space-sm); }

.citations-modal { max-width: 700px; max-height: 80vh; }
.citations-intro { font-size: 0.85rem; color: var(--color-text-muted); margin: 0 0 var(--space-lg) 0; line-height: 1.5; }
.citation-section { margin-bottom: var(--space-lg); }
.citation-section h4 { font-size: 0.9rem; font-weight: 600; color: var(--color-primary); margin: 0 0 var(--space-sm) 0; padding-bottom: var(--space-xs); border-bottom: 1px solid var(--color-border); }
.citation-item { margin-bottom: var(--space-md); padding-left: var(--space-sm); border-left: 2px solid var(--color-border); }
.citation-item:last-child { margin-bottom: 0; }
.citation-item strong { display: block; font-size: 0.85rem; color: var(--color-text); margin-bottom: 4px; }
.citation-item p { font-size: 0.8rem; color: var(--color-text-muted); margin: 0 0 4px 0; line-height: 1.4; }
.citation-item a { font-size: 0.75rem; color: var(--color-primary); text-decoration: none; }
.citation-item a:hover { text-decoration: underline; }
.citation-ref { display: block; font-size: 0.7rem; color: var(--color-text-muted); margin-bottom: 4px; }
.citation-ref a { color: var(--color-primary); text-decoration: none; }
.citation-ref a:hover { text-decoration: underline; }
.citation-primary { background: var(--color-surface-elevated); border: 1px solid var(--color-primary); border-radius: var(--radius-md); padding: var(--space-md); margin-bottom: var(--space-md); }
.citation-primary .citation-item { margin-bottom: 0; }
.citation-primary strong { font-size: 1.1rem; color: var(--color-primary); }

.hidden { display: none !important; }

@media (max-width: 1024px) {
  .app-container { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; }
  .app-sidebar { border-right: none; border-bottom: 1px solid var(--color-border); max-height: 50vh; }
}
