.lyra-chat-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    height: calc(100vh - 100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 9999;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transform-origin: bottom right;
}

.lyra-chat-window.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.9) translateY(20px);
}

.lyra-chat-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.lyra-avatar-pulse {
    width: 12px;
    height: 12px;
    background: #00ffcc;
    border-radius: 50%;
    margin-right: 12px;
    box-shadow: 0 0 10px #00ffcc;
    animation: lyraPulse 2s infinite;
}

@keyframes lyraPulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(0, 255, 204, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0); }
}

.lyra-chat-header h3 {
    margin: 0;
    font-size: 1rem;
    flex-grow: 1;
    color: var(--text-primary);
}

.lyra-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.lyra-close-btn:hover {
    color: var(--text-primary);
}

.lyra-chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lyra-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.lyra-message p:last-child {
    margin-bottom: 0;
}

.lyra-message-user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
}

.lyra-message-bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

.lyra-chat-form {
    display: flex;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

#lyra-chat-input {
    flex-grow: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 20px;
    outline: none;
}

#lyra-chat-input:focus {
    border-color: var(--primary-color);
}

.lyra-send-btn {
    background: var(--primary-color);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lyra-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.lyra-chat-toggle:hover {
    transform: scale(1.1);
}

.lyra-chat-toggle.active {
    display: none;
}

.lyra-message-typing .typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite ease-in-out;
}

.lyra-message-typing .typing-dot:nth-child(1) { animation-delay: -0.32s; }
.lyra-message-typing .typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Sidebar & Layout */
.lyra-chat-window {
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.lyra-chat-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
}

.lyra-chat-sidebar {
    width: 250px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    margin-left: -250px;
}

.lyra-chat-sidebar.open {
    margin-left: 0;
}

.lyra-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.lyra-sidebar-header h4 {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.lyra-new-chat-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 2px 8px;
    transition: all 0.2s;
}

.lyra-new-chat-btn:hover {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
}

.lyra-conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.lyra-conversation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    transition: background 0.2s;
}

.lyra-conversation-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lyra-conversation-item.active {
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.3);
}

.lyra-conv-title {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.lyra-conv-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 0 5px;
}

.lyra-conversation-item:hover .lyra-conv-delete {
    opacity: 1;
}

.lyra-conv-delete:hover {
    color: #ff4444;
}

.lyra-sidebar-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    margin-right: 10px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lyra-sidebar-toggle:hover {
    color: var(--brand-primary);
}

/* Actions de message */
.lyra-message {
    position: relative;
}

.lyra-message-actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.lyra-message:hover .lyra-message-actions {
    opacity: 1;
}

.lyra-action-btn {
    background: transparent !important;
    border: none !important;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 0 !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.lyra-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
}

.lyra-action-btn.lyra-action-danger:hover {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
}

.lyra-spinner {
    animation: lyra-spin 1s linear infinite;
}

@keyframes lyra-spin {
    100% {
        transform: rotate(360deg);
    }
}
