/**
 * User Lists & Banners Module
 * Optimized with consolidated selectors
 * Uses attribute selectors to reduce repetition
 * Theme-compatible with CSS variables
 */

/* ===== CSS VARIABLES FOR THEME COMPATIBILITY ===== */
:root {
    --userlist-container-bg: rgba(0, 0, 0, 0.2);
    --userlist-border-color: rgba(255, 255, 255, 0.1);
    --userlist-banner-bg: rgba(0, 0, 0, 0.25);
    --userlist-item-bg: rgba(255, 255, 255, 0.05);
    --userlist-item-hover-bg: rgba(255, 255, 255, 0.1);
    --userlist-count-bg: rgba(255, 255, 255, 0.15);
    --userlist-status-bg: rgba(255, 255, 255, 0.1);
}

/* ===== USER LIST CONTAINER ===== */
#container_user {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    display: block;
    padding: 3px;
    padding-bottom: 10px;
    box-sizing: border-box;
    overflow: visible;
    background: transparent;
    border-radius: 8px;
    /* Text color inherits from body/theme - no hardcoded color */
}

@media (max-width: 768px) {
    #container_user {
        padding: 4px;
        width: 98%;
    }
}

@media (max-width: 480px) {
    #container_user {
        width: 100%;
    }
}

/* ===== BANNER BASE STYLES (CONSOLIDATED) ===== */
/* Using attribute selector to target all banners at once */
#container_user [class$="-banner"] {
    width: 100%;
    padding: 4px 3px;
    margin: 0 0 6px 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 6px;
    position: relative;
    border: none;
}



/* Total users banner special positioning */
#container_user .total-users-banner {
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-bottom: 0;
    margin-top: 8px;
    border-top: none;
    box-shadow: none;
}

/* ===== BANNER COLORS (REMOVED FOR BETTER TEXT READABILITY) ===== */
/* All colored backgrounds removed - banners now use transparent backgrounds */
/* Text colors inherit from theme for better readability across all themes */

/* ===== BANNER CONTENT (CONSOLIDATED) ===== */
/* Banner headers - consolidated */
/* Colored backgrounds within borders for better visibility across all themes */
#container_user [class$="-header"],
#container_user .banner-header,
#container_user .owner-left,
#container_user .total-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin-bottom: 6px;
    padding: 6px 8px;
    /* More visible border - works on both light and dark backgrounds */
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    /* More visible background for better definition */
    background: rgba(0, 0, 0, 0.2);
}

/* Banner titles - consolidated */
#container_user [class$="-title"],
#container_user .banner-title,
#container_user .owner-title,
#container_user .total-title {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    vertical-align: middle;
    margin: 0;
    line-height: 1.4;
}

/* Banner header icons - consolidated */
#container_user [class$="-header"] i,
#container_user .banner-header i,
#container_user .owner-left i,
#container_user .total-header i {
    display: inline-block;
    font-size: 13px;
    vertical-align: middle;
    margin: 0 6px;
}

/* User count badges */
#container_user .user-count {
    display: inline-block;
    padding: 2px 6px;
    margin-left: 8px;
    border-radius: 4px;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    min-width: 40px;
    border: none;
    box-shadow: none;
    vertical-align: middle;
    text-align: center;
    line-height: 1.3;
    /* Text color inherits from theme - no hardcoded color */
}

#container_user .user-count span {
    margin: 0 2px;
}

/* Banner content areas - consolidated */
#container_user .banner-content,
#container_user [class$="-user-list"],
#container_user [class$="-user"],
#container_user .user-list {
    width: 100%;
    padding: 3px;
    margin: 2px 0 0 0;
    background: transparent;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.3;
    /* Text color inherits from theme - no hardcoded color */
    border: none;
}

/* Offline user list special spacing */
#container_user .offline-user {
    padding: 6px;
    font-size: 12px;
    line-height: 1.5;
    min-height: 20px;
}

/* ===== USER ITEMS (CONSOLIDATED) ===== */
/* User item styling within banners - consolidated */
#container_user [class*="user"] .user_item,
#container_user .banner-content .user_item {
    margin: 1px 0;
    background: transparent;
    border: none;
    border-radius: 5px;
    /* Text color inherits from theme - no hardcoded color */
}



/* Offline user items special spacing */
#container_user .offline-user .user_item {
    margin: 2px 0;
    padding: 4px 6px;
    min-height: 24px;
    display: table;
    table-layout: fixed;
    width: 100%;
}

#container_user .offline-user .user_item_icon {
    display: table-cell;
    vertical-align: middle;
    width: 24px;
    text-align: center;
    font-size: 15px;
}

/* User status badges */
#container_user .user_status {
    font-size: 10px;
    opacity: 0.8;
    margin-left: 2px;
    padding: 1px 3px;
    background: transparent;
    border-radius: 8px;
    vertical-align: middle;
    /* Text color inherits from theme - no hardcoded color */
}


/* Icon styles handled by main.css */

/* ===== LITE THEME COMPATIBILITY ===== */
/* Lite theme has body background #ededed and white panels (.backglob) */
/* Detection handled via .backglob, .back_chat, .back_panel classes below */

/* Lite theme detection via backglob class (Lite.css sets .backglob to white) */
/* All backgrounds removed - text colors inherit from body/theme */
.backglob #container_user,
.back_chat #container_user,
.back_panel #container_user {
    background: transparent;
    /* Text color inherits from body (Lite theme sets body color:#333) */
}

/* Light theme header styling - adjust background for better visibility */
/* This targets Lite and Dolphin themes where panels have white/light backgrounds */
.backglob #container_user [class$="-header"],
.back_chat #container_user [class$="-header"],
.back_panel #container_user [class$="-header"],
.backglob #container_user .banner-header,
.back_chat #container_user .banner-header,
.back_panel #container_user .banner-header,
.backglob #container_user .owner-left,
.back_chat #container_user .owner-left,
.back_panel #container_user .owner-left,
.backglob #container_user .total-header,
.back_chat #container_user .total-header,
.back_panel #container_user .total-header {
    /* Darker background for better contrast on light theme backgrounds */
    background: rgba(0, 0, 0, 0.1);
    /* More visible dark border for better visibility on light backgrounds */
    border-color: rgba(0, 0, 0, 0.25);
}


.backglob #container_user .user_item,
.back_chat #container_user .user_item,
.back_panel #container_user .user_item {
    background: transparent;
    border: none;
}


.backglob .total-title,
.back_chat .total-title,
.back_panel .total-title {
    text-shadow: none;
}

.backglob #container_user .user-count,
.back_chat #container_user .user-count,
.back_panel #container_user .user-count {
    background: transparent;
    border: none;
}

.backglob #container_user .user_status,
.back_chat #container_user .user_status,
.back_panel #container_user .user_status {
    background: transparent;
}


/* ===== DOLPHIN THEME COMPATIBILITY ===== */
/* All backgrounds removed - no special styling needed */

/* ===== RANK ICON SIZING ===== */
/* Increased rank icon sizes for better visibility in user lists and chat logs */
.sub_list_rank img,
.ulist_rank img,
.list_rank img {
    height: 24px;
    width: auto;
    max-width: 24px;
    max-height: 24px;
}

.chat_rank {
    height: 24px;
    width: auto;
}

.chat_rank img {
    height: 24px;
    width: auto;
    max-height: 24px;
}

/* ===== REACTION BUTTONS FOR NEWS WALL AND FRIENDS WALL ===== */
/* Pill-shaped reaction buttons with colored backgrounds */
.modal_menu {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
}

.modal_menu ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.modal_menu_item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
    min-height: 36px;
}

/* Reaction icon styling */
.modal_menu_item .wlike_icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal_menu_item .wlike_icon img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

.modal_menu_item .wlike_icon i {
    font-size: 18px;
    line-height: 1;
    display: block;
}

.modal_menu_item .plike_text {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
}

/* Reaction button colors */
.modal_menu_item[data-z="like_it"] {
    background: #4A90E2;
    color: #fff;
}

.modal_menu_item[data-z="dislike_it"] {
    background: #E24A4A;
    color: #fff;
}

.modal_menu_item[data-z="love_it"] {
    background: #E24A90;
    color: #fff;
}

.modal_menu_item[data-z="funny_it"] {
    background: #F5C842;
    color: #333;
}

.modal_menu_item[data-z="wow_it"] {
    background: #F5C842;
    color: #333;
}

.modal_menu_item[data-z="sad_it"] {
    background: #4A90E2;
    color: #fff;
}

.modal_menu_item[data-z="angry_it"] {
    background: #E24A4A;
    color: #fff;
}

.modal_menu_item[data-z="fire_it"] {
    background: #FF6B35;
    color: #fff;
}

/* Selected/hover states */
.modal_menu_item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

.modal_menu_item.modal_selected {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* ===== REACTION BUTTONS ON POSTS (WALL & NEWS) ===== */
/* Override main.css float and table display for grid layout */
.like_container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    clear: both;
}

/* Hide the clear:both div that breaks the grid */
.like_container > div[style*="clear:both"],
.like_container > div[style*="clear: both"] {
    display: none;
}

/* Style .like_count divs as pill-shaped buttons */
.post_control .like_count,
.like_container .like_count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 32px;
    width: 100%;
    box-sizing: border-box;
    float: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Reaction icon styling */
.post_control .like_count .like_icon,
.like_container .like_count .like_icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.post_control .like_count .like_icon img,
.like_container .like_count .like_icon img {
    width: 18px;
    height: 18px;
    display: block;
    object-fit: contain;
}

.post_control .like_count .like_icon i,
.like_container .like_count .like_icon i {
    font-size: 16px;
    line-height: 1;
    display: block;
}

/* Reaction button colors - using nth-child accounting for clear div */
/* Like (1st) - Blue */
.like_container > .like_count:nth-child(1),
.post_control > .like_count:nth-child(1) {
    background: #4A90E2;
    color: #fff;
}

/* Dislike (2nd) - Red */
.like_container > .like_count:nth-child(2),
.post_control > .like_count:nth-child(2) {
    background: #E24A4A;
    color: #fff;
}

/* Love (3rd) - Pink */
.like_container > .like_count:nth-child(3),
.post_control > .like_count:nth-child(3) {
    background: #E24A90;
    color: #fff;
}

/* Funny (4th) - Yellow */
.like_container > .like_count:nth-child(4),
.post_control > .like_count:nth-child(4) {
    background: #F5C842;
    color: #333;
}

/* Wow (6th - after clear div) - Yellow */
.like_container > .like_count:nth-child(6),
.post_control > .like_count:nth-child(6) {
    background: #F5C842;
    color: #333;
}

/* Sad (7th) - Blue */
.like_container > .like_count:nth-child(7),
.post_control > .like_count:nth-child(7) {
    background: #4A90E2;
    color: #fff;
}

/* Angry (8th) - Red */
.like_container > .like_count:nth-child(8),
.post_control > .like_count:nth-child(8) {
    background: #E24A4A;
    color: #fff;
}

/* Fire (9th) - Orange */
.like_container > .like_count:nth-child(9),
.post_control > .like_count:nth-child(9) {
    background: #FF6B35;
    color: #fff;
}

/* Hover effects */
.post_control .like_count:hover,
.like_container .like_count:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0.9;
}

/* Active/liked state */
.post_control .like_count.liked,
.post_control .like_count.disliked,
.post_control .like_count.loved,
.post_control .like_count.funned,
.post_control .like_count.wowed,
.post_control .like_count.saded,
.post_control .like_count.angried,
.post_control .like_count.fired,
.like_container .like_count.liked,
.like_container .like_count.disliked,
.like_container .like_count.loved,
.like_container .like_count.funned,
.like_container .like_count.wowed,
.like_container .like_count.saded,
.like_container .like_count.angried,
.like_container .like_count.fired {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

/* Ensure post_control works with grid layout */
.post_control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.post_control .like_container {
    flex: 1 1 100%;
    order: -1;
}

.post_control .like_count {
    margin: 0;
}

/* Profile likes display */
.plike_item img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-right: 1px;
    object-fit: cover;
}