/* BCMonster Community Chat Widget Styles */

#bcm-chat-widget {
    position: fixed !important;
    bottom: 20px;
    right: 20px;
    width: 480px;
    max-width: calc(100vw - 40px);
    background: var(--bg-card, #1e293b);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border, #334155);
    z-index: 9999 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    transition: box-shadow 0.2s ease;
}

#bcm-chat-widget.bcm-dragging {
    box-shadow: 0 12px 48px rgba(37, 99, 235, 0.5);
    cursor: grabbing !important;
}

#bcm-chat-widget.bcm-chat-minimized {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
}

#bcm-chat-widget.bcm-chat-open {
    height: 500px;
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
}

.bcm-chat-header {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
    cursor: grab;
    user-select: none;
}

#bcm-chat-widget.bcm-chat-minimized .bcm-chat-header {
    padding: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#bcm-chat-widget.bcm-dragging .bcm-chat-header {
    cursor: grabbing;
}

#bcm-chat-widget.bcm-chat-minimized .bcm-chat-title span,
#bcm-chat-widget.bcm-chat-minimized .bcm-chat-controls,
#bcm-chat-widget.bcm-chat-minimized .bcm-drag-handle {
    display: none;
}

#bcm-chat-widget.bcm-chat-minimized .bcm-chat-title {
    gap: 0;
}

#bcm-chat-widget.bcm-chat-minimized .bcm-chat-title i.fa-comments {
    font-size: 1.8rem;
}

.bcm-drag-handle {
    opacity: 0.6;
    margin-right: 4px;
    cursor: grab;
}

.bcm-chat-header:active .bcm-drag-handle {
    cursor: grabbing;
}

.bcm-chat-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.bcm-chat-title i {
    font-size: 1.1rem;
}

.bcm-chat-badge {
    display: none;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

#bcm-chat-widget.bcm-chat-minimized .bcm-chat-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 3px 6px;
    font-size: 0.65rem;
}

.bcm-chat-controls {
    display: flex;
    gap: 4px;
}

.bcm-chat-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.bcm-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main area: chat + sidebar side by side */
.bcm-main-area {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.bcm-chat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.bcm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-primary, #0a0e1a);
}

/* Login Panel */
.bcm-login-panel {
    padding: 1rem;
    background: var(--bg-card, #1e293b);
    border-bottom: 1px solid var(--border, #334155);
}

.bcm-login-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-primary, #0a0e1a);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
}

.bcm-login-input:focus {
    outline: none;
    border-color: #60a5fa;
}

.bcm-login-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.bcm-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.bcm-anonymous-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-hover, #334155);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text-secondary, #cbd5e1);
    cursor: pointer;
    transition: all 0.2s;
}

.bcm-anonymous-btn:hover {
    background: var(--bg-primary, #0a0e1a);
    border-color: #60a5fa;
    color: var(--text-primary, #f8fafc);
}

/* User Info Bar */
.bcm-user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-bottom: 1px solid var(--border, #334155);
    font-size: 0.85rem;
    color: var(--text-primary, #f8fafc);
}

.bcm-logout-btn {
    padding: 0.25rem 0.75rem;
    background: var(--bg-hover, #334155);
    border: 1px solid var(--border, #334155);
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--text-secondary, #cbd5e1);
    transition: all 0.2s;
}

.bcm-logout-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.bcm-load-more {
    width: calc(100% - 24px);
    margin: 0 auto 12px;
    padding: 8px 16px;
    background: var(--bg-hover, #334155);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.bcm-load-more:hover {
    background: var(--accent, #60a5fa);
    border-color: var(--accent, #60a5fa);
    color: white;
}

.bcm-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.bcm-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.bcm-chat-messages::-webkit-scrollbar-thumb {
    background: var(--border, #334155);
    border-radius: 3px;
}

.bcm-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent, #60a5fa);
}

.bcm-chat-msg {
    animation: bcm-chat-msg-appear 0.2s ease;
}

@keyframes bcm-chat-msg-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bcm-chat-msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.bcm-chat-msg-user {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent, #60a5fa);
}

.bcm-chat-msg-time {
    font-size: 0.7rem;
    color: var(--text-muted, #94a3b8);
}

.bcm-chat-msg-text {
    font-size: 0.9rem;
    color: var(--text-primary, #f8fafc);
    word-wrap: break-word;
    line-height: 1.4;
}

.bcm-chat-input-wrapper {
    padding: 12px;
    background: var(--bg-card, #1e293b);
    border-top: 1px solid var(--border, #334155);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#bcm-chat-username {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-primary, #0a0e1a);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

#bcm-chat-username:focus {
    border-color: var(--accent, #60a5fa);
}

#bcm-chat-username::placeholder {
    color: var(--text-muted, #94a3b8);
}

.bcm-chat-input-row {
    display: flex;
    gap: 8px;
}

#bcm-chat-message {
    flex: 1;
    padding: 10px 12px;
    background: var(--bg-primary, #0a0e1a);
    border: 1px solid var(--border, #334155);
    border-radius: 6px;
    color: var(--text-primary, #f8fafc);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#bcm-chat-message:focus {
    border-color: var(--accent, #60a5fa);
}

#bcm-chat-message::placeholder {
    color: var(--text-muted, #94a3b8);
}

.bcm-chat-send {
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bcm-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

.bcm-chat-send i {
    font-size: 1rem;
}

/* Mobile responsive */
@media (max-width: 480px) {
    #bcm-chat-widget {
        right: 10px;
        bottom: 10px;
        width: calc(100vw - 20px);
    }
    
    #bcm-chat-widget.bcm-chat-open {
        height: calc(100vh - 80px);
        max-height: none;
    }
}

/* Light theme support */
[data-theme="light"] #bcm-chat-widget {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .bcm-chat-messages {
    background: #f8fafc;
}

[data-theme="light"] .bcm-chat-msg-text {
    color: #1e293b;
}

[data-theme="light"] #bcm-chat-username,
[data-theme="light"] #bcm-chat-message {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

[data-theme="light"] #bcm-chat-username::placeholder,
[data-theme="light"] #bcm-chat-message::placeholder {
    color: #64748b;
}

[data-theme="light"] .bcm-chat-input-wrapper {
    background: #ffffff;
    border-color: #e2e8f0;
}

/* Login Panel Light Theme */
[data-theme="light"] .bcm-login-panel {
    background: #ffffff;
    border-color: #e2e8f0;
}

[data-theme="light"] .bcm-login-input {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #1e293b;
}

[data-theme="light"] .bcm-login-input::placeholder {
    color: #64748b;
}

[data-theme="light"] .bcm-login-input:focus {
    border-color: #3b82f6;
}

[data-theme="light"] .bcm-anonymous-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

[data-theme="light"] .bcm-anonymous-btn:hover {
    background: #e2e8f0;
    border-color: #3b82f6;
    color: #1e293b;
}

[data-theme="light"] .bcm-user-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: #e2e8f0;
    color: #1e293b;
}

[data-theme="light"] .bcm-logout-btn {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

[data-theme="light"] .bcm-load-more {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

/* Moderator Badge */
.bcm-mod-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ban Button */
.bcm-ban-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 2px 4px;
}

.bcm-ban-btn:hover {
    opacity: 1;
}

/* Moderator Controls */
.bcm-mod-controls {
    padding: 8px 12px;
    background: rgba(139, 92, 246, 0.1);
    border-top: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    gap: 8px;
    justify-content: center;
}

.bcm-mod-btn {
    padding: 6px 12px;
    border: 1px solid rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary, #f8fafc);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.bcm-mod-btn:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.7);
}

.bcm-clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.7);
}

[data-theme="light"] .bcm-mod-controls {
    background: rgba(139, 92, 246, 0.05);
}

[data-theme="light"] .bcm-mod-btn {
    color: #1e293b;
    background: rgba(139, 92, 246, 0.1);
}

[data-theme="light"] .bcm-mod-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Resize Handle */
.bcm-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: se-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s ease;
    z-index: 10;
    color: var(--text-muted, #94a3b8);
}

.bcm-resize-handle:hover {
    opacity: 1;
}

.bcm-resize-handle i {
    font-size: 0.75rem;
    transform: rotate(90deg);
}

#bcm-chat-widget.bcm-chat-minimized .bcm-resize-handle {
    display: none;
}

#bcm-chat-widget.bcm-resizing {
    user-select: none;
    pointer-events: all;
}

#bcm-chat-widget.bcm-resizing * {
    user-select: none;
}


/* ── IRC-style users sidebar ─────────────────────────────── */
.bcm-users-sidebar {
    width: 150px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border, #334155);
    background: var(--bg-secondary, #0d1526);
    overflow: hidden;
}

.bcm-users-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border, #334155);
    flex-shrink: 0;
    background: var(--bg-card, #1e293b);
}

.bcm-online-dot {
    color: #10b981;
    font-size: 0.45rem;
    animation: bcm-pulse 2s infinite;
}

@keyframes bcm-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.bcm-users-list {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding: 4px 0;
}

.bcm-users-list::-webkit-scrollbar { width: 3px; }
.bcm-users-list::-webkit-scrollbar-track { background: transparent; }
.bcm-users-list::-webkit-scrollbar-thumb { background: var(--border, #334155); border-radius: 2px; }

.bcm-user-entry {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    font-size: 0.75rem;
    color: var(--text-secondary, #cbd5e1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
    cursor: default;
    line-height: 1.4;
}

.bcm-user-entry:hover {
    background: rgba(255,255,255,0.05);
}

.bcm-user-entry span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bcm-user-icon {
    font-size: 0.6rem;
    flex-shrink: 0;
}

.bcm-user-icon.reg  { color: #10b981; }
.bcm-user-icon.anon { color: #475569; }

.bcm-user-anon span { color: #64748b; }

.bcm-users-empty {
    padding: 10px 7px;
    font-size: 0.72rem;
    color: var(--text-muted, #64748b);
    font-style: italic;
    text-align: center;
    line-height: 1.4;
}

[data-theme="light"] .bcm-users-sidebar {
    background: #f1f5f9;
    border-left-color: #e2e8f0;
}
[data-theme="light"] .bcm-users-header {
    background: #e2e8f0;
}
[data-theme="light"] .bcm-user-entry {
    color: #334155;
}
[data-theme="light"] .bcm-user-anon span { color: #94a3b8; }

/* Mod styling in users sidebar */
.bcm-user-icon.mod { color: #f59e0b; }

.bcm-user-mod span { color: #f59e0b; font-weight: 600; }

/* Sidebar MOD pill - distinct from chat message badge */
.bcm-users-sidebar .bcm-mod-badge {
    font-size: 0.55rem;
    font-weight: 700;
    color: #fff;
    background: #b45309;
    border-radius: 3px;
    padding: 1px 4px;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1.4;
}

[data-theme="light"] .bcm-user-icon.mod { color: #b45309; }
[data-theme="light"] .bcm-user-mod span  { color: #b45309; }
[data-theme="light"] .bcm-users-sidebar .bcm-mod-badge {
    background: #b45309;
    color: #fff;
}
