﻿/* ==========================
   USERS ONLINE PANEL STYLES
   ========================== */

/* ----- Desktop Top-Right Panel ----- */
.users-online-topright.d-md-block {
    position: fixed;
    top: calc(60px + 30px); /* below navbar */
    right: 20px;
    width: 250px;
    z-index: 1055;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Toggle button */
.users-online-topright button {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 2; /* always on top */
}

/* Collapse container sits directly below the button */
#onlineUsersCollapseDesktop {
    margin-top: 0.25rem;  /* spacing below button */
    z-index: 1;           /* behind button */
}

/* Desktop list styling */
#onlineUsersListDesktop {
    max-height: 300px;
    overflow-y: auto;
    padding-top: 0.25rem;
    background-color: #212529;
    border-radius: 0.25rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ----- Mobile Fly-Out Panel ----- */
#usersOnlinePanel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 300px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1100;
    background-color: #212529;
    border-radius: 0.25rem;
    box-shadow: -4px 0 8px rgba(0,0,0,0.3);
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#usersOnlinePanel.open {
    transform: translateX(0);
    opacity: 1;
}

/* Close button (mobile only) */
#closeUsersOnline {
    display: none;
}

/* ----- Mobile Adjustments ----- */
@media (max-width: 767px) {

    #usersOnlinePanel {
        position: fixed;
        top: 60px;
        right: 0;
        bottom: 0;

        width: 70% !important;
        max-width: 320px !important;

        height: calc(100dvh - 60px);
        

        background-color: rgba(33, 37, 41, 0.75);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1100;

        overflow: hidden;
    }

    #usersOnlinePanel .card {
        width: 100% !important;   /* fill panel, NOT screen */
        max-width: 100% !important;

        height: 100%;
        display: flex;
        flex-direction: column;
        border-radius: 0;
    }

    #onlineUsersListMobile {
        flex: 1;
        overflow-y: auto;
        min-height: 0; /* REQUIRED for flex scrolling */
    }

    #usersOnlinePanel.open {
        transform: translateX(0);
    }
}


/* ----- List Items ----- */
.users-online-topright .list-group-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.users-online-topright .list-group-item:hover {
    background-color: rgba(255,255,255,0.05);
}


/* Avatar Circle */
.users-online-topright .list-group-item .rounded-circle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    overflow: hidden;
}

/* Small Online Dot */
.online-dot {
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.online-icon {
    color: #28a745; /* green for stroke */
}

@keyframes pulse {
    0% { transform: scale(1); opacity:1; }
    50% { transform: scale(1.5); opacity:0.5; }
    100% { transform: scale(1); opacity:1; }
}

/* ----- Scrollable Max Height ----- */
.max-height-scroll {
    max-height: 300px;
    overflow-y: auto;
}

.users-online-topright .user-item {
    display: flex;
    align-items: center;      /* vertically center all children */
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.users-online-topright .user-item:hover {
    background-color: rgba(255,255,255,0.05);
}

/* Avatar */
.users-online-topright .user-item .rounded-circle {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    overflow: hidden;
}

/* Username */
.users-online-topright .user-item span.text-truncate {
    flex: 1 1 auto;           /* take available space */
    min-width: 0;             /* allow truncation */
    color: #fff;
    display: flex;
    align-items: center;      /* vertically center */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Badge */
.users-online-topright .user-item .badge {
    flex-shrink: 0;           /* don’t shrink */
    display: inline-flex;     /* inline so it sits in the flow */
    align-items: center;      /* vertical center */
    justify-content: center;  /* horizontal center */
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    background-color: #fd0101;
    color: #fff;
    font-size: 0.7rem;
    line-height: 1;           /* prevent extra height */
}

/* Online dot */
.users-online-topright .user-item .online-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
    animation: pulse 1.5s infinite;
}

/* ----- Pulse animation ----- */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

