#chatBtn {
    position: fixed;
    bottom: 90px;
    left: 20px;
    z-index: 40;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #22c55e);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(30, 64, 175, 0.4);
    transition: all 0.3s ease;
    border: none;
}
#chatBtn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(30, 64, 175, 0.6);
}
#chatBtn i { font-size: 20px; }

#chatModal {
    position: fixed;
    bottom: 90px;
    left: 20px;
    z-index: 45;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 460px;
    max-height: calc(100vh - 180px);
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    display: none;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
#chatModal.flex { display: flex; }

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(30, 64, 175, 0.15);
}
.chat-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header h3 i { color: #22c55e; font-size: 10px; }
#chatClose {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.2s;
}
#chatClose:hover { color: white; }

#chatLogin {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    gap: 12px;
}
#chatLogin.hidden { display: none; }
#chatLogin .chat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(30,64,175,0.2), rgba(34,197,94,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #22c55e;
    margin-bottom: 4px;
}
#chatLogin p {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    margin-bottom: 8px;
}
#chatLogin input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
#chatLogin input:focus { border-color: #1e40af; }
#chatLogin input::placeholder { color: #475569; }
#chatLoginBtn {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1e40af, #22c55e);
    color: white;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
#chatLoginBtn:hover { opacity: 0.9; }
#chatLoginError {
    color: #ef4444;
    font-size: 11px;
    text-align: center;
}

#chatBox {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#chatBox.hidden { display: none; }

#chatMessages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#chatMessages::-webkit-scrollbar { width: 4px; }
#chatMessages::-webkit-scrollbar-thumb { background: #1e40af; border-radius: 2px; }

.chat-msg {
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 8px 12px;
    animation: fadeIn 0.2s ease-out;
}

.chat-msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.chat-msg-actions button {
    background: none;
    border: none;
    color: #475569;
    font-size: 10px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.chat-msg-actions button:hover { background: rgba(255,255,255,0.06); color: #94a3b8; }

#chatMsgForm {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
#chatMsgInput {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
#chatMsgInput:focus { border-color: #1e40af; }
#chatMsgInput::placeholder { color: #475569; }
#chatMsgForm button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #22c55e);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
#chatMsgForm button:hover { opacity: 0.85; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
