/* ===========================================================
   BabyFun Chatbox v2.1 — Cộng đồng BabyFun
   Primary: #fe0078
   =========================================================== */

/* --- Reset & Container --- */
.bf-chatbox {
    font-family: Tahoma, 'Segoe UI', Verdana, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.bf-chatbox * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* --- Header --- */
.bf-header {
    background: linear-gradient(135deg, #fe0078, #d50065);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 13.5px;
    letter-spacing: .3px;
}

.bf-header-l {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bf-header-l .dashicons {
    font-size: 17px;
    width: 17px;
    height: 17px;
}

.bf-header-r {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 400;
    opacity: .92;
}

.bf-dot {
    width: 8px;
    height: 8px;
    background: #00e676;
    border-radius: 50%;
    display: inline-block;
    animation: bfBlink 1.4s ease-in-out infinite;
}

@keyframes bfBlink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .25
    }
}

/* --- Body layout --- */
.bf-body {
    display: flex;
    background: #fdf6f0;
    min-height: 332px;
}

.bf-col-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid #f0e4d8;
    position: relative;
}

.bf-col-side {
    width: 150px;
    flex-shrink: 0;
    background: #fef8f3;
}

.bf-side-title {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    padding: 9px 10px 5px;
    text-transform: uppercase;
    border-bottom: 1px solid #f0e4d8;
    letter-spacing: .5px;
}

.bf-online-list {
    padding: 6px 10px;
    max-height: 290px;
    overflow-y: auto;
}

.bf-online-list .bf-ou {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 0;
    font-size: 11px;
    color: #fe0078;
    font-weight: 700;
}

.bf-online-list .bf-ou img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid #f0e4d8;
}

.bf-olv {
    font-size: 10px;
}

/* --- Messages --- */
.bf-msgs {
    flex: 1;
    overflow-y: auto;
    max-height: 330px;
    min-height: 200px;
    scroll-behavior: smooth;
}

.bf-msgs::-webkit-scrollbar {
    width: 5px;
}

.bf-msgs::-webkit-scrollbar-thumb {
    background: #e0d0c4;
    border-radius: 4px;
}

.bf-msg {
    display: flex;
    align-items: flex-start;
    padding: 6px 12px;
    border-bottom: 1px solid #f0e4d8;
    gap: 8px;
    position: relative;
    transition: background .15s;
}

.bf-msg:hover {
    background: rgba(254, 0, 120, .03);
}

.bf-msg:hover .bf-rbtn {
    opacity: 1;
}

/* --- Avatar Wrapper + Level Badge on Corner --- */
.bf-av-wrap {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
}

.bf-av {
    width: 32px;
    height: 32px;
    border-radius: 5px;
    border: 1.5px solid #f0e4d8;
    display: block;
    transition: border-color .2s;
}

/* Khi có level badge → viền avatar đổi màu theo level */
.bf-av-wrap:has(.bf-av-badge) .bf-av {
    border-color: inherit;
}

/* Badge nhỏ ở góc phải dưới avatar */
.bf-av-badge {
    position: absolute;
    bottom: -3px;
    right: -4px;
    font-size: 11px;
    line-height: 1;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1.5px solid #fff;
    cursor: default;
    z-index: 2;
    transition: transform .2s;
}

.bf-av-badge:hover {
    transform: scale(1.4);
    z-index: 10;
}

/* Level-specific effects */
.bf-av-badge.bf-lv-family {
    box-shadow: 0 0 4px rgba(255, 152, 0, .5);
}

.bf-av-badge.bf-lv-hero {
    box-shadow: 0 0 6px rgba(233, 30, 99, .5);
    animation: bfGlow 2s ease-in-out infinite;
}

.bf-av-badge.bf-lv-legend {
    box-shadow: 0 0 8px rgba(255, 87, 34, .6);
    animation: bfShine 1.5s ease-in-out infinite;
}

@keyframes bfGlow {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes bfShine {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.25) rotate(8deg);
    }
}

/* Online sidebar level badge (nhỏ hơn) */
.bf-olv {
    font-size: 10px;
}

.bf-mbody {
    flex: 1;
    min-width: 0;
    padding-right: 115px;
    word-break: break-word;
}

.bf-name {
    color: #fe0078;
    font-weight: 700;
    font-size: 12.5px;
}

.bf-name::before {
    content: "@ ";
    color: #ccc;
    font-weight: 400;
}

.bf-sep {
    color: #bbb;
}

.bf-txt {
    color: #333;
}

.bf-time {
    position: absolute;
    right: 12px;
    top: 8px;
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

.bf-empty {
    padding: 40px 20px;
    text-align: center;
    color: #ccc;
    font-style: italic;
    font-size: 13px;
}

/* New message */
.bf-msg-new {
    animation: bfFade .35s ease-out;
    background: #fff4e8 !important;
}

@keyframes bfFade {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Emoji Reactions --- */
.bf-rbtn {
    position: absolute;
    right: 12px;
    bottom: 5px;
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: opacity .2s;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
}

.bf-rbtn:hover {
    background: #fce4ec;
    border-color: #f8bbd0;
}

.bf-emoji-picker {
    position: absolute;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 6px 8px;
    display: flex;
    gap: 3px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
    z-index: 100;
}

.bf-emo {
    font-size: 22px;
    cursor: pointer;
    padding: 4px 5px;
    border-radius: 8px;
    transition: all .12s;
    line-height: 1;
}

.bf-emo:hover {
    background: #fce4ec;
    transform: scale(1.3);
}

.bf-reacts {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    flex-wrap: wrap;
}

.bf-react {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: #fff;
    border: 1px solid #f0e4d8;
    border-radius: 14px;
    padding: 1px 7px;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}

.bf-react:hover {
    background: #fce4ec;
    border-color: #fe0078;
    transform: scale(1.05);
}

.bf-react i {
    font-style: normal;
    font-size: 10px;
    color: #999;
    font-weight: 700;
}

/* --- Hidden (banned) --- */
.bf-hidden {
    opacity: .45;
}

.bf-censored {
    color: #e53935;
    font-size: 11.5px;
    background: #ffebee;
    padding: 2px 8px;
    border-radius: 3px;
}

/* --- Input bar --- */
.bf-input-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #f5ece3;
    border-top: 1px solid #f0e4d8;
    gap: 7px;
}

#bf-in {
    flex: 1;
    padding: 7px 12px;
    border: 1px solid #e0d4c8;
    border-radius: 20px;
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

#bf-in:focus {
    border-color: #fe0078;
    box-shadow: 0 0 0 3px rgba(254, 0, 120, .1);
}

#bf-send {
    background: #fe0078;
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background .15s;
}

#bf-send:hover {
    background: #e0006a;
}

#bf-send:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* --- Not logged in --- */
.bf-nologin {
    padding: 10px 14px;
    background: #f5ece3;
    border-top: 1px solid #f0e4d8;
    color: #777;
    font-size: 12.5px;
    text-align: center;
}

.bf-nologin a {
    color: #fe0078;
    font-weight: 700;
    text-decoration: none;
}

.bf-nologin a:hover {
    text-decoration: underline;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .bf-col-side {
        display: none;
    }

    .bf-col-main {
        border-right: none;
    }

    .bf-mbody {
        padding-right: 80px;
    }

    .bf-time {
        font-size: 10px;
    }
}