/* ============================
   Кнопка открытия чата
   ============================ */
#cw-open-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: #ff7a00;
    color: #fff;
    font-size: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 999999;
    transition: .2s;
}

#cw-open-btn:hover {
    transform: scale(1.05);
    background: #ff8f22;
}

/* ============================
   Контейнер чата
   ============================ */
#cw-chat-box {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 330px;
    height: 450px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    font-family: Arial, sans-serif;
}

/* ============================
   ШАПКА ЧАТА
   ============================ */
#cw-header {
    background: linear-gradient(to right, #ff7e00, #ff5500);
    padding: 14px;
    color: #fff;
    font-weight: bold;
    font-size: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#cw-close {
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
}

#cw-close:hover {
    transform: scale(1.2);
}

/* ============================
   ОКНО СООБЩЕНИЙ
   ============================ */
#cw-chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
}

#cw-chat-window::-webkit-scrollbar {
    width: 6px;
}

#cw-chat-window::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ============================
   СООБЩЕНИЯ
   ============================ */

.cw-msg {
    margin-bottom: 12px;
    max-width: 80%;
    animation: fadeIn .25s ease;
}

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

/* Сообщение пользователя */
.cw-user {
    text-align: right;
    margin-left: auto;
}

/* Сообщение оператора */
.cw-op {
    text-align: left;
}

/* Системное сообщение */
.cw-system {
    text-align: center;
}

/* Bubble */
.cw-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    display: inline-block;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* Цвета */
.cw-user .cw-bubble {
    background: #d2ffc9;
    border-bottom-right-radius: 6px;
}

.cw-op .cw-bubble {
    background: #ececec;
    border-bottom-left-radius: 6px;
}

.cw-sender {
    font-size: 12px;
    font-weight: bold;
    color: #ff7a00;
    margin-bottom: 3px;
}

.cw-system .cw-bubble {
    background: #ffe8c4;
    color: #7a4a00;
    border-radius: 10px;
    max-width: 95%;
    margin: 0 auto;
}

/* ============================
   ПАНЕЛЬ ВВОДА
   ============================ */
#cw-input-box {
    display: flex;
    padding: 10px;
    gap: 10px;
    border-top: 1px solid #ddd;
    background: #fff;
    margin-top: auto;
}

#cw-input {
    flex: 1;
    height: 46px;               /* одинаковая высота */
    padding: 0 12px;            /* равномерные отступы */
    border-radius: 10px;
    border: 1px solid #bbb;
    outline: none;
    font-size: 14px;
    line-height: 46px;          /* ← выравнивание текста по центру */
}

#cw-input:focus {
    border-color: #ff9800;
    box-shadow: 0 0 0 2px rgba(255,152,0,0.25);
}

#cw-send {
    width: 52px;
    height: 46px;               /* одинаковая высота */
    background: #ff9800;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;              /* ↓ выравнивание стрелки по центру */
    justify-content: center;
    align-items: center;
}

#cw-send:hover {
    background: #ff5500;
    transform: scale(1.05);
}

/* ============================
   Адаптивность
   ============================ */
@media (max-width: 480px) {
    #cw-chat-box {
        width: 100%;
        height: 80%;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
}
