/* [виджет]: стили чата сайта */
#chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 9999; font-family: Arial, sans-serif; }
.chat-toggle { position: relative; width: 56px; height: 56px; border-radius: 50%; border: none; background: #e91e63; color: #fff; font-size: 24px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.chat-toggle:hover { color: #ffd400; }
.chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: #f44336; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.chat-window { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; width: 320px; height: 420px; background: #fff; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.3); overflow: hidden; }
.chat-header { position: relative; display: flex; justify-content: center; align-items: center; padding: 4px 14px; background: #e91e63; color: #fff; font-weight: bold; text-align: center; cursor: move; }
.chat-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.chat-close:hover { color: #ffd400; }
.chat-body { flex: 1; overflow-y: auto; padding: 10px; background: #f5f5f5; }
.chat-msg { max-width: 80%; margin: 6px 0; padding: 8px 12px; border-radius: 12px; font-size: 14px; word-wrap: break-word; }
.chat-msg-user { margin-left: auto; background: #e91e63; color: #fff; border-bottom-right-radius: 2px; }
.chat-msg-op { margin-right: auto; background: #fff; color: #222; border: 1px solid #ddd; border-bottom-left-radius: 2px; }
.chat-msg[data-status="translating"] { opacity: .7; font-style: italic; }
.chat-msg.chat-msg-old { background: #e6e6e6; color: #777; border: 1px solid #d5d5d5; }
.chat-msg-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; opacity: .75; margin-bottom: 3px; }
.chat-msg-name { font-weight: bold; }
.chat-msg-time { white-space: nowrap; }
.chat-msg-text { font-size: 14px; word-wrap: break-word; }
.chat-name-form { display: flex; gap: 6px; padding: 8px; background: #fff3f7; }
.chat-name-form input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; }
.chat-name-form button { padding: 8px 14px; border: none; border-radius: 6px; background: #e91e63; color: #fff; cursor: pointer; }
.chat-footer { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #eee; }
.chat-footer input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; }
.chat-footer textarea { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; resize: none; overflow-y: auto; line-height: 1.35; font-family: inherit; font-size: 14px; box-sizing: border-box; }
.chat-footer button { padding: 8px 14px; border: none; border-radius: 6px; background: #e91e63; color: #fff; cursor: pointer; min-width: 44px; }
.chat-footer button.loading { background: #ccc; cursor: default; }
.chat-footer button.loading .chat-send-ico { display: none; }
.chat-footer button.loading::before { content: ''; display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: chat-spin .7s linear infinite; vertical-align: middle; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (max-width: 480px) { .chat-window { width: calc(100vw - 24px); height: 70vh; } }

/* [drag/resize]: перетаскивание и масштабирование окна чата */
body.chat-dragging { user-select: none; cursor: move; }
.chat-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 5; }
.chat-resize::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px; border-right: 2px solid #bbb; border-bottom: 2px solid #bbb; }

/* [перевод]: блок перевода под оригиналом с пометкой и лоадером */
.chat-msg-trans, .op-msg-trans { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(128,128,128,.45); font-size: 13px; }
.chat-msg-trans-label, .op-msg-trans-label { display: block; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.chat-msg-trans-text, .op-msg-trans-text { word-wrap: break-word; }
.chat-loader { display: inline-block; width: 12px; height: 12px; border: 2px solid #bbb; border-top-color: transparent; border-radius: 50%; animation: chat-spin .7s linear infinite; vertical-align: middle; }

/* [консоль]: стили веб-консоли оператора */
/* [консоль]: fixed-оверлей ниже верхней панели, чтобы сверху было видно общее меню (auth_panel) */
.op-console { position: fixed; top: 30px; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; gap: 12px; padding: 12px; background: #fff; box-sizing: border-box; }
.op-dialogs { width: 300px; border: 1px solid #ddd; border-radius: 8px; overflow-y: auto; height: 100%; }
.op-dialog { padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 13px; }
.op-dialog:hover { background: #f9f9f9; }
.op-dialog.active { background: #e91e63; color: #fff; }
.op-dialog-badge { display: inline-block; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #f44336; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.op-chat { flex: 1; display: flex; flex-direction: column; border: 1px solid #ddd; border-radius: 8px; min-width: 0; height: 100%; }
.op-chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #eee; }
.op-chat-title { flex: 1; font-size: 14px; font-weight: 600; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.op-delete { padding: 6px 10px; border: none; border-radius: 6px; background: #f44336; color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.op-delete:disabled { background: #ccc; cursor: default; }
.op-delete:not(:disabled):hover { background: #d32f2f; }
.op-messages { flex: 1; overflow-y: auto; padding: 10px; background: #f7f7f7; min-height: 0; }
.op-msg { max-width: 75%; margin: 6px 0; padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.op-msg-in { background: #fff; border: 1px solid #ddd; margin-right: auto; }
.op-msg-out { background: #e91e63; color: #fff; margin-left: auto; }
.op-msg.op-msg-old { background: #e6e6e6; color: #777; border: 1px solid #d5d5d5; }
.op-msg-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; opacity: .75; margin-bottom: 3px; }
.op-msg-name { font-weight: bold; }
.op-msg-time { white-space: nowrap; }
.op-msg-text { font-size: 14px; word-wrap: break-word; }
.op-footer { display: flex; gap: 6px; padding: 8px 84px 8px 8px; border-top: 1px solid #eee; }
.op-footer input { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; }
.op-footer textarea { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 6px; resize: none; overflow-y: auto; max-height: 140px; line-height: 1.35; font-family: inherit; font-size: 14px; box-sizing: border-box; }
.op-footer button { position: relative; padding: 8px 14px; border: none; border-radius: 6px; background: #e91e63; color: #fff; cursor: pointer; }
.op-footer button.loading { background: #ccc; cursor: default; color: transparent; }
.op-footer button.loading::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -8px 0 0 -8px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: chat-spin .7s linear infinite; }
.op-empty { padding: 20px; color: #888; }
@media (max-width: 768px) { .op-console { flex-direction: column; } .op-dialogs { width: auto; max-height: 200px; } }
/* [консоль]: на мобильных верхняя панель выше (60px) */
@media (max-width: 480px) { .op-console { top: 60px; } }
