/* ── Chat Widget (user-facing floating button) ── */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.chat-fab {
    height: 44px;
    border-radius: 22px;
    background: #5c6bc0;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 0 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    position: relative;
    transition: background .2s;
}

.chat-fab:hover { background: #3f51b5; }

.chat-fab__label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.chat-fab__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #e53935;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ── Chat Window ── */

.chat-window {
    width: 340px;
    height: 460px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-window__header {
    background: #5c6bc0;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}

.chat-window__close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    opacity: .8;
}
.chat-window__close:hover { opacity: 1; }

.chat-window__messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-window__hint {
    color: #9e9e9e;
    font-size: 13px;
    text-align: center;
    margin-top: 24px;
}

.chat-window__input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #ebebeb;
}

.chat-window__input-row input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}
.chat-window__input-row input:focus { border-color: #5c6bc0; }

.chat-window__input-row button {
    background: #5c6bc0;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 16px;
    transition: background .2s;
}
.chat-window__input-row button:hover:not(:disabled) { background: #3f51b5; }
.chat-window__input-row button:disabled { opacity: .5; cursor: default; }

/* ── Shared message bubbles ── */

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chat-msg--user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-msg--support {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg__bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg--user .chat-msg__bubble {
    background: #5c6bc0;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg--support .chat-msg__bubble {
    background: #f1f3f4;
    color: #212121;
    border-bottom-left-radius: 4px;
}

.chat-msg__meta {
    font-size: 11px;
    color: #9e9e9e;
    margin-top: 3px;
    padding: 0 4px;
}

/* ── Support Chat Page ── */

.support-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: calc(100vh - 80px);
    overflow: hidden;
}

.support-sidebar {
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: #fafafa;
}

.support-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}

.support-sidebar__count {
    background: #5c6bc0;
    color: #fff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
}

.support-sidebar__empty {
    color: #9e9e9e;
    font-size: 13px;
    padding: 24px 16px;
    text-align: center;
}

.support-conv-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #ebebeb;
    transition: background .15s;
}
.support-conv-item:hover { background: #eeeeee; }
.support-conv-item--active { background: #e8eaf6; }

.support-conv-item__name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.support-conv-item__preview {
    font-size: 12px;
    color: #616161;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-conv-item__time {
    font-size: 11px;
    color: #9e9e9e;
    margin-top: 4px;
}

.support-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.support-main__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9e9e9e;
    font-size: 15px;
}

.support-main__header {
    padding: 14px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
}

.support-main__conv-id {
    font-weight: 400;
    font-size: 12px;
    color: #9e9e9e;
}

.support-main__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-main__input-row {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
}

.support-main__input-row input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
}
.support-main__input-row input:focus { border-color: #5c6bc0; }

.support-main__input-row button {
    background: #5c6bc0;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background .2s;
}
.support-main__input-row button:hover:not(:disabled) { background: #3f51b5; }
.support-main__input-row button:disabled { opacity: .5; cursor: default; }
