/* ========================================================
   SPERANZA RAIDERS LOUNGE (ห้องนั่งเล่นเรดเดอร์) - MODERN THEME
   Inspired by standard modern messenger aesthetics (Telegram / WhatsApp / Discord)
   High contrast, clear message bubbles that never blend into background
   ======================================================== */

:root {
    --lounge-bg: #090b10;
    --lounge-surface: #0f131c;
    --lounge-header-bg: #141824;
    --lounge-chat-bg: #0c0f17;
    
    /* Incoming message bubble (คนอื่นพิมพ์) - Elevated dark slate card */
    --lounge-incoming-bubble: #1c2232;
    --lounge-incoming-border: rgba(255, 255, 255, 0.09);
    --lounge-incoming-text: #f1f5f9;
    --lounge-incoming-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);

    /* Outgoing message bubble (เราพิมพ์) - Balanced Deep Emerald/Teal */
    --lounge-outgoing-bubble: linear-gradient(145deg, #115e50 0%, #094539 100%);
    --lounge-outgoing-text: #ffffff;
    --lounge-outgoing-meta: #99f6e4;
    --lounge-outgoing-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);

    --lounge-border: rgba(255, 255, 255, 0.08);
    --lounge-gold: #f9a825;
    --lounge-gold-glow: rgba(249, 168, 37, 0.25);
    --lounge-accent-teal: #2dd4bf;
}

.lounge-wrapper {
    background-color: var(--lounge-bg);
    background-image: 
        linear-gradient(180deg, rgba(7, 9, 14, 0.78) 0%, rgba(7, 9, 14, 0.92) 100%),
        url('../images/speranza.webp');
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    padding-top: 86px;
    padding-bottom: 20px;
    color: #e5e7eb;
}

/* Master Lounge Container (Glassmorphic Atmosphere) */
.lounge-card-main {
    background: rgba(15, 19, 28, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: calc(100vh - 130px);
    max-height: 820px;
    min-height: 520px;
    margin: 0 auto;
}

/* Top Banner Header */
.lounge-header {
    background: var(--lounge-header-bg);
    border-bottom: 1px solid var(--lounge-border);
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.lounge-title-box h1 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.4px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lounge-badge-online {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

.lounge-badge-dot {
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
    animation: loungePulse 2s infinite;
}

@keyframes loungePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Channel Tabs Navigation */
.lounge-channel-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px;
    border-radius: 30px;
    border: 1px solid var(--lounge-border);
    gap: 4px;
}

.lounge-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.lounge-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.lounge-tab-btn.active {
    background: var(--lounge-gold);
    color: #0d111a;
    font-weight: 700;
    box-shadow: 0 2px 10px var(--lounge-gold-glow);
}

.lounge-tab-btn .badge-counter {
    background: rgba(0, 0, 0, 0.25);
    color: inherit;
    font-size: 0.68rem;
    padding: 1px 5px;
    border-radius: 10px;
}

/* Middle Layout Structure */
.lounge-body-layout {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
    position: relative;
}

.lounge-main-col {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

/* Chat Feed Messages Area */
.lounge-chat-area {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: radial-gradient(circle at 50% 0%, rgba(17, 21, 34, 0.86) 0%, rgba(10, 13, 20, 0.94) 100%),
                url('../images/speranza.webp') no-repeat center center;
    background-size: cover;
    overscroll-behavior-y: contain;
}

.lounge-chat-area::-webkit-scrollbar {
    width: 6px;
}
.lounge-chat-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
}
.lounge-chat-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.lounge-chat-area::-webkit-scrollbar-thumb:hover {
    background: var(--lounge-accent-teal);
}

/* Date Divider Pill (Today / เมื่อวาน) */
.lounge-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0 12px 0;
    position: relative;
}

.lounge-date-divider span {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px);
    letter-spacing: 0.3px;
}

/* Individual Message Row (Contain layout & style for peak performance) */
.lounge-msg-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInMsg 0.2s ease-out;
    max-width: 100%;
    contain: layout style;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Outgoing Message: Align to Right (flex-direction: row-reverse) */
.lounge-msg-row.mine {
    flex-direction: row-reverse;
    align-self: flex-end;
}

/* Circular Modern Avatar */
.lounge-msg-avatar {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    position: relative;
    border-radius: 50%;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lounge-msg-avatar a {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
}

.lounge-msg-avatar img {
    width: 38px;
    height: 38px;
    object-fit: cover;
    border-radius: 50% !important;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    display: block;
}

/* Message Content Container (holds meta info + bubble) */
.lounge-msg-content {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    min-width: 0;
}

.lounge-msg-row.mine .lounge-msg-content {
    align-items: flex-end;
}

/* Meta Information (Name, Time, Channel Badge) */
.lounge-msg-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 5px;
    font-size: 0.76rem;
    white-space: nowrap;
    flex-wrap: nowrap;
    line-height: 1.2;
}

.lounge-msg-row.mine .lounge-msg-meta {
    justify-content: flex-end;
}

.lounge-msg-author {
    color: #e2e8f0;
    font-weight: 700;
    font-size: 0.86rem;
    text-decoration: none;
    letter-spacing: 0.2px;
    transition: color 0.15s ease;
}

.lounge-msg-author:hover {
    color: var(--lounge-gold);
}

.lounge-msg-time {
    color: #828c9e;
    font-size: 0.72rem;
    font-weight: 400;
}

.lounge-msg-check {
    color: #2dd4bf;
    font-size: 0.85rem;
    line-height: 1;
}

/* Category Chips (Minimalist, borderless badges - roomy for Thai tone marks) */
.lounge-cat-chip {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.35;
    vertical-align: middle;
    border: none;
}
.lounge-cat-chip.cat-lfg {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}
.lounge-cat-chip.cat-trade {
    background: rgba(6, 182, 212, 0.2);
    color: #67e8f9;
}
.lounge-cat-chip.cat-general {
    background: rgba(249, 168, 37, 0.2);
    color: #fde047;
}

/* Merchant Badge - Hidden across lounge */
.lounge-merchant-badge {
    display: none !important;
}

/* Hover-Only Delete Button (Clean & Modern) */
.lounge-msg-delete-btn {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.lounge-msg-row:hover .lounge-msg-delete-btn {
    opacity: 0.7;
    visibility: visible;
}

.lounge-msg-delete-btn:hover {
    opacity: 1 !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.15);
}

@media (max-width: 991.98px) {
    .lounge-msg-delete-btn {
        opacity: 0.4;
        visibility: visible;
    }
}

/* ========================================================
   MESSAGE BUBBLE DESIGN (HUGS CONTENT, NEVER BLENDS IN)
   ======================================================== */
.lounge-msg-body {
    background: #1f2537;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px 18px 18px 4px;
    padding: 10px 14px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    word-break: break-word;
    color: #ffffff;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

/* Attached Cards Container Constraints */
.lounge-msg-body.has-item-card {
    min-width: 360px;
}
.lounge-msg-body.has-party-card {
    min-width: 330px;
}

/* Outgoing Message Bubble (Balanced Deep Emerald/Teal - Comfortable & Soothing) */
.lounge-msg-row.mine .lounge-msg-body {
    background: var(--lounge-outgoing-bubble);
    border: 1px solid rgba(45, 212, 191, 0.28);
    border-radius: 18px 18px 4px 18px;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    font-weight: 400;
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.lounge-msg-text {
    font-size: 0.94rem;
    line-height: 1.5;
    margin: 0;
    color: #ffffff;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.lounge-msg-row.mine .lounge-msg-text {
    color: #ffffff;
    font-weight: 400;
}

/* Clickable Web & Image Links */
.lounge-msg-link {
    color: #38bdf8;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    word-break: break-all;
    transition: all 0.15s ease;
    display: inline;
}

.lounge-msg-link:hover {
    color: #7dd3fc;
    text-decoration: underline;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

.lounge-msg-link i {
    font-size: 0.78em;
    opacity: 0.85;
}

.lounge-msg-row.mine .lounge-msg-link {
    color: #fde047;
    font-weight: 600;
}

.lounge-msg-row.mine .lounge-msg-link:hover {
    color: #fef08a;
    text-shadow: 0 0 10px rgba(253, 224, 71, 0.5);
}

/* Image Link Previews */
.lounge-msg-images-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-width: 100%;
}

.lounge-msg-image-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    max-width: 320px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
    display: inline-block;
}

.lounge-msg-image-preview:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 168, 37, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(249, 168, 37, 0.15);
}

.lounge-msg-image-preview a {
    display: block;
    text-decoration: none;
    position: relative;
}

.lounge-msg-image-preview img {
    display: block;
    width: 100%;
    max-width: 320px;
    max-height: 240px;
    object-fit: cover;
    border-radius: 11px;
    transition: transform 0.25s ease;
}

.lounge-msg-image-preview:hover img {
    transform: scale(1.02);
}

.lounge-image-zoom-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #f1f5f9;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    pointer-events: none;
    opacity: 0.9;
    transition: all 0.18s ease;
}

.lounge-msg-image-preview:hover .lounge-image-zoom-badge {
    opacity: 1;
    background: rgba(10, 14, 23, 0.95);
    color: #f9a825;
    border-color: rgba(249, 168, 37, 0.5);
}

/* Outgoing Bubble Theme Integration */
.lounge-msg-row.mine .lounge-msg-image-preview {
    border-color: rgba(45, 212, 191, 0.3);
}

.lounge-msg-row.mine .lounge-msg-image-preview:hover {
    border-color: rgba(94, 234, 212, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), 0 0 16px rgba(45, 212, 191, 0.2);
}

/* Attached Item Card Inside Bubble - Fits Frame Perfectly (ไม่ชิดขอบ พอดีข้อความ ไม่บีบ เว้นระยะสวยงาม) */
.lounge-item-card {
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.25);
    border: none !important;
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* Item Icon Showcase - Large, Sharp & Borderless */
.lounge-item-icon-box {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none !important;
    box-shadow: none !important;
}

.lounge-item-icon-box img {
    max-width: 52px;
    max-height: 52px;
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45));
}

.lounge-item-info {
    flex: 1 1 auto;
    min-width: 140px;
}

.lounge-item-tag {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 2px;
    border: none !important;
    white-space: nowrap !important;
}
.action-wtb .lounge-item-tag { background: rgba(249, 168, 37, 0.25); color: #fbbf24; }
.action-wts .lounge-item-tag { background: rgba(34, 197, 94, 0.25); color: #4ade80; }
.action-wtt .lounge-item-tag { background: rgba(6, 182, 212, 0.25); color: #38bdf8; }

.lounge-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.lounge-item-note {
    font-size: 0.78rem;
    color: #cbd5e1;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lounge-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    margin-left: auto;
}

.lounge-item-actions .btn {
    border: none !important;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-radius: 8px;
    padding: 6px 10px;
    transition: all 0.2s ease;
}

.btn-chat-contact {
    background: #f9a825 !important;
    color: #0b0f19 !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
    transition: all 0.15s ease !important;
    border: none !important;
    white-space: nowrap !important;
}
.btn-chat-contact:hover {
    background: #ffb300 !important;
    color: #000000 !important;
    transform: translateY(-1px);
}

.btn-item-info {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none !important;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.btn-item-info:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}

/* Attached Item Card Inside Outgoing Bubble (Mine) - Borderless & Cohesive */
.lounge-msg-row.mine .lounge-item-card {
    background: rgba(0, 0, 0, 0.2);
    border: none !important;
    color: #ffffff;
}

.lounge-msg-row.mine .lounge-item-name {
    color: #ffffff !important;
}

.lounge-msg-row.mine .lounge-item-note {
    color: #99f6e4 !important;
}

.lounge-msg-row.mine .lounge-item-actions .btn {
    border: none !important;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff !important;
}

.lounge-msg-row.mine .lounge-item-actions .btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Attached Party Card Inside Incoming */
.lounge-party-card {
    margin-top: 8px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(15, 23, 42, 0.7) 100%);
    border: none;
    border-left: 4px solid #ef4444;
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

/* Attached Party Card Inside Outgoing (Mine) */
.lounge-msg-row.mine .lounge-party-card {
    background: rgba(0, 0, 0, 0.2);
    border: none;
    border-left: 4px solid #ef4444;
    color: #ffffff;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
}

.lounge-msg-row.mine .lounge-party-card .text-white {
    color: #ffffff !important;
}

.lounge-msg-row.mine .lounge-party-card .text-warning {
    color: #fde047 !important;
    font-weight: 700;
}

/* ========================================================
   BOTTOM INPUT PANEL (PILL STYLE LIKE REFERENCE SCREENSHOT)
   ======================================================== */
.lounge-input-panel {
    background: var(--lounge-header-bg);
    border-top: 1px solid var(--lounge-border);
    padding: 12px 18px;
    position: relative;
}

.lounge-attached-preview {
    display: none;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed var(--lounge-gold);
    border-radius: 8px;
    padding: 6px 12px;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #f9a825;
}

.lounge-attached-preview.show {
    display: flex;
}

/* ========================================================
   EMOJI PICKER POPUP (STANDARD NATIVE EMOJIS)
   ======================================================== */
.lounge-emoji-picker {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 18px;
    width: 360px;
    max-width: calc(100vw - 36px);
    background: rgba(16, 21, 33, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: loungeEmojiFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.lounge-emoji-picker.d-none {
    display: none !important;
}

@keyframes loungeEmojiFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.lounge-emoji-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lounge-emoji-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    flex: 1 1 auto;
    padding-right: 8px;
}

.lounge-emoji-tabs::-webkit-scrollbar {
    display: none;
}

.lounge-emoji-tab {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.lounge-emoji-tab:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.06);
}

.lounge-emoji-tab.active {
    color: #f9a825;
    background: rgba(249, 168, 37, 0.15);
    font-weight: 700;
}

.lounge-emoji-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lounge-emoji-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.lounge-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 10px;
    max-height: 230px;
    overflow-y: auto;
}

.lounge-emoji-grid::-webkit-scrollbar {
    width: 5px;
}

.lounge-emoji-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.lounge-emoji-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.45rem;
    line-height: 1;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease;
    font-family: var(--font-emoji), "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji", emoji, sans-serif;
    user-select: none;
}

.lounge-emoji-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.22);
}

.lounge-emoji-item:active {
    transform: scale(0.95);
}

.lounge-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.lounge-text-field {
    flex: 1 1 auto;
    background: #1c2232;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    color: #f8fafc;
    padding: 10px 18px;
    font-size: 0.93rem;
    outline: none;
    transition: all 0.2s ease;
    font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
}

.lounge-text-field::placeholder {
    color: #828c9e;
}

.lounge-text-field:focus {
    background: #21283a;
    border-color: var(--lounge-accent-teal);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
}

.lounge-action-btn {
    background: #1c2232;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border-radius: 22px;
    padding: 8px 14px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.lounge-action-btn:hover {
    background: #252d42;
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.2);
}

#loungeEmojiToggleBtn.active {
    color: #f9a825 !important;
    border-color: rgba(249, 168, 37, 0.45) !important;
    background: rgba(249, 168, 37, 0.15) !important;
    box-shadow: 0 0 12px rgba(249, 168, 37, 0.25);
}

.lounge-send-btn {
    background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
    color: #ffffff;
    border: none;
    border-radius: 26px;
    padding: 9px 20px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.35);
}

.lounge-send-btn:hover {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(16, 185, 129, 0.45);
}

.lounge-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========================================================
   RIGHT SIDEBAR: ACTIVE MEMBERS LIST
   ======================================================== */
.lounge-sidebar-right {
    width: 250px;
    min-width: 250px;
    max-width: 250px;
    background: #101420;
    border-left: 1px solid var(--lounge-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lounge-members-box {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 14px 16px;
}

.lounge-sidebar-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lounge-online-count-badge {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(74, 222, 128, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
    white-space: nowrap;
    letter-spacing: 0.3px;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.12);
}

.lounge-members-list {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.lounge-members-list::-webkit-scrollbar {
    width: 4px;
}
.lounge-members-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.lounge-member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background 0.15s ease;
    color: #e5e7eb;
}

.lounge-member-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lounge-member-avatar-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lounge-member-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50% !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: block;
}

/* Fallback Safeguard: Any avatar image must strictly be a circle */
.lounge-member-avatar-wrap img,
.lounge-msg-avatar img,
img.merchant-glow-ring {
    border-radius: 50% !important;
    overflow: hidden !important;
}

.lounge-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #101420;
}

.lounge-online-dot.online {
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.lounge-online-dot.offline {
    background-color: #6b7280;
}

.lounge-member-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.lounge-member-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f3f4f6;
}

.lounge-member-sub {
    font-size: 0.68rem;
    color: #828c9e;
}

.lounge-member-dm-btn {
    color: #9ca3af;
    opacity: 0.4;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    text-decoration: none;
}

.lounge-member-row:hover .lounge-member-dm-btn {
    opacity: 1;
    color: var(--lounge-gold);
}

/* Modals - Ultra-Smooth 60 FPS GPU-Accelerated */
.lounge-modal-bg {
    background: rgba(4, 6, 12, 0.8) !important;
}

.modal.fade .modal-dialog {
    transform: translateY(-16px) scale(0.98);
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s linear;
    will-change: transform, opacity;
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

.lounge-modal-content {
    background: #131722;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
    color: #e5e7eb;
    contain: content;
}

.lounge-item-select-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    user-select: none;
    contain: layout style;
}

.lounge-item-select-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.lounge-item-select-card.selected,
.lounge-item-select-card.active {
    background: rgba(249, 168, 37, 0.14) !important;
    border-color: #f9a825 !important;
    box-shadow: 0 0 14px rgba(249, 168, 37, 0.28);
}

/* Mobile Sidebar & Responsive Breakpoints */
@media (max-width: 991.98px) {
    .lounge-sidebar-right {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 270px;
        max-width: 85%;
        z-index: 100;
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.85);
        transform: translateX(100%);
    }

    .lounge-sidebar-right.show {
        transform: translateX(0);
    }

    .lounge-msg-content {
        max-width: 86%;
    }
}

@media (max-width: 768px) {
    .lounge-card-main {
        height: calc(100vh - 85px);
        min-height: 460px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .lounge-wrapper {
        padding-top: 66px;
        padding-bottom: 0;
    }
    .lounge-header {
        padding: 8px 10px;
    }
    .lounge-channel-nav {
        width: 100%;
        overflow-x: auto;
    }
    .lounge-tab-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 5px 8px;
        font-size: 0.72rem;
    }
    .lounge-chat-area {
        padding: 12px 10px;
        gap: 12px;
    }
    .lounge-msg-content {
        max-width: 90%;
    }
    .lounge-action-btn span {
        display: none;
    }
    .lounge-action-btn {
        padding: 8px 10px;
    }
    .lounge-input-panel {
        padding: 8px 10px;
    }
    .lounge-send-btn span {
        display: none;
    }
    .lounge-send-btn {
        padding: 9px 14px;
    }
}

@media (max-width: 480px) {
    .lounge-msg-content {
        max-width: 95%;
    }
    .lounge-msg-body.has-item-card,
    .lounge-msg-body.has-party-card {
        min-width: 0;
        width: 100%;
    }
    .lounge-item-card {
        padding: 8px 12px;
        gap: 10px;
    }
    .lounge-item-info {
        min-width: 0;
    }
    .lounge-item-icon-box {
        width: 50px;
        height: 50px;
    }
    .lounge-item-icon-box img {
        width: 42px;
        height: 42px;
    }
    .lounge-party-card {
        padding: 8px 12px;
    }
    .lounge-emoji-picker {
        left: 8px;
        right: 8px;
        width: auto;
        max-width: calc(100% - 16px);
        bottom: calc(100% + 8px);
    }
    .lounge-emoji-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 2px;
        max-height: 200px;
    }
    .lounge-emoji-item {
        width: 36px;
        height: 36px;
        font-size: 1.35rem;
    }
    .lounge-msg-image-preview {
        max-width: 100%;
    }
    .lounge-msg-image-preview img {
        max-width: 100%;
        max-height: 200px;
    }
}
