/* Terminal-specific styles to contain xterm.js */
.xterm-container {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Ensure xterm fills its container */
.xterm-container .xterm {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: 100%;
}

/* Override any xterm styles that might cause full-screen issues */
.xterm-container .xterm-screen {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
}

/* Style the terminal viewport for better appearance */
.xterm-container .xterm-viewport {
  overflow-y: auto !important;
  overscroll-behavior: none;
}

@supports not selector(::-webkit-scrollbar) {
  .xterm-container .xterm-viewport {
    scrollbar-color: var(--app-scrollbar-thumb) var(--app-scrollbar-track);
    scrollbar-width: thin;
  }
}

/* Improve scrollbar styling */
.xterm-container .xterm-viewport::-webkit-scrollbar {
  -webkit-appearance: none !important;
  width: var(--app-scrollbar-size) !important;
  height: var(--app-scrollbar-size) !important;
  background-color: var(--app-scrollbar-track) !important;
}

.xterm-container .xterm-viewport::-webkit-scrollbar-track {
  -webkit-appearance: none !important;
  background-color: var(--app-scrollbar-track) !important;
}

.xterm-container .xterm-viewport::-webkit-scrollbar-corner {
  background-color: var(--app-scrollbar-track) !important;
}

.xterm-container .xterm-viewport::-webkit-scrollbar-thumb {
  -webkit-appearance: none !important;
  min-height: 36px !important;
  border: var(--app-scrollbar-thumb-border) !important;
  border-radius: var(--app-scrollbar-radius) !important;
  background-color: rgba(120, 120, 120, 0.42) !important;
  background-color: var(--app-scrollbar-thumb) !important;
  background-clip: content-box !important;
}

.xterm-container .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background-color: rgba(105, 105, 105, 0.62) !important;
  background-color: var(--app-scrollbar-thumb-hover) !important;
  background-clip: content-box !important;
}

/* Terminal cursor improvements */
.xterm-container .xterm-cursor-layer {
  /* Cursor will use theme colors */
}

/* Better selection styling */
.xterm-container .xterm-selection-layer {
  /* Selection will use theme colors */
}

/* Ensure terminal search stays on top */
.terminal-search {
  z-index: 100;
}

/* xterm.js WebLinksAddon creates a canvas layer for links */
.xterm .xterm-link-layer {
  z-index: 10;
}

/* When hovering over a link, xterm applies this class */
.xterm-screen .xterm-decoration-overview-ruler {
  display: none;
}

/* Override xterm cursor when hovering links */
.xterm.xterm-cursor-pointer {
  cursor: pointer !important;
}
