/* ==================== GLOBAL ==================== */
*,
*:before,
*:after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    margin-top: 0px;
}

p, h1, h2, h3, h4, h5, h6, ul, ol {
    margin: 0;
    padding: 0;
}

#frameOutput,
.tab-bar,
.tab-button,
.navbar,
.navbar a,
button
{
    cursor: default !important;
    user-select: none;
}

#pageContainer {
    background-color: var(--vscode-bg);
    display: flex;
    flex-direction: column;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
}

:root {
    --vscode-bg: #1f1f1f;
    --vscode-darker-bg: #252526;
    --vscode-tabbar-bg: #181818;
    --vscode-text: #d4d4d4;
    --vscode-highlight: #2c2c2c;
    --vscode-blue: #007acc;
    --vscode-hover-blue: #0751b3;
    --vscode-line-number: #858585;
    --vscode-border: #474747;

}

html,
body {
    background-color: var(--vscode-bg);
    color: var(--vscode-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1.2em;
    line-height: 1.6;
    padding: 0;
    margin: 0;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h1 {
    color: #d4d4d4;
    margin-top: 10px;
}

label {
    color: #d4d4d4;
}

hr {
    border-color: #474747;
    margin: 20px 0;
}

.vscode-theme {
    background-color: var(--vscode-bg) !important;
    color: var(--vscode-text) !important;
}

/* ==================== TABS ==================== */
.top-bar {
    width: 100%;
    height: 43px;
    flex-shrink: 0;
    z-index: 100;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    background-color: var(--vscode-tabbar-bg);
}

.tab-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 70%;
    position: relative;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.tab-bar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Fade effect for overflow */
.tab-bar.has-overflow::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    background: linear-gradient(to left, #181818, transparent);
    pointer-events: none;
    z-index: 1;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--vscode-tabbar-bg);
    border-top: 1.9px solid transparent;
    border-bottom: none;
    border-left: none;
    border-right: 0.5px solid var(--vscode-darker-bg);
    color: white;
    font-size: 15px;
    font-family: 'Segoe WPC', 'Segoe UI', sans-serif;
    padding: 0px 13px;
    height: 43px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-top-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
    position: relative;
}

.tab-button:hover {
    background-color: var(--vscode-highlight);
}

.tab-button.active {
    border-top-color: var(--vscode-blue);
    background-color: var(--vscode-bg);
}

.tab-button.dragging {
    opacity: 0.5;
}

.tab-button.drag-over {
    border-left: 2px solid var(--vscode-blue);
}

.file-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.tab-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tab-close {
    font-size: 14px;
    font-weight: bold;
    color: #ccc;
    border-radius: 3px;
    padding: 0px 5px;
    margin-left: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.tab-close:hover {
    background-color: var(--vscode-border);
}

.new-tab-button {
    background-color: transparent;
    border: none;
    border-radius: 3px;
    font-family: 'Segoe WPC', 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #ccc;
    padding: 0px 8px;
    margin-left: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.new-tab-button:hover {
    background-color: var(--vscode-border);
}

/* ==================== CONTENT AREA ==================== */
#content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    margin: 0;
    background-color: var(--vscode-bg);
    resize: none;
}

#frameOutput {
    flex: 1;
    width: 100%;
    display: block;
    margin-top: 0;
}

/* ==================== WELCOME PAGE ==================== */
.welcome-overlay {
    position: absolute;
    top: 43px;
    left: 0;
    width: 100%;
    height: calc(100vh - 43px);
    background-color: var(--vscode-bg);
    z-index: 10;
    display: none;
    overflow-y: scroll;
    flex-direction: column;
}

.welcome-overlay.visible {
    display: flex;
}

.welcome-content {
    width: 80vw;
    margin: 0 auto;
    padding: 60px 60px;
    flex: 1;
}

/* Header */
.welcome-header {
    margin-bottom: 60px;
}

.welcome-header h1 {
    font-size: 3rem;
    font-weight: 400;
    color: var(--vscode-text);
}

.welcome-header p {
    font-size: 1.5rem;
    color: var(--vscode-line-number);
}

/* Sections */
.welcome-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 5vw;
}

.left-column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3vh;
}

.welcome-feature-list {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 3.5vh;
}

.welcome-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--vscode-text);
    margin-bottom: 20px;
}

/* Start */
.welcome-actions {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
}

.welcome-action {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background-color: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0px;
    color: var(--vscode-blue);
    font-size: 0.85rem;
}

.action-text {
    color: inherit; 
    text-decoration: none;
    cursor: pointer;
}

.welcome-action:hover {
    color: var(--vscode-hover-blue)
}


.action-icon {
    font-size: 1.3rem;
    width: 30px;
    flex-shrink: 0;
}

/* Features */
.welcome-feature {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 15px;
    background-color: var(--vscode-highlight);
    /* border-top: 1px solid var(--vscode-blue); */
}

.feature-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vscode-text);
}

.feature-content p {
    font-size: 0.75rem;
    color: var(--vscode-line-number);
}

.welcome-feature:hover {
    border-top: 1px solid var(--vscode-blue);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Footnote */
#welcomeFootnote {
    display: flex;
    justify-content: flex-end;
    padding: 5px 0px;
    font-size: 0.9rem;
    color: var(--vscode-blue);    
}

/* Steps */
.welcome-steps {
    list-style: none;
    counter-reset: step-counter;
    padding: 0;
    margin: 0;
}

.welcome-steps li {
    counter-increment: step-counter;
    position: relative;
    padding: 12px 0 12px 40px;
    font-size: 0.85rem;
    color: var(--vscode-text);
    line-height: 1.6;
}

.welcome-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    width: 24px;
    height: 24px;
    /* background-color: red; */
    color: var(--vscode-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.welcome-steps strong {
    color: var(--vscode-blue);
}

.welcome-steps kbd {
    background-color: var(--vscode-highlight);
    border: 1px solid var(--vscode-border);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: var(--vscode-text);
}

/* Footer */
.welcome-footer{
    width: 100;
    background-color: var(--vscode-darker-bg);   
    padding: 1vh 0px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1vw;
}

.welcome-footer p {
    font-size: 0.75rem;
    color: var(--vscode-line-number);
}

.welcome-footer a{
    font-size: 0.75rem;
    color: var(--vscode-blue);
    text-decoration: none;
}

.welcome-footer a:hover{
    color: var(--vscode-hover-blue);
}

/* Scrollbar for welcome overlay */
.welcome-overlay::-webkit-scrollbar {
    width: 12px;
}

.welcome-overlay::-webkit-scrollbar-track {
    background: transparent;
}

.welcome-overlay::-webkit-scrollbar-thumb {
    background: #3C3C3C;
    min-height: 44px;
}

.welcome-overlay::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ==================== CODE INPUT ==================== */
#codeInputContainer{
    display: flex;
    flex-direction: column;
    height: 50vh;
    min-height: 100px;

}

#codeForm{
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#codeInput,
#highlightArea {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    flex: 1;
    min-height: 0;
    width: 100%;    
    background-color: var(--vscode-bg);
    color: white;
    font-size: 16px;
    border: none;
    outline: none;
    align-items: flex-start;
    padding: 15px 20px;
    margin: 0;
    resize: none;
    overflow: auto;

    /* Prevent long lines from overflowing */
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;  
}

#codeInput::placeholder {
    color: var(--vscode-line-number);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    opacity: 1;
    transition: opacity 0.3s ease;
}


/* ==================== TOGGLE PARSE BUTTON ==================== */
.button-group {
    display: flex;
    gap: 10px; 
    margin-right: 10px; 
}

#toggleParseButton {
    background-color: transparent;
    border: none;
    border-radius: 3px;
    font-family: 'Segoe WPC', 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #ccc;
    padding: 0px 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

#toggleParseButton:hover {
    background-color: var(--vscode-border);
}

#toggleParseButton:focus {
    outline: none;
    box-shadow: none;
}

/* ==================== INFO BUTTON ==================== */
#infoButton {
    background-color: transparent;
    border: none;
    border-radius: 3px;
    font-family: 'Segoe WPC', 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #ccc;
    padding: 0px 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
    cursor: pointer;
    flex-shrink: 0;
}

#infoButton:hover {
    background-color: var(--vscode-border);
}

/* Remove button borders */
#infoButton:focus {
    outline: none;
    box-shadow: none;
}

/* #infoPopup {
    display: none;
    position: fixed;
    text-align: center;
    font-family: 'Segoe WPC', 'Segoe UI', sans-serif;
    font-size: 20px;
    z-index: 300;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 25px;
    background-color: var(--vscode-darker-bg);
    border: 1.5px solid var(--vscode-blue);
    border-left: none;
    border-right: none;
    border-bottom: none;
    width: 70vw;
} */


/* ==================== SCROLLBARS ==================== */
#codeInput::-webkit-scrollbar,
#highlightArea::-webkit-scrollbar{
    width: 12px;                   
}

#codeInput::-webkit-scrollbar-track,
#highlightArea::-webkit-scrollbar-track{
    background: none;      
}

#codeInput::-webkit-scrollbar-thumb,
#highlightArea::-webkit-scrollbar-thumb {
    height: 110px;
    width: 16px;
    background-color: #3C3C3C;      
    min-height: 44px;
    border: none;   
}

#codeInput::-webkit-scrollbar-thumb:hover,
#highlightArea::-webkit-scrollbar-thumb:hover{
    background-color: #555;      
}

/* ==================== GRAB BAR ==================== */
#grabBar {
    width: 100%;
    height: 1px;
    background: #2b2b2b;      
    cursor: ns-resize;
    user-select: none;
}

#grabBar::after {
    content: "";
    position: absolute;
    height: 3px;
    width: 100%;
    background: transparent;
}

#grabBar:hover {
    transform: scaleY(3);     
    background: var(--vscode-blue);
}

/* ==================== RESPONSIVENESS ==================== */

/* Stack welcome sections */
@media (max-width: 900px) {
    .welcome-sections {
        grid-template-columns: 1fr;
        gap: 3vh;
    }
    .welcome-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;    
    }
}

/* Mobile Analyze button (No Enter Key) */
#mobileAnalyzeBtn {
    display: none;
    position: fixed;
    bottom: 48vh;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #007acc;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 122, 204, 0.4);
    cursor: pointer;
    z-index: 1000;
}
#mobileAnalyzeBtn:active {
    transform: scale(0.95);
}

#mobileAnalyzeBtn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stack footer */
@media (max-width: 600px) {
    .welcome-footer {
        flex-direction: column;
        gap: 8px;
        padding: 2vh 0px;
    }

}