/*
╔═══════════════════════════════════════════════════════════════════╗
║ BRUTAL TERMINAL - Pure Terminal CSS v3                            ║
║ NO FANCY SHIT - JUST TERMINAL VIBES                              ║
╚═══════════════════════════════════════════════════════════════════╝
*/

/* ====================================================================
   WINDOW CONTAINER - Mac-style chrome
   ==================================================================== */

/* ====================================================================
   WINDOW CONTAINER - Mac-style chrome
   ==================================================================== */

.brutal-terminal-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 900px;
    height: 600px;
    background: var(--io-surface-base);
    border: 1px solid var(--io-border-subtle);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    font-family: var(--io-font-mono);
    
    /* SMOOTH TRANSITIONS FOR MAXIMIZE */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Disable transitions while dragging */
.brutal-terminal-window.dragging {
    cursor: move;
    user-select: none;
    transition: none;
}

/* Maximized state */
.brutal-terminal-window.maximized {
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    border-radius: 0 !important;
}

/* ====================================================================
   HEADER - Tabs + Controls
   ==================================================================== */

.brutal-terminal-header {
    background: var(--io-surface-base);
    border-bottom: 1px solid var(--io-border-subtle);
    display: flex;
    align-items: center;
    height: 34px;
    user-select: none;
    flex-shrink: 0;
}

.brutal-terminal-tabs {
    display: flex;
    flex: 1;
    height: 100%;
    overflow-x: auto;
}

.brutal-terminal-tabs::-webkit-scrollbar {
    display: none;
}

.brutal-terminal-tab {
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--io-surface-base);
    border-right: 1px solid var(--io-border-subtle);
    color: var(--io-text-tertiary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 120px;
    white-space: nowrap;
}

.brutal-terminal-tab:hover {
    background: var(--io-surface-hover);
    color: var(--io-text-secondary);
}

.brutal-terminal-tab.active {
    color: var(--io-text-primary);
    background: var(--io-surface-base);
}

.brutal-terminal-tab-icon {
    width: 8px;
    height: 8px;
    background: var(--io-text-disabled);
    border-radius: 50%;
}

.brutal-terminal-tab.active .brutal-terminal-tab-icon {
    background: var(--io-success);
}

.brutal-terminal-tab-close {
    margin-left: auto;
    color: var(--io-text-disabled);
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.brutal-terminal-tab:hover .brutal-terminal-tab-close {
    opacity: 1;
}

.brutal-terminal-tab-close:hover {
    color: var(--io-error);
}

.brutal-terminal-controls {
    display: flex;
    gap: 8px;
    padding: 0 12px;
}

.brutal-terminal-control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: opacity 0.15s;
}

.brutal-terminal-control-btn:hover {
    opacity: 0.8;
}

.brutal-terminal-control-btn.close {
    background: var(--io-error);
}

.brutal-terminal-control-btn.minimize {
    background: var(--io-warning);
}

.brutal-terminal-control-btn.maximize {
    background: var(--io-success);
}

/* ====================================================================
   TERMINAL CONTENT - Scrollable output area
   ==================================================================== */

.brutal-terminal-content {
    flex: 1;
    background: var(--io-surface-base);
    padding: 16px;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 16px;
    font-family: "TT";
    line-height: 1;
    color: var(--io-text-primary);
}

.brutal-terminal-content::-webkit-scrollbar {
    width: 8px;
}

.brutal-terminal-content::-webkit-scrollbar-track {
    background: var(--io-surface-base);
}

.brutal-terminal-content::-webkit-scrollbar-thumb {
    background: var(--io-border);
    border-radius: 4px;
}

.brutal-terminal-content::-webkit-scrollbar-thumb:hover {
    background: var(--io-surface-hover);
}

/* ====================================================================
   LINE STYLES - PURE TERMINAL
   ==================================================================== */

.term-line {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.term-line.blank {
    min-height: 8px;
    margin-bottom: 2;
}

/* ====================================================================
   COMMAND LINE - Rendered commands
   ==================================================================== */

.term-line.cmd {
    display: flex;
    gap: 0;
}

.term-line.cmd .prompt {
    color: var(--io-text-secondary);
}

.term-line.cmd .cmd-text {
    color: var(--io-text-secondary);
}

/* ====================================================================
   INPUT LINE - Live input with custom caret
   ==================================================================== */

.term-input-line {
    display: flex;
    gap: 0;
}

.term-input-prompt {
    color: var(--io-text-secondary);
    user-select: none;
    flex-shrink: 0;
    line-height: 1;
}

.term-input-wrapper {
    flex: 1;
    position: relative;
    min-height: 21px;
    margin-left: 8px;
}

.term-input {
    width: 100%;
    outline: none;
    color: var(--io-text-primary);
    background: transparent;
    border: none;
    white-space: pre-wrap;        /* Allow wrapping */
    word-wrap: break-word;        /* Break long words */
    overflow-wrap: break-word;    /* Modern browsers */
    word-break: break-word;       /* Aggressive breaking */
    line-height: 1;
    caret-color: transparent;
    max-width: 100%;              /* Enforce width constraint */
}

.term-input:empty:before {
    content: '';
}

/* Custom caret */
/* Custom caret */
.term-input-caret {
    position: absolute;
    width: 8px;
    height: 14px;
    background: var(--io-accent);
    pointer-events: none;
    opacity: 0; /* Hidden by default */
}

/* Only blink when input is focused */
.term-input:focus + .term-input-caret {
    animation: caret-blink 1s infinite;
    opacity: 1;
    margin-top: 2px;
}


@keyframes caret-blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ====================================================================
   JSON OUTPUT - PURE TEXT
   ==================================================================== */

.term-line.json {
    margin: 4px 0;
    color: var(--io-text-secondary);
    white-space: pre;
    font-family: var(--io-font-mono);
}

/* ====================================================================
   TABLE - ASCII STYLE
   ==================================================================== */

.term-line.table {
    margin: 4px 0;
    color: var(--io-text-primary);
    white-space: pre;
}

/* ====================================================================
   STATUS MESSAGES - PURE TEXT
   ==================================================================== */

.term-line.error {
    color: var(--io-error);
}

.term-line.success {
    color: var(--io-success);
}

.term-line.warning {
    color: var(--io-warning);
}

.term-line.info {
    color: var(--io-info);
}

/* ====================================================================
   SEPARATOR - ASCII STYLE
   ==================================================================== */

.term-line.sep {
    margin: 8px 0;
    color: var(--io-text-disabled);
}

/* ====================================================================
   SELECTION
   ==================================================================== */

.brutal-terminal-content ::selection {
    background: var(--io-accent-subtle);
    color: inherit;
}

/* ====================================================================
   DRAGGABLE
   ==================================================================== */

.brutal-terminal-window.dragging {
    cursor: move;
    user-select: none;
}

/* ====================================================================
   RESPONSIVE
   ==================================================================== */

@media (max-width: 768px) {
    .brutal-terminal-window {
        width: 100%;
        height: 100%;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }
}


/* ====================================================================
   TERMINAL CONTENT - Scrollable output area
   ==================================================================== */

.brutal-terminal-content {
    flex: 1;
    background: var(--io-surface-base);
    padding: 16px;
    padding-bottom: 100px;  /* Extra space at bottom for easy clicking */
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 16px;
    
    color: var(--io-text-primary);
    cursor: text;  /* Show text cursor to hint it's clickable */
}


/* ====================================================================
   COMMAND LINE - Rendered commands
   ==================================================================== */

.term-line.cmd {
    display: flex;
    gap: 0;
    margin-bottom: 4px;
}

.term-line.cmd .prompt {
    color: var(--io-success);
    flex-shrink: 0;  /* Prompt never wraps */
}

.term-line.cmd .cmd-text {
    color: var(--io-text-primary);
    white-space: pre-wrap;        /* Allow wrapping */
    word-wrap: break-word;        /* Break long words */
    overflow-wrap: break-word;    /* Modern browsers */
    word-break: break-word;       /* Aggressive breaking */
    flex: 1;                      /* Take remaining space */
    min-width: 0;                 /* Allow flex shrinking */
}