:root {
    --copilot-primary: #6366f1;
    --copilot-primary-hover: #818cf8;
    --copilot-primary-glow: rgba(99, 102, 241, 0.4);
    --copilot-success: #10b981;
    --copilot-bg: rgba(15, 21, 37, 0.98);
    --copilot-bg-glass: rgba(26, 35, 64, 0.9);
    --copilot-border: rgba(255, 255, 255, 0.08);
    --copilot-text: #f1f5f9;
    --copilot-text-muted: #94a3b8;
    --copilot-width: 400px;
}

.copilot-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 8px 32px var(--copilot-primary-glow), 0 0 60px -10px var(--copilot-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.copilot-toggle-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    border-radius: 50%;
}

.copilot-toggle-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 40px var(--copilot-primary-glow), 0 0 80px -5px var(--copilot-primary);
}

.copilot-toggle-btn i {
    font-size: 26px;
    color: white;
    transition: transform 0.3s ease;
}

body.copilot-open .copilot-toggle-btn {
    display: none;
}

.copilot-toggle-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    background: var(--copilot-success);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #0a0f1a;
    animation: copilot-pulse 2s infinite;
}

@keyframes copilot-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.copilot-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--copilot-width);
    height: 100vh;
    background: var(--copilot-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--copilot-border);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body.copilot-open .copilot-panel {
    transform: translateX(0);
}

body.copilot-open .main-content-wrapper,
body.copilot-open main,
body.copilot-open .container,
body.copilot-open .container-fluid {
    margin-right: var(--copilot-width);
    transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body:not(.copilot-open) .main-content-wrapper,
body:not(.copilot-open) main,
body:not(.copilot-open) .container,
body:not(.copilot-open) .container-fluid {
    margin-right: 0;
    transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 768px) {
    .copilot-panel {
        width: 100vw;
    }
    
    body.copilot-open .main-content-wrapper,
    body.copilot-open main,
    body.copilot-open .container,
    body.copilot-open .container-fluid {
        margin-right: 0;
    }
}

.copilot-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--copilot-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
    flex-shrink: 0;
}

.copilot-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.copilot-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px var(--copilot-primary-glow);
}

.copilot-avatar i {
    font-size: 22px;
    color: white;
}

.copilot-title h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--copilot-text);
    margin: 0 0 2px;
}

.copilot-title p {
    font-size: 12px;
    color: var(--copilot-text-muted);
    margin: 0;
}

.copilot-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--copilot-border);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--copilot-text-muted);
    transition: all 0.2s ease;
}

.copilot-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.copilot-quick-actions {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid var(--copilot-border);
    flex-shrink: 0;
}

.copilot-quick-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--copilot-border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--copilot-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copilot-quick-btn:hover {
    background: var(--copilot-primary-glow);
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--copilot-text);
    transform: translateY(-1px);
}

.copilot-quick-btn i {
    font-size: 13px;
}

.copilot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.copilot-messages::-webkit-scrollbar {
    width: 6px;
}

.copilot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.copilot-welcome {
    text-align: center;
    padding: 40px 20px;
}

.copilot-welcome-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 8px 32px var(--copilot-primary-glow);
}

.copilot-welcome-icon i {
    font-size: 28px;
    color: white;
}

.copilot-welcome h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--copilot-text);
    margin: 0 0 8px;
}

.copilot-welcome p {
    font-size: 14px;
    color: var(--copilot-text-muted);
    margin: 0;
    line-height: 1.5;
}

.copilot-message {
    display: flex;
    gap: 10px;
    animation: copilot-fade-in 0.3s ease;
}

@keyframes copilot-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.copilot-message.user {
    flex-direction: row-reverse;
}

.copilot-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copilot-message.assistant .copilot-msg-avatar {
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
}

.copilot-message.user .copilot-msg-avatar {
    background: rgba(255, 255, 255, 0.1);
}

.copilot-msg-avatar i {
    font-size: 14px;
    color: white;
}

.copilot-msg-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.copilot-message.assistant .copilot-msg-bubble {
    background: var(--copilot-bg-glass);
    border: 1px solid var(--copilot-border);
    color: var(--copilot-text);
    border-bottom-left-radius: 4px;
}

.copilot-message.user .copilot-msg-bubble {
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
    color: white;
    border-bottom-right-radius: 4px;
}

.copilot-msg-bubble p {
    margin: 0 0 8px;
}

.copilot-msg-bubble p:last-child {
    margin-bottom: 0;
}

.copilot-msg-bubble ul,
.copilot-msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.copilot-msg-bubble li {
    margin: 4px 0;
}

.copilot-msg-bubble code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.copilot-msg-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.copilot-msg-bubble pre code {
    background: none;
    padding: 0;
}

.copilot-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 12px;
    flex-shrink: 0;
}

.copilot-typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--copilot-bg-glass);
    border: 1px solid var(--copilot-border);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.copilot-typing-dots {
    display: flex;
    gap: 4px;
}

.copilot-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--copilot-primary);
    border-radius: 50%;
    animation: copilot-typing 1.4s infinite;
}

.copilot-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.copilot-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes copilot-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.copilot-typing-text {
    font-size: 12px;
    color: var(--copilot-text-muted);
}

.copilot-input-area {
    padding: 16px;
    border-top: 1px solid var(--copilot-border);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.copilot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 80px;
    overflow-y: auto;
}

.copilot-suggestion {
    padding: 6px 10px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    font-size: 12px;
    color: var(--copilot-primary-hover);
    cursor: pointer;
    transition: all 0.2s ease;
}

.copilot-suggestion:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--copilot-primary);
}

.copilot-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.copilot-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--copilot-border);
    border-radius: 12px;
    color: var(--copilot-text);
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.copilot-input::placeholder {
    color: var(--copilot-text-muted);
}

.copilot-input:focus {
    outline: none;
    border-color: var(--copilot-primary);
    box-shadow: 0 0 0 3px var(--copilot-primary-glow);
}

.copilot-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copilot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 16px var(--copilot-primary-glow);
}

.copilot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.copilot-send-btn i {
    font-size: 18px;
    color: white;
}

.copilot-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 0 4px;
}

.copilot-powered {
    font-size: 11px;
    color: var(--copilot-text-muted);
    opacity: 0.7;
}

.copilot-clear-btn {
    background: transparent;
    border: none;
    color: var(--copilot-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.copilot-clear-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.copilot-error {
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    color: #f87171;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copilot-error i {
    font-size: 16px;
}

.copilot-command-palette {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--copilot-bg-glass);
    border: 1px solid var(--copilot-border);
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.copilot-command-palette::-webkit-scrollbar {
    width: 6px;
}

.copilot-command-palette::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-command-palette::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.command-palette-category {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--copilot-primary);
    padding: 10px 14px 6px;
    margin-top: 4px;
}

.command-palette-category:first-child {
    margin-top: 0;
    padding-top: 12px;
}

.command-palette-item {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.command-palette-item:hover,
.command-palette-item.selected {
    background: rgba(99, 102, 241, 0.15);
}

.command-palette-item.selected {
    border-left: 2px solid var(--copilot-primary);
}

.command-palette-item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.command-palette-id {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--copilot-primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.command-palette-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--copilot-text);
}

.command-palette-desc {
    font-size: 11px;
    color: var(--copilot-text-muted);
    line-height: 1.4;
}

.command-palette-empty {
    padding: 20px;
    text-align: center;
    color: var(--copilot-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.command-palette-empty i {
    font-size: 20px;
    opacity: 0.5;
}

.command-result {
    border-left: 3px solid var(--copilot-primary);
}

.command-result .copilot-msg-avatar {
    background: linear-gradient(135deg, var(--copilot-primary), #8b5cf6);
}

.command-result-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--copilot-border);
}

.command-result-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--copilot-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

.command-result-badge i {
    font-size: 12px;
}

.command-result-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--copilot-text-muted);
}

.command-result-content {
    font-size: 13px;
    line-height: 1.6;
}

.copilot-welcome-hint {
    font-size: 12px;
    color: var(--copilot-text-muted);
    margin-top: 8px;
}

.copilot-welcome-hint kbd {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 11px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--copilot-primary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}
