.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chat-button {
    min-width: 92px;
    height: 64px;
    padding: 10px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, #00b0ff 0%, #0096e6 100%);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0, 176, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.chat-button-label {
    color: white;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 176, 255, 0.5);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-height: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: none;
    flex-direction: column;
}

.chat-window.active {
    display: flex;
}

.chat-header {
    background: linear-gradient(135deg, #00b0ff 0%, #0096e6 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chat-header-info h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chat-header-info p {
    font-size: 0.8rem;
    opacity: 0.9;
    margin: 0;
}

.chat-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-close svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 200px;
    max-height: 300px;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

.chat-message.client {
    align-items: flex-end;
}

.chat-message.manager {
    align-items: flex-start;
}

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message.client .chat-bubble {
    background: #00b0ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.manager .chat-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 4px;
}

.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
}

.chat-form {
    display: flex;
    gap: 8px;
}

.chat-input, .chat-input textarea, #chatInput {
    font-family: inherit;
}

#chatInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #00b0ff;
}

.chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #00b0ff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-send:hover {
    background: #0096e6;
}

.chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.chat-form-name {
    margin-bottom: 8px;
}

.chat-form-name input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
}

.chat-form-name input:focus {
    border-color: #00b0ff;
}

.chat-status {
    padding: 8px 16px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.8rem;
    text-align: center;
}

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

.chat-message {
    animation: fadeIn 0.3s ease;
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 70px;
    }
}

.chat-message.pending .chat-bubble { opacity: 0.55; }
.chat-message.failed .chat-bubble { background: #ffebee; color: #c62828; }
