/**
 * Custom Terminal Windows
 * Beautiful floating terminals with cream & olive theme
 */

#custom-terminal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 8000;
}

.custom-terminal-window {
    position: absolute;
    background: linear-gradient(145deg, rgba(42, 51, 41, 0.85) 0%, rgba(30, 37, 30, 0.9) 100%);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    pointer-events: auto;
    min-width: 500px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(122, 139, 111, 0.25);
    animation: terminalFadeIn 0.2s ease-out;
}

@keyframes terminalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.custom-terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(122, 139, 111, 0.15) 0%, rgba(107, 122, 95, 0.08) 100%);
    border-bottom: 1px solid rgba(122, 139, 111, 0.2);
    cursor: move;
    user-select: none;
}

.custom-terminal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #B8C3B5;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

.terminal-title-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.terminal-title-text {
    flex: 1;
}

.custom-terminal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-window-control {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.terminal-window-control:hover {
    transform: scale(1.1);
}

.terminal-control-close {
    background: #C85A54;
}

.terminal-control-close:hover {
    background: #E86A64;
}

.terminal-control-minimize {
    background: #D4A853;
}

.terminal-control-minimize:hover {
    background: #E4B863;
}

.terminal-control-maximize {
    background: #7A8B6F;
}

.terminal-control-maximize:hover {
    background: #8A9B7F;
}

.custom-terminal-shellbar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(122, 139, 111, 0.15);
}

.custom-terminal-shellbar select {
    background: rgba(47, 58, 46, 0.6);
    border: 1px solid rgba(122, 139, 111, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #B8C3B5;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    cursor: pointer;
    outline: none;
}

.custom-terminal-shellbar select:hover {
    border-color: rgba(122, 139, 111, 0.5);
}

.custom-terminal-shellbar select:focus {
    border-color: #7A8B6F;
}

.custom-terminal-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.custom-terminal-action-btn {
    padding: 6px 12px;
    background: rgba(122, 139, 111, 0.15);
    border: 1px solid rgba(122, 139, 111, 0.3);
    border-radius: 6px;
    color: #B8C3B5;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.custom-terminal-action-btn:hover {
    background: rgba(122, 139, 111, 0.25);
    border-color: rgba(122, 139, 111, 0.5);
}

.custom-terminal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #0D0F0D;
}

.custom-terminal-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(122, 139, 111, 0.2);
    min-width: 0;
}

.custom-terminal-pane:last-child {
    border-right: none;
}

.custom-terminal-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(122, 139, 111, 0.15);
    font-size: 11px;
    color: #8A9587;
    font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

.custom-terminal-pane-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-terminal-pane-close {
    background: none;
    border: none;
    color: #8A9587;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.custom-terminal-pane-close:hover {
    background: rgba(200, 90, 84, 0.2);
    color: #C85A54;
}

.custom-terminal-content {
    flex: 1;
    padding: 8px;
    overflow: hidden;
}

.custom-terminal-content .xterm {
    height: 100%;
}

.custom-terminal-content .xterm-viewport {
    overflow-y: auto !important;
}

.custom-terminal-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
}

/* Minimized state */
.custom-terminal-window.minimized {
    min-height: 48px;
    max-height: 48px;
}

.custom-terminal-window.minimized .custom-terminal-shellbar,
.custom-terminal-window.minimized .custom-terminal-body {
    display: none;
}

/* Maximized state */
.custom-terminal-window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100% - 56px) !important;
    border-radius: 0;
}

/* Active terminal glow */
.custom-terminal-window.active {
    box-shadow: 0 20px 60px rgba(122, 139, 111, 0.15), 0 8px 24px rgba(122, 139, 111, 0.1);
}

.custom-terminal-window.active .custom-terminal-header {
    background: linear-gradient(180deg, rgba(122, 139, 111, 0.2) 0%, rgba(107, 122, 95, 0.1) 100%);
}

/* Scrollbar styling */
.custom-terminal-content::-webkit-scrollbar,
.custom-terminal-content .xterm-viewport::-webkit-scrollbar {
    width: 8px;
}

.custom-terminal-content::-webkit-scrollbar-track,
.custom-terminal-content .xterm-viewport::-webkit-scrollbar-track {
    background: transparent;
}

.custom-terminal-content::-webkit-scrollbar-thumb,
.custom-terminal-content .xterm-viewport::-webkit-scrollbar-thumb {
    background: rgba(122, 139, 111, 0.3);
    border-radius: 4px;
}

.custom-terminal-content::-webkit-scrollbar-thumb:hover,
.custom-terminal-content .xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: rgba(122, 139, 111, 0.5);
}

/* Terminal creation button */
#terminal-create-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(145deg, #7A8B6F, #6B7A5F);
    border: none;
    box-shadow: 0 8px 24px rgba(122, 139, 111, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.2s ease;
    z-index: 7999;
}

#terminal-create-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(122, 139, 111, 0.5);
}

#terminal-create-btn:active {
    transform: scale(0.95);
}
