/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */

/**
 *  Default styles for xterm.js
 */

/* CSS Custom Properties for scrollbar theming - VS Code style */
:root {
    /* Default scrollbar colors (dark theme) */
    --vscode-scrollbar-shadow: #000000;
    --vscode-scrollbarSlider-background: rgba(121, 121, 121, 0.4);
    --vscode-scrollbarSlider-hoverBackground: rgba(100, 100, 100, 0.7);
    --vscode-scrollbarSlider-activeBackground: rgba(191, 191, 191, 0.4);
}

/* Light theme scrollbar colors - matching VS Code's light theme */
.xterm.light-theme {
    --vscode-scrollbar-shadow: #dddddd;
    --vscode-scrollbarSlider-background: rgba(100, 100, 100, 0.4);
    --vscode-scrollbarSlider-hoverBackground: rgba(100, 100, 100, 0.7);
    --vscode-scrollbarSlider-activeBackground: rgba(0, 0, 0, 0.6);
}

/* Dark theme scrollbar colors - matching VS Code's dark theme */
.xterm.dark-theme {
    --vscode-scrollbar-shadow: #000000;
    --vscode-scrollbarSlider-background: rgba(121, 121, 121, 0.4);
    --vscode-scrollbarSlider-hoverBackground: rgba(100, 100, 100, 0.7);
    --vscode-scrollbarSlider-activeBackground: rgba(191, 191, 191, 0.4);
}

/* High contrast theme scrollbar colors */
.xterm.hc-theme {
    --vscode-scrollbar-shadow: #000000;
    --vscode-scrollbarSlider-background: rgba(255, 255, 255, 0.6);
    --vscode-scrollbarSlider-hoverBackground: rgba(255, 255, 255, 0.8);
    --vscode-scrollbarSlider-activeBackground: #ffffff;
}

.xterm {
    cursor: text;
    position: relative;
    user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
    height: 100%;
}

.xterm.focus,
.xterm:focus {
    outline: none;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#terminal-container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Override any xterm.js default styles that might add padding/margin */
.xterm {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.xterm-viewport {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

.xterm-screen {
    padding: 0 !important;
    margin: 0 !important;
}

.xterm .xterm-helpers {
    position: absolute;
    top: 0;
    /**
     * The z-index of the helpers must be higher than the canvases in order for
     * IMEs to appear on top.
     */
    z-index: 5;
}

.xterm .xterm-helper-textarea {
    padding: 0;
    border: 0;
    margin: 0;
    /* Move textarea out of the screen to the far left, so that the cursor is not visible */
    position: absolute;
    opacity: 0;
    left: -9999em;
    top: 0;
    width: 0;
    height: 0;
    z-index: -5;
    /** Prevent wrapping so the IME appears against the textarea at the correct position */
    white-space: nowrap;
    overflow: hidden;
    resize: none;
}

.xterm .composition-view {
    /* TODO: Composition position got messed up somewhere */
    background: #000;
    color: #fff;
    display: none;
    position: absolute;
    white-space: nowrap;
    z-index: 1;
}

.xterm .composition-view.active {
    display: block;
}

.xterm .xterm-viewport {
    /* On OS X this is required in order for the scroll bar to appear fully opaque */
    background-color: #000;
    overflow-y: auto;
    cursor: default;
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
}

/* VS Code-style scrollbar styling for xterm.js built-in scrollbars */
.xterm .xterm-scrollable-element > .scrollbar {
    cursor: default;
}

/* Arrows */
.xterm .xterm-scrollable-element > .scrollbar > .scra {
    cursor: pointer;
    font-size: 11px !important;
}

.xterm .xterm-scrollable-element > .visible {
    opacity: 1;
    /* Background rule added for IE9 - to allow clicks on dom node */
    background: rgba(0, 0, 0, 0);
    transition: opacity 100ms linear;
    /* In front of peek view */
    z-index: 11;
}

.xterm .xterm-scrollable-element > .invisible {
    opacity: 0;
    pointer-events: none;
}

.xterm .xterm-scrollable-element > .invisible.fade {
    transition: opacity 800ms linear;
}

/* Scrollable Content Inset Shadow - VS Code style */
.xterm .xterm-scrollable-element > .shadow {
    position: absolute;
    display: none;
}

.xterm .xterm-scrollable-element > .shadow.top {
    display: block;
    top: 0;
    left: 3px;
    height: 3px;
    width: 100%;
    box-shadow: var(--vscode-scrollbar-shadow) 0 6px 6px -6px inset;
}

.xterm .xterm-scrollable-element > .shadow.left {
    display: block;
    top: 3px;
    left: 0;
    height: 100%;
    width: 3px;
    box-shadow: var(--vscode-scrollbar-shadow) 6px 0 6px -6px inset;
}

.xterm .xterm-scrollable-element > .shadow.top-left-corner {
    display: block;
    top: 0;
    left: 0;
    height: 3px;
    width: 3px;
}

.xterm .xterm-scrollable-element > .shadow.top.left {
    box-shadow: var(--vscode-scrollbar-shadow) 6px 0 6px -6px inset;
}

/* Custom scrollbar styling for xterm.js built-in scrollbars - VS Code style */
.xterm .xterm-scrollable-element > .scrollbar > .slider {
    background: var(--vscode-scrollbarSlider-background);
    border-radius: 6px;
}

.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {
    background: var(--vscode-scrollbarSlider-hoverBackground);
}

.xterm .xterm-scrollable-element > .scrollbar > .slider.active {
    background: var(--vscode-scrollbarSlider-activeBackground);
}

/* Fallback for native scrollbars if xterm.js scrollbars are disabled - VS Code style */
.xterm .xterm-viewport::-webkit-scrollbar {
    width: 14px;
}

.xterm .xterm-viewport::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 6px;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--vscode-scrollbarSlider-background);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--vscode-scrollbarSlider-hoverBackground);
    background-clip: content-box;
}

.xterm .xterm-viewport::-webkit-scrollbar-thumb:active {
    background: var(--vscode-scrollbarSlider-activeBackground);
    background-clip: content-box;
}

/* Firefox scrollbar styling - VS Code style */
.xterm .xterm-viewport {
    scrollbar-width: thin;
    scrollbar-color: var(--vscode-scrollbarSlider-background) transparent;
}

.xterm .xterm-screen {
    position: relative;
}

.xterm .xterm-screen canvas {
    position: absolute;
    left: 0;
    top: 0;
}

.xterm .xterm-scroll-area {
    visibility: hidden;
}

.xterm-char-measure-element {
    display: inline-block;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: -9999em;
    line-height: normal;
}

.xterm.enable-mouse-events {
    /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
    cursor: default;
}

.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
    cursor: pointer;
}

.xterm.column-select.focus {
    /* Column selection mode */
    cursor: crosshair;
}

.xterm .xterm-accessibility,
.xterm .xterm-message {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 10;
    color: transparent;
}

.xterm .live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.xterm-dim {
    opacity: 0.5;
}

.xterm-underline-1 {
    text-decoration: underline;
}
.xterm-underline-2 {
    text-decoration: double underline;
}
.xterm-underline-3 {
    text-decoration: wavy underline;
}
.xterm-underline-4 {
    text-decoration: dotted underline;
}
.xterm-underline-5 {
    text-decoration: dashed underline;
}

.xterm-strikethrough {
    text-decoration: line-through;
}

.xterm-screen .xterm-decoration-container .xterm-decoration {
    z-index: 6;
    position: absolute;
}

.xterm-decoration-overview-ruler {
    z-index: 7;
    position: absolute;
    top: 0;
    right: 0;
    pointer-events: none;
}

.xterm-decoration-top {
    z-index: 2;
    position: relative;
}
