.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-widget__toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.chat-widget__toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(37, 99, 235, 0.5);
}

.chat-widget__icon {
    width: 28px;
    height: 28px;
    color: #fff;
}

.chat-widget__badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.chat-widget__window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 480px) {
    .chat-widget__window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .chat-widget__toggle {
        bottom: 10px;
        right: 10px;
    }
}

.chat-widget__header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-widget__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chat-widget__avatar svg {
    width: 24px;
    height: 24px;
}

.chat-widget__header-text {
    display: flex;
    flex-direction: column;
}

.chat-widget__title {
    font-weight: 600;
    font-size: 16px;
}

.chat-widget__status {
    font-size: 13px;
    opacity: 0.9;
}

.chat-widget__minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s;
}

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

.chat-widget__minimize svg {
    width: 18px;
    height: 18px;
}

.chat-widget__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.chat-widget__welcome {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.chat-widget__welcome-icon {
    width: 60px;
    height: 60px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.chat-widget__welcome-icon svg {
    width: 30px;
    height: 30px;
    color: #94a3b8;
}

.chat-widget__welcome h3 {
    font-size: 18px;
    color: #1e293b;
    margin: 0 0 8px;
}

.chat-widget__welcome p {
    margin: 0;
    font-size: 14px;
}

.chat-widget__message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-widget__message--visitor {
    align-self: flex-end;
}

.chat-widget__message--manager,
.chat-widget__message--system {
    align-self: flex-start;
}

.chat-widget__message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-widget__message--visitor .chat-widget__message-content {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-widget__message--manager .chat-widget__message-content {
    background: #fff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chat-widget__message--system .chat-widget__message-content {
    background: #e2e8f0;
    color: #64748b;
    font-size: 13px;
    text-align: center;
    border-radius: 8px;
}

.chat-widget__message-content p {
    margin: 0;
    word-wrap: break-word;
}

.chat-widget__message-time {
    font-size: 11px;
    color: #94a3b8;
    padding: 0 4px;
}

.chat-widget__message--visitor .chat-widget__message-time {
    text-align: right;
}

.chat-widget__message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chat-widget__message-attachments img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    cursor: pointer;
}

.chat-widget__file {
    display: block;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-size: 13px;
}

.chat-widget__contact-form {
    padding: 16px 20px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.chat-widget__contact-text {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px;
}

.chat-widget__input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 8px;
    transition: border-color 0.2s;
}

.chat-widget__input:focus {
    outline: none;
    border-color: #2563eb;
}

.chat-widget__btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-widget__btn--primary {
    background: #2563eb;
    color: #fff;
}

.chat-widget__btn--primary:hover {
    background: #1d4ed8;
}

.chat-widget__footer {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-widget__input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 24px;
    padding: 4px 16px;
}

.chat-widget__message-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
}

.chat-widget__attach {
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.chat-widget__attach:hover {
    color: #2563eb;
}

.chat-widget__attach svg {
    width: 20px;
    height: 20px;
}

.chat-widget__send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s;
}

.chat-widget__send:hover {
    transform: scale(1.05);
}

.chat-widget__send svg {
    width: 20px;
    height: 20px;
}

.chat-widget__attachments {
    padding: 8px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-widget__attachment-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    color: #475569;
}

.chat-widget__attachment-preview button {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.chat-widget__attachment-preview button:hover {
    color: #ef4444;
}
