/* ================================ */
/* Tool Agent Drawer                */
/* AIP logo FAB (bottom-right) +    */
/* chat panel — liquid glass style  */
/* ================================ */

/* Wrapper — sized to the FAB; panel is absolutely positioned from same corner */
.tool-drawer {
    position: fixed;
    bottom: 26px;
    right: 26px;
    z-index: 500;
    width: 60px;
    height: 60px;
}

/* ---- FAB exit: simple fade out ---- */
@keyframes toolDrawerFabPop {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.85); }
}

/* ---- Panel open: diagonal expand from bottom-right ---- */
@keyframes toolDrawerBubbleIn {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- FAB button (circle) ---- */
.tool-drawer-fab {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.22), 0 1px 4px rgba(0,0,0,0.08);
    padding: 0;
    overflow: hidden;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tool-drawer-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 26px rgba(37, 99, 235, 0.32), 0 2px 6px rgba(0,0,0,0.1);
}

.tool-drawer-fab:active {
    transform: scale(0.95);
}

/* FAB fades out when panel opens */
.tool-drawer[data-expanded="true"] .tool-drawer-fab {
    animation: toolDrawerFabPop 0.18s ease-out forwards;
    pointer-events: none;
}

.tool-drawer-fab img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Coming-soon tooltip (disabled state) ---- */
.tool-drawer-coming-soon {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 7px 13px;
    border-radius: 20px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}

.tool-drawer-coming-soon.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Chat panel — liquid glass ---- */
.tool-drawer-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 320px;
    height: 420px;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.13),
                0 4px 12px rgba(0, 0, 0, 0.07),
                inset 0 1px 0 rgba(255, 255, 255, 1),
                inset 0 -1px 0 rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.75);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    /* closed state */
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease-out, opacity 0.15s ease;
}

/* Panel open — expands from bottom-right corner diagonally to upper-left */
.tool-drawer[data-expanded="true"] .tool-drawer-panel {
    transform: scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ---- Panel header ---- */
.tool-drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

/* ---- Agent avatar ---- */
.tool-drawer-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
}

.tool-drawer-agent-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #1a1a1a);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-drawer-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text-faint, #9ca3af);
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    padding: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.tool-drawer-close:hover {
    color: var(--color-text, #1a1a1a);
    background: rgba(0, 0, 0, 0.05);
}

/* ---- Messages area ---- */
.tool-drawer-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: transparent;
}

.tool-drawer-msg {
    max-width: 90%;
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.5;
}

.tool-drawer-msg.agent {
    align-self: flex-start;
    background: rgba(243, 244, 246, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--color-text, #1a1a1a);
    border-bottom-left-radius: 3px;
}

.tool-drawer-msg.user {
    align-self: flex-end;
    background: var(--color-primary, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 3px;
}

.tool-drawer-msg.typing {
    color: var(--color-text-muted, #6b7280);
    font-style: italic;
}

/* ---- Input row ---- */
.tool-drawer-input-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.tool-drawer-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--color-text, #1a1a1a);
    background: rgba(255, 255, 255, 0.75);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tool-drawer-input:focus {
    border-color: var(--color-primary, #4f46e5);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.tool-drawer-send {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--color-primary, #4f46e5);
    color: #fff;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.1s ease;
}

.tool-drawer-send:hover {
    background: var(--color-primary-hover, #4338ca);
}

.tool-drawer-send:active {
    transform: scale(0.95);
}

.tool-drawer-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Coexistence with other fixed elements ---- */
.has-tool-drawer .copilot-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
