.aichat-widget {
    --aichat-color: #2c6ecb;
    --aichat-offset-x: 20px;
    --aichat-offset-y: 20px;
    position: fixed;
    bottom: var(--aichat-offset-y);
    z-index: 10000;
    font-family: Arial, Helvetica, sans-serif;
}

.aichat-position-right {
    right: var(--aichat-offset-x);
}

.aichat-position-left {
    left: var(--aichat-offset-x);
}

.aichat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--aichat-color);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aichat-window {
    position: absolute;
    bottom: 70px;
    width: 320px;
    max-width: calc(100vw - 40px);
    height: 440px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aichat-position-right .aichat-window {
    right: 0;
}

.aichat-position-left .aichat-window {
    left: 0;
}

.aichat-header {
    background: var(--aichat-color);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

.aichat-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.aichat-header-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aichat-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, .5);
}

.aichat-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .25);
    color: #fff;
    font-weight: bold;
    font-size: 26px;
}

.aichat-bot-name {
    font-weight: bold;
    font-size: 18px;
}

.aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

.aichat-message {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.aichat-message-customer {
    align-self: flex-end;
    background: var(--aichat-color);
    color: #fff;
}

.aichat-message-bot,
.aichat-message-agent {
    align-self: flex-start;
    background: #f1f1f1;
    color: #222;
}

.aichat-message-system {
    align-self: center;
    background: transparent;
    color: #888;
    font-size: 12px;
    font-style: italic;
}

.aichat-human-request {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid #eee;
}

.aichat-human-request button {
    background: none;
    border: 1px solid var(--aichat-color);
    color: var(--aichat-color);
    border-radius: 20px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
}

.aichat-form {
    display: flex;
    border-top: 1px solid #eee;
}

.aichat-form input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 14px;
}

.aichat-form input:focus {
    outline: none;
}

.aichat-form button {
    border: none;
    background: var(--aichat-color);
    color: #fff;
    padding: 0 16px;
    cursor: pointer;
}
