/* Floating Chat Launcher Button */
#minus_chat_fab {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 999px;
    background: #6baf00;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, background 0.15s ease;
}
#minus_chat_fab:hover {
    background: #589300;
    transform: translateY(-2px);
}
#minus_chat_fab .io-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    display: inline-block;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
#minus_chat_fab.has-unread .io-dot {
    background: #22c55e;
    box-shadow: 0 0 8px #86efac;
}
@keyframes ioChatSweep {
    0% { left: -60%; opacity: 0; }
    20% { opacity: 0.55; }
    100% { left: 130%; opacity: 0; }
}
#minus_chat_fab.has-unread::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.6), rgba(255,255,255,0));
    transform: skewX(-20deg);
    animation: ioChatSweep 1.6s ease-in-out infinite;
    pointer-events: none;
}
#minus_chat_fab .io-unread {
    display: none;
    background: #e53935;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 2px;
}
#minus_chat_fab .io-unread.show {
    display: inline-block;
}

/* Odometer / Speedometer digit roll animation */
#io_online_breakdown .io-odo-logged,
#io_online_breakdown .io-odo-guests {
    display: inline-block !important;
}
.io-odo {
    display: inline-flex !important;
    align-items: center;
    vertical-align: baseline;
    line-height: 1.15;
}
.io-odo > span {
    display: inline-block !important;
}
.io-odo-digit {
    display: inline-block !important;
    position: relative;
    height: 1.15em;
    overflow: hidden;
    vertical-align: bottom;
}
.io-odo-reel {
    display: flex !important;
    flex-direction: column;
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.io-odo-reel span {
    display: block !important;
    height: 1.15em;
    line-height: 1.15em;
    text-align: center;
}

/* Online users list show(300) / hide(300) */
#io_online_users a.user {
    display: inline-block;
    transition: opacity 0.3s ease, transform 0.3s ease, max-width 0.3s ease;
    vertical-align: baseline;
}
#io_online_users a.user:not(:last-child)::after {
    content: ", ";
    color: #333;
}
#io_online_users a.user.io-user-enter {
    opacity: 0;
    transform: translateY(-6px) scale(0.92);
}
#io_online_users a.user.io-user-leave {
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
}

@media (max-width: 700px) {
    #minus_chat_fab {
        bottom: 62px;
        right: 12px;
        padding: 9px 13px;
        font-size: 13px;
    }
}

/* Modal Backdrop & Dialog */
#minus_chat_modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
}
#minus_chat_modal.open {
    display: flex;
}
.mchat-box {
    width: 100%;
    max-width: 520px;
    height: 82vh;
    max-height: 640px;
    background: #ffffff;
    color: #222;
    border-radius: 10px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #d7e5c3;
}
.mchat-header {
    background: #294800;
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.mchat-title {
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mchat-online-pill {
    font-size: 12px;
    font-weight: normal;
    background: rgba(255, 255, 255, 0.16);
    padding: 2px 9px;
    border-radius: 999px;
}
.mchat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.mchat-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.mchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    background: #f7faf3;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mchat-empty {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin: auto 0;
}
.mchat-msg {
    background: #ffffff;
    border: 1px solid #e2ebd4;
    border-radius: 8px;
    padding: 8px 11px;
    max-width: 88%;
    align-self: flex-start;
    word-break: break-word;
}
.mchat-msg.mine {
    align-self: flex-end;
    background: #e9f5d8;
    border-color: #c5df9e;
}
.mchat-msg-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 3px;
    font-size: 12px;
}
.mchat-author {
    font-weight: bold;
    color: #294800;
    text-decoration: none;
}
.mchat-author.guest {
    color: #556b2f;
}
.mchat-time {
    color: #888;
    font-size: 11px;
}
.mchat-text {
    font-size: 14px;
    line-height: 1.4;
}

.mchat-footer {
    border-top: 1px solid #e0e8d5;
    padding: 10px 12px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.mchat-nick-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}
.mchat-nick-row input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 12px;
}
.mchat-input-row {
    display: flex;
    gap: 8px;
}
.mchat-input-row input {
    flex: 1;
    padding: 9px 11px;
    border: 1px solid #c5d3b0;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}
.mchat-input-row input:focus {
    border-color: #6baf00;
}
.mchat-input-row button {
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    background: #6baf00;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}
.mchat-input-row button:hover {
    background: #589300;
}

/* Online block list styling */
#io_online_users {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    font-size: 11.5px;
    line-height: 1.4;
    margin-top: 4px;
}
#io_online_users a {
    display: inline-block;
    padding: 0 2px;
    background: none;
    color: #111111;
    font-size: 11.5px;
    text-decoration: none;
}
#io_online_users a:hover {
    text-decoration: underline;
}
#io_online_users a.io-mod {
    color: #ea580c;
    font-weight: 600;
}
#io_online_users a.io-admin {
    color: #16a34a;
    font-weight: 700;
}
body.dark #io_online_users a {
    color: #e2e8f0;
}
body.dark #io_online_users a.io-mod {
    color: #fb923c;
}
body.dark #io_online_users a.io-admin {
    color: #4ade80;
}

/* Dark Mode support */
body.dark .mchat-box {
    background: #1e221b;
    color: #e4eadc;
    border-color: #36412d;
}
body.dark .mchat-messages {
    background: #151813;
}
body.dark .mchat-msg {
    background: #232820;
    border-color: #353f2d;
    color: #e4eadc;
}
body.dark .mchat-msg.mine {
    background: #2b3a1d;
    border-color: #48642c;
}
body.dark .mchat-author {
    color: #9be038;
}
body.dark .mchat-footer {
    background: #1e221b;
    border-top-color: #36412d;
}
body.dark .mchat-nick-row input,
body.dark .mchat-input-row input {
    background: #151813;
    color: #e4eadc;
    border-color: #445238;
}
