/* Floating Perplexity AI Chat Window */
.floating-window {
    position: fixed;
    width: 350px;
    height: 500px;
    background-color: var(--bg-chat-window);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-primary);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    resize: none;
    overflow: hidden;
    min-width: 250px;
    min-height: 200px;
    opacity: 0;
    transform: scale(0.95) translateY(10px);
    transform-origin: bottom right; 
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    left: 0;
    top: 0;
    cursor: nwse-resize;
    background: transparent;
    z-index: 10;
}

.resize-handle::after {
    content: '';
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(315deg, transparent 60%, #bbb 60%);
    border-top-left-radius: 6px;
}

.floating-window.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.floating-window-header {
    background-color: var(--bg-chat-header);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-tertiary);
    cursor: default;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: var(--text-chat-header);
}

.floating-window-header span {
    flex-grow: 1;
}

.floating-window-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #888;
    cursor: default;
    padding: 0;
    margin-left: 10px;
}

.floating-window-close-btn:hover {
    color: var(--text-primary);
}

.floating-window-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    flex-grow: 1;
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-tertiary);
    display: flex;
    flex-direction: column;
}

.chat-history div {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 18px;
    margin-bottom: 8px;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message {
    align-self: flex-end;
    background-color: var(--bg-chat-user);
    color: var(--text-inverted);
    border-bottom-right-radius: 2px;
}

.ai-message {
    align-self: flex-start;
    background-color: var(--bg-chat-ai);
    color: var(--text-chat-ai);
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-tertiary);
}

.chat-input-area textarea {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--border-secondary);
    border-radius: 18px;
    box-sizing: border-box;
    resize: vertical;
    max-height: 100px;
    min-height: 40px;
    overflow-y: auto;
    line-height: 1.4;
    background-color: var(--bg-input);
    color: var(--text-primary);
}

.chat-input-area button {
    flex-shrink: 0;
    padding: 8px 15px;
    background-color: var(--accent-primary);
    color: var(--text-inverted);
    border: none;
    border-radius: 18px;
    cursor: pointer;
}

.chat-input-area button:hover {
    background-color: var(--accent-primary-hover);
}

.floating-toggle-btn {
    position: fixed;
    bottom: 105px; 
    left: auto;
    right: 10px;
    width: 50px;
    height: 50px;
    background-color: #000000;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s, transform 0.2s;
}

.floating-toggle-btn:hover {
    background-color: #000000;
    transform: scale(1.08);
}
