@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --scrollbar-thumb: rgba(16, 185, 129, 0.4);
  --scrollbar-track: rgba(18, 18, 22, 0.85);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #07080c;
  color: #f4f4f5;
  overflow: hidden;
}

/* Matrix Rain Canvas Background */
#matrixBgCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
  transition: opacity 0.4s ease;
}

body.fx-off #matrixBgCanvas {
  opacity: 0 !important;
}

/* Cyberpunk Neon Phosphor Glow Effect */
body.fx-glow .xterm-rows {
  text-shadow: 0 0 5px rgba(52, 211, 153, 0.32);
}

body.fx-glow .term-pane.active-pane {
  border-color: rgba(16, 185, 129, 0.75) !important;
  box-shadow: inset 0 0 22px rgba(16, 185, 129, 0.08), 0 0 16px rgba(16, 185, 129, 0.18);
}

body.fx-matrix .term-pane,
body.fx-matrix .term-pane-body,
body.fx-matrix .xterm-viewport {
  background-color: rgba(8, 10, 14, 0.84) !important;
}

/* Telemetry Pills & Mini Progress Bars */
.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.15rem 0.5rem;
  background-color: rgba(9, 9, 11, 0.9);
  border: 1px solid #27272a;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.telemetry-pill:hover {
  border-color: #10b981;
  background-color: #18181b;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.telemetry-bar {
  width: 28px;
  height: 5px;
  background-color: #27272a;
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
}

.telemetry-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* Quick Launch 1-Click Chips in Subheader */
.quick-launch-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.55rem;
  border-radius: 0.375rem;
  border-width: 1px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-launch-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.quick-launch-chip:active {
  transform: scale(0.95);
}

.no-scrollbar {
  scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Pulse Dot Animation */
@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}

.pulse-dot {
  animation: pulseGlow 2.4s infinite ease-in-out;
}

/* Studio Sidebar Styling */
#studioSidebar {
  width: 360px;
  max-width: 90vw;
  background: linear-gradient(180deg, rgba(16, 17, 23, 0.97) 0%, rgba(10, 11, 16, 0.98) 100%);
  border-left: 1px solid rgba(16, 185, 129, 0.28);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  z-index: 25;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.studio-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0.4rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #a1a1aa;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
}

.studio-tab-btn:hover {
  color: #f4f4f5;
  background-color: rgba(39, 39, 42, 0.45);
}

.studio-tab-btn.active {
  color: #34d399;
  border-bottom-color: #10b981;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.16) 100%);
}

.studio-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(20, 21, 28, 0.9);
  border: 1px solid rgba(63, 63, 70, 0.7);
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: left;
}

.studio-card:hover {
  border-color: #10b981;
  background: rgba(26, 30, 38, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.15);
}

.studio-card:active {
  transform: scale(0.98);
}

/* High-Contrast Action Buttons in Shortcuts Deck */
.vk-btn-action {
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 0.375rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  transition: all 0.1s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.vk-btn-action:active {
  transform: scale(0.95);
}

.vk-btn-nav,
.vk-btn-sym,
.vk-btn-enter {
  height: 2.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 0.375rem;
  border: 1px solid #3f3f46;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: all 0.1s ease;
}

.vk-btn-enter {
  border-color: #059669;
}

.vk-btn-nav:active,
.vk-btn-sym:active,
.vk-btn-enter:active {
  transform: scale(0.95);
}

/* Docked Virtual Keyboard Container */
.vk-container {
  user-select: none;
  touch-action: manipulation;
}

.vk-drag-handle {
  width: 36px;
  height: 4px;
  background: #52525b;
  border-radius: 2px;
  margin: 2px auto 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.vk-drag-handle:hover {
  background: #10b981;
}

.vk-row {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
  width: 100%;
}

.vk-key {
  height: 2.35rem;
  min-width: 1.9rem;
  flex: 1;
  max-width: 4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f4f4f5;
  background-color: #1f1f26;
  border: 1px solid #383842;
  border-radius: 0.375rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.05s ease, background-color 0.1s ease;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.35);
}
.vk-key:hover {
  background-color: #2e2e38;
  border-color: #52525b;
}
.vk-key:active {
  transform: scale(0.93);
}

.vk-key-special {
  background-color: #16161d;
  border-color: #32323e;
  color: #a1a1aa;
  font-size: 0.78rem;
  font-weight: 700;
}
.vk-key-danger {
  color: #ffffff;
  background-color: #dc2626;
  border-color: #ef4444;
}
.vk-key-warning {
  color: #fef08a;
  background-color: #854d0e;
  border-color: #ca8a04;
}
.vk-key-enter {
  background-color: #10b981;
  color: #ffffff;
  border-color: #34d399;
  font-weight: 800;
  flex: 1.6;
}
.vk-key-space {
  flex: 3.5;
  max-width: 18rem;
  background-color: #1c1c22;
  color: #a1a1aa;
  font-size: 0.8rem;
}

/* Modifiers Active & Locked State */
.vk-btn-action.active, .vk-key.active {
  background-color: #10b981 !important;
  color: #ffffff !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6) !important;
}

.vk-btn-action.locked, .vk-key.locked {
  background-color: #f59e0b !important;
  color: #09090b !important;
  border-color: #fbbf24 !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6) !important;
}

/* Multi-Pane Split Layouts */
.layout-single {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

.layout-split-v {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
}

.layout-split-h {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.layout-grid-4 {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.layout-grid-4 .grid-row {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
}

/* Resize handle between panes */
.pane-resizer {
  background: #27272a;
  transition: background 0.15s;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.pane-resizer:hover,
.pane-resizer.dragging {
  background: #10b981;
}

.pane-resizer-v {
  width: 5px;
  cursor: col-resize;
  height: 100%;
}

.pane-resizer-v::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  right: -10px;
  z-index: 30;
}

.pane-resizer-h {
  height: 5px;
  cursor: row-resize;
  width: 100%;
}

.pane-resizer-h::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  bottom: -10px;
  z-index: 30;
}

/* Maximized Pane Overlay */
.term-pane.pane-maximized {
  position: absolute !important;
  inset: 0 !important;
  z-index: 100 !important;
  width: 100% !important;
  height: 100% !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.4) !important;
}

/* Terminal Pane Styling */
.term-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: rgba(9, 9, 11, 0.92);
  border: 1px solid #27272a;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.layout-split-v .term-pane,
.layout-split-h .term-pane,
.layout-grid-4 .term-pane {
  border-radius: 0.375rem;
}

.term-pane.active-pane {
  border-color: #10b981;
}

.term-pane-header {
  flex-shrink: 0;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  background-color: rgba(18, 18, 22, 0.95);
  border-bottom: 1px solid #27272a;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: #a1a1aa;
  user-select: none;
  cursor: pointer;
}

.term-pane.active-pane .term-pane-header {
  background-color: rgba(20, 28, 26, 0.96);
  color: #f4f4f5;
  border-bottom-color: rgba(16, 185, 129, 0.45);
}

.term-pane-body {
  position: relative;
  flex: 1 1 0%;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background-color: var(--term-bg, #09090b);
  touch-action: none;
}

.term-pane-body .xterm {
  padding: 4px 6px !important;
  width: 100% !important;
  height: 100% !important;
}

.term-pane-body .xterm-screen {
  width: 100% !important;
  touch-action: none !important;
}

/* Standard Scrollbar Properties */
.term-pane-body .xterm-viewport,
#cmdList,
#servicesListContainer,
.studio-scroll {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  scrollbar-width: thin;
}

.term-pane-body .xterm-viewport {
  width: 100% !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: none !important;
}

/* Tab Item Styling */
.tab-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  background-color: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.375rem;
  color: #a1a1aa;
  font-size: 0.73rem;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-item:hover {
  background-color: #27272a;
  color: #f4f4f5;
  border-color: #3f3f46;
}

.tab-item.active {
  background-color: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
  border-color: #10b981 !important;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.layout-single .term-pane {
  width: 100% !important;
  height: 100% !important;
  flex: 1 1 100% !important;
  max-width: 100% !important;
}

/* Visibility helper */
.wt-hidden {
  display: none !important;
}

.term-pane:not(.wt-hidden) {
  display: flex !important;
}

.layout-split-v .term-pane:not(.wt-hidden) {
  height: 100% !important;
}

.layout-split-h .term-pane:not(.wt-hidden) {
  width: 100% !important;
}

/* Floating Scroll Controls inside each terminal pane */
.pane-scroll-controls {
  position: absolute;
  bottom: 8px;
  right: 14px;
  z-index: 40;
  display: flex;
  gap: 4px;
  pointer-events: auto;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.pane-scroll-controls:hover {
  opacity: 1;
}

.pane-scroll-btn {
  background: rgba(24, 24, 27, 0.88);
  backdrop-filter: blur(6px);
  color: #d4d4d8;
  border: 1px solid rgba(82, 82, 91, 0.8);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 2px;
  user-select: none;
}

.pane-scroll-btn:hover {
  color: #fff;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.3);
}
