.chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;

    width: 60px;
    height: 60px;

    border: none;
    border-radius: 50%;

    background: #0d6efd;
    color: #ffffff;

    font-size: 25px;

    box-shadow:
        0 8px 25px
        rgba(0, 0, 0, 0.25);

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.chat-launcher:hover {
    transform: scale(1.07);
    background: #0b5ed7;
}

.chat-launcher-badge {
    position: absolute;
    top: -4px;
    right: -4px;

    display: none;

    min-width: 22px;
    height: 22px;

    padding: 0 6px;

    border-radius: 12px;

    background: #dc3545;
    color: #ffffff;

    font-size: 12px;
    font-weight: 700;

    align-items: center;
    justify-content: center;
}

.chat-widget {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 9999;

    display: none;
    flex-direction: column;

    width: 370px;
    height: 540px;

    overflow: hidden;

    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 12px 45px
        rgba(0, 0, 0, 0.25);
}

.chat-widget.open {
    display: flex;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    background: #0d6efd;
    color: #ffffff;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.2);

    font-size: 20px;
}

.chat-header h6 {
    margin: 0;
    font-weight: 700;
}

.chat-status {
    margin-top: 2px;

    font-size: 12px;

    color:
        rgba(255, 255, 255, 0.85);
}

.chat-close {
    border: none;
    background: transparent;
    color: #ffffff;

    font-size: 22px;
    cursor: pointer;
}

.chat-register {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;

    padding: 24px;
}

.chat-register h5 {
    margin-bottom: 8px;
    font-weight: 700;
}

.chat-register p {
    margin-bottom: 20px;

    color: #6c757d;
    font-size: 14px;
}

.chat-register .form-control {
    margin-bottom: 12px;
}

.chat-main {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.chat-messages {
    flex: 1;

    overflow-y: auto;

    padding: 16px;

    background: #f4f6f9;
}

.chat-message-row {
    display: flex;
    margin-bottom: 12px;
}

.chat-message-row.customer {
    justify-content: flex-end;
}

.chat-message-row.admin,
.chat-message-row.system {
    justify-content: flex-start;
}

.chat-message {
    max-width: 78%;

    padding: 10px 13px;

    border-radius: 15px;

    font-size: 14px;
    line-height: 1.4;

    word-break: break-word;
}

.chat-message-row.customer
.chat-message {
    border-bottom-right-radius: 4px;

    background: #0d6efd;
    color: #ffffff;
}

.chat-message-row.admin
.chat-message {
    border-bottom-left-radius: 4px;

    background: #ffffff;
    color: #212529;

    box-shadow:
        0 2px 8px
        rgba(0, 0, 0, 0.08);
}

.chat-message-row.system
.chat-message {
    margin: auto;

    background: #e9ecef;
    color: #6c757d;

    font-size: 12px;
    text-align: center;
}

.chat-message-name {
    margin-bottom: 3px;

    font-size: 11px;
    font-weight: 700;
}

.chat-message-time {
    margin-top: 4px;

    font-size: 10px;
    opacity: 0.75;
    text-align: right;
}

.chat-typing {
    min-height: 24px;

    padding: 3px 16px;

    background: #f4f6f9;
    color: #6c757d;

    font-size: 12px;
    font-style: italic;
}

.chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;

    padding: 12px;

    border-top: 1px solid #dee2e6;

    background: #ffffff;
}

.chat-input {
    flex: 1;

    min-height: 42px;
    max-height: 90px;

    resize: none;

    border: 1px solid #ced4da;
    border-radius: 12px;

    padding: 10px 12px;

    outline: none;

    font-size: 14px;
}

.chat-input:focus {
    border-color: #86b7fe;

    box-shadow:
        0 0 0 3px
        rgba(13, 110, 253, 0.15);
}

.chat-send-button {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: none;
    border-radius: 50%;

    background: #0d6efd;
    color: #ffffff;

    cursor: pointer;
}

.chat-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chat-error {
    min-height: 20px;

    color: #dc3545;

    font-size: 12px;
}

@media (max-width: 576px) {
    .chat-widget {
        right: 10px;
        bottom: 82px;

        width:
            calc(100vw - 20px);

        height:
            calc(100vh - 105px);

        border-radius: 14px;
    }

    .chat-launcher {
        right: 16px;
        bottom: 16px;

        width: 56px;
        height: 56px;
    }
}