.qpilot-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1040;
    animation: qpilot-fade-in 0.2s ease forwards;
}

@keyframes qpilot-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.qpilot-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 92vw;
    background: #0d0d0d;
    border-left: 1px solid #222;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.7);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.qpilot-drawer.open {
    transform: translateX(0);
    pointer-events: auto;
}

.qpilot-drawer.fullscreen {
    left: 0;
    width: 100vw;
    max-width: 100vw;
    border-left: none;
}

.qpilot-drawer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
    background: #0d0d0d;
}

.qpilot-drawer-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
    flex-shrink: 0;
}

.qpilot-drawer-dot.loading {
    background: #facc15;
    box-shadow: 0 0 6px #facc15;
    animation: qpilot-pulse-dot 0.9s ease-in-out infinite;
}

.qpilot-drawer-title {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #555;
    font-weight: 600;
}

.qpilot-drawer-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.qpilot-action-btn {
    background: none;
    border: none;
    color: #444;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.qpilot-action-btn:hover {
    color: #ccc;
    background: #1a1a1a;
}

.qpilot-action-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.qpilot-drawer-close {
    background: none;
    border: none;
    color: #444;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 5px;
    transition: color 0.15s, background 0.15s;
}

.qpilot-drawer-close:hover {
    color: #ccc;
    background: #1a1a1a;
}

.qpilot-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px 24px;
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a transparent;
}

.qpilot-drawer-body::-webkit-scrollbar {
    width: 5px;
}

.qpilot-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.qpilot-drawer-body::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 3px;
}

.qpilot-drawer-text {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.83rem;
    line-height: 1.7;
    color: #e8e8e8;
    white-space: pre-wrap;
    word-break: break-word;
    letter-spacing: 0.01em;
}

.qpilot-drawer-error {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.83rem;
    color: #f87171;
}

.qpilot-cursor {
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: #4ade80;
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: qpilot-blink 0.7s step-end infinite;
}

.qpilot-cursor.hidden {
    display: none;
}

.qpilot-thinking {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 4px 0;
}

.qpilot-thinking-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    opacity: 0.25;
    animation: qpilot-thinking-bounce 1.1s ease-in-out infinite;
}

.qpilot-thinking-dot:nth-child(2) {
    animation-delay: 0.18s;
}

.qpilot-thinking-dot:nth-child(3) {
    animation-delay: 0.36s;
}

.qpilot-collapsed-strip {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 28px;
    padding: 14px 0;
    background: #0d0d0d;
    border: 1px solid #222;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.6);
    z-index: 1050;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.qpilot-collapsed-strip:hover {
    background: #111;
}

.qpilot-collapsed-label {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #555;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: 600;
    user-select: none;
}

.qpilot-collapsed-chevron {
    color: #444;
    display: flex;
    align-items: center;
}

@keyframes qpilot-blink {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

@keyframes qpilot-pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

@keyframes qpilot-thinking-bounce {
    0%, 80%, 100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-5px);
    }
}
