/* ===== CHAT BOX - Dark Modern Design ===== */
.chatbox {
    position: absolute;
    width: 280px;
    height: 360px;
    background: linear-gradient(135deg, rgba(6, 6, 10, 0.97) 0%, rgba(3, 3, 8, 0.98) 100%);
    bottom: 15px;
    left: 15px;
    border-radius: 10px;
    pointer-events: all;
    border: 1px solid rgba(132, 94, 247, 0.15);
    backdrop-filter: blur(20px) saturate(150%);
    display: none;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom left;
    z-index: 100;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(132, 94, 247, 0.12);
    overflow: hidden;
}

.chatbox.visible {
    display: flex;
    animation: slideInChat 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInChat {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Collapsed Chat */
.chatbox.collapsed {
    height: 48px;
    width: 120px;
    padding: 12px 24px;
    /* Use the same subtle leaderboard accent gradient */
    background: linear-gradient(90deg, rgba(132, 94, 247, 0.12) 0%, rgba(20, 255, 220, 0.06) 100%);
    border: 1px solid rgba(132, 94, 247, 0.15);
    border-radius: 10px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(132, 94, 247, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.8);
    display: flex !important;
    backdrop-filter: blur(20px) saturate(150%);
    position: absolute;
    bottom: 15px;
    left: 15px;
    overflow: hidden;
}

.chatbox.collapsed:hover {
    border-color: rgba(132, 94, 247, 0.5);
    /* Hover uses same leaderboard hover accent */
    background: linear-gradient(90deg, rgba(132, 94, 247, 0.18) 0%, rgba(20, 255, 220, 0.1) 100%);
    box-shadow: 
        0 6px 20px rgba(132, 94, 247, 0.4),
        0 0 0 1px rgba(132, 94, 247, 0.4);
    transform: translateY(-2px);
}

.chatbox.collapsed .chat-list,
.chatbox.collapsed .chat-input-container {
    display: none;
}

.chatbox.collapsed .chat-header {
    border-radius: 10px;
    padding: 0;
    justify-content: center;
    align-items: center;
    background: transparent;
    border: none;
    width: 100%;
    height: 100%;
    border-bottom: none;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chatbox.collapsed .chat-header-content {
    justify-content: center;
}

.chatbox.collapsed .chat-collapse-btn,
.chatbox.collapsed .chat-icon {
    display: none;
}

.chatbox.collapsed .chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(132, 94, 247, 0.3), transparent);
    transition: left 0.4s;
    display: block;
}

.chatbox.collapsed:hover .chat-header::before {
    left: 100%;
}

/* Chat Header */
.chat-header {
    padding: 12px 14px;
    background: linear-gradient(90deg, rgba(132, 94, 247, 0.12) 0%, rgba(20, 255, 220, 0.06) 100%);
    border-bottom: 1px solid rgba(132, 94, 247, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: all;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(132, 94, 247, 0.15), transparent);
    transition: left 0.4s;
}

.chat-header:hover::before {
    left: 100%;
}

.chat-header:hover {
    background: linear-gradient(90deg, rgba(132, 94, 247, 0.18) 0%, rgba(20, 255, 220, 0.1) 100%);
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1;
}

.chat-icon {
    font-size: 16px;
    filter: drop-shadow(0 0 6px rgba(132, 94, 247, 0.5));
}

.chat-collapse-btn {
    background: rgba(132, 94, 247, 0.15);
    border: 1px solid rgba(132, 94, 247, 0.3);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
    z-index: 1;
}

.chat-collapse-btn:hover {
    background: rgba(132, 94, 247, 0.3);
    border-color: rgba(132, 94, 247, 0.5);
    transform: scale(1.05);
}

/* Chat Messages */
.chatbox .chat-list {
    padding: 10px;
    margin: 0;
    list-style: none;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(132, 94, 247, 0.4) rgba(255, 255, 255, 0.03);
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.15);
}

.chatbox .chat-list::-webkit-scrollbar {
    width: 5px;
}

.chatbox .chat-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.chatbox .chat-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #845ef7 0%, #14ffdc 100%);
    border-radius: 10px;
}

.chatbox .chat-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #9775fa 0%, #20ffd5 100%);
}

.chatbox .chat-list li {
    padding: 8px 10px;
    color: #e8e8e8;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    word-break: break-word;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.02);
    line-height: 1.4;
}

.chatbox .chat-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

.chatbox .chat-list li.me {
    background: linear-gradient(135deg, rgba(132, 94, 247, 0.15) 0%, rgba(132, 94, 247, 0.05) 100%);
    margin-left: 20px;
    border-radius: 8px 8px 2px 8px;
    border: 1px solid rgba(132, 94, 247, 0.2);
}

.chatbox .chat-list li.me:hover {
    background: linear-gradient(135deg, rgba(132, 94, 247, 0.2) 0%, rgba(132, 94, 247, 0.08) 100%);
    border-color: rgba(132, 94, 247, 0.3);
}

.chatbox .chat-list li.me b {
    color: #b197fc;
    font-weight: 600;
}

.chatbox .chat-list li.me b::before {
    content: "● ";
    color: #845ef7;
    font-size: 8px;
    animation: pulseGlow 2s infinite;
}

.chatbox .chat-list li.friend {
    background: linear-gradient(135deg, rgba(20, 255, 220, 0.1) 0%, rgba(20, 255, 220, 0.03) 100%);
    margin-right: 20px;
    border-radius: 8px 8px 8px 2px;
    border: 1px solid rgba(20, 255, 220, 0.15);
}

.chatbox .chat-list li.friend:hover {
    background: linear-gradient(135deg, rgba(20, 255, 220, 0.15) 0%, rgba(20, 255, 220, 0.05) 100%);
    border-color: rgba(20, 255, 220, 0.25);
}

.chatbox .chat-list li.friend b {
    color: #14ffdc;
    font-weight: 600;
}

.chatbox .chat-list li.friend b::before {
    content: "● ";
    color: #14ffdc;
    font-size: 8px;
    animation: pulseGlow 2s infinite;
}

.chatbox .chat-list li.system {
    color: #b197fc;
    background: linear-gradient(90deg, rgba(132, 94, 247, 0.08) 0%, rgba(20, 255, 220, 0.05) 100%);
    text-align: center;
    font-size: 11px;
    padding: 6px 10px;
    margin: 6px 0;
    border-radius: 12px;
    border: 1px solid rgba(132, 94, 247, 0.15);
    font-weight: 500;
}

.chatbox .chat-list li.system:before {
    content: "› ";
    opacity: 0.6;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, rgba(6, 6, 10, 0.9) 0%, rgba(3, 3, 8, 0.95) 100%);
    border-top: 1px solid rgba(132, 94, 247, 0.2);
    padding: 10px;
    pointer-events: all;
    gap: 8px;
    position: relative;
}

.chat-input-container::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(132, 94, 247, 0.4), transparent);
}

.chatbox .chat-input {
    pointer-events: all;
    box-sizing: border-box;
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(132, 94, 247, 0.2);
    color: #ffffff;
    outline: none;
    font-size: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chatbox .chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chatbox .chat-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: #845ef7;
    box-shadow: 0 0 0 2px rgba(132, 94, 247, 0.15);
}

.chatbox .chat-input:hover {
    border-color: rgba(132, 94, 247, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.chat-send {
    /* Slightly brighter to match the chat input field */
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(132,94,247,0.2);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ffffff;
    transition: all 0.16s ease;
    font-size: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
}
    .chat-send {
        /* A bit brighter per request: slightly stronger subtle fill */
        background: rgba(255,255,255,0.06);
        border: 1px solid rgba(132,94,247,0.22);
        border-radius: 8px;
        width: 36px;
        height: 36px;
        min-width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #ffffff;
        transition: all 0.14s ease;
        font-size: 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
        position: relative;
        overflow: hidden;

.chat-send::before {
    content: '';
    position: absolute;
    inset: 0;
    /* remove the bright cyan highlight; keep subtle sheen only */
    background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, rgba(0,0,0,0) 100%);
    opacity: 0;
    transition: opacity 0.18s;
}

.chat-send:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
    background: rgba(255,255,255,0.04);
    border-color: rgba(132,94,247,0.3);
}
    .chat-send:hover {
        transform: scale(1.02);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
        background: rgba(255,255,255,0.09);
        border-color: rgba(132,94,247,0.32);
    }
    .chat-send:hover::before {
        opacity: 0.06;

.chat-send:hover::before {
    opacity: 0.04;
}

.chat-send:active {
    transform: scale(0.98);
}

.chat-send svg,
.chat-send span {
    position: relative;
    z-index: 1;
}

/* Animations */
@keyframes pulseGlow {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.5;
        transform: scale(0.85);
    }
}

/* Mobile Responsiveness */
@media only screen and (max-width: 1224px) {
    .chatbox {
        display: none !important;
    }
}
