/* ========================================================
   NEO 3  - SIDEBAR CHAT MODULE
   ======================================================== */

:root {
    --chat-bg: #0a0d16;
    --chat-card-bg: rgba(18, 23, 40, 0.75);
    --chat-card-hover: rgba(26, 33, 56, 0.9);
    --chat-border: rgba(255, 255, 255, 0.08);
    --chat-accent: #6366f1;
    --chat-accent-hover: #4f46e5;
    --chat-accent-glow: rgba(99, 102, 241, 0.35);
    --chat-text: #ffffff;
    --chat-text-muted: #8fa0ba;
    --chat-mention-bg: rgba(99, 102, 241, 0.2);
    --chat-mention-border: rgba(99, 102, 241, 0.45);
    --chat-mention-glow: rgba(99, 102, 241, 0.2);
    --chat-danger: #ef4444;
    --chat-danger-hover: #dc2626;
    --chat-success: #10b981;
}

/* ========================================================
   GLOBAL CHAT SVG ICON STYLING & ISOLATION
   Overrides theme & global styles (e.g. style.css svg { fill: ... })
   ======================================================== */
.chat-trigger-btn svg,
.chat-drawer svg,
.chat-modal-window svg {
    box-sizing: border-box !important;
    vertical-align: middle !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}

/* OUTLINE SVG ICONS (bubble, cogs, cross, mic, send, emojis, mod icons) */
.chat-trigger-icon svg,
.chat-trigger-icon svg *,
.chat-header-btn svg,
.chat-header-btn svg *,
.chat-block-icon svg,
.chat-block-icon svg *,
.chat-btn-rec-cancel svg,
.chat-btn-rec-cancel svg *,
.chat-preview-btn-discard svg,
.chat-preview-btn-discard svg *,
.chat-preview-btn-send svg,
.chat-preview-btn-send svg *,
.chat-btn-action-outline svg,
.chat-btn-action-outline svg *,
.chat-btn-action-danger svg,
.chat-btn-action-danger svg *,
.chat-input-btn svg,
.chat-input-btn svg *,
.chat-mod-btn svg,
.chat-mod-btn svg *,
.chat-modal-close svg,
.chat-modal-close svg * {
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

/* FILLED SVG ICONS (voice play polygon, voice pause rects, stop square, Steam logo) */
.chat-voice-play-btn svg,
.chat-voice-play-btn svg polygon,
.chat-voice-play-btn svg rect,
.chat-voice-play-btn svg *,
.chat-prev-icon-play,
.chat-prev-icon-play *,
.chat-prev-icon-pause,
.chat-prev-icon-pause *,
.chat-btn-rec-stop svg,
.chat-btn-rec-stop svg *,
.chat-login-btn svg,
.chat-login-btn svg path,
.chat-login-btn svg * {
    fill: currentColor !important;
    stroke: none !important;
}

/* SPRITE BADGE ICONS */
.chat-badge-icon,
.chat-badge-icon * {
    fill: currentColor !important;
}

/* DYNAMIC ACTION BUTTON ICON DISPLAY */
.chat-action-btn .chat-icon-mic,
.chat-action-btn .chat-icon-send {
    display: none !important;
}

.chat-action-btn[data-mode="mic"] .chat-icon-mic {
    display: inline-block !important;
}

.chat-action-btn[data-mode="send"] .chat-icon-send {
    display: inline-block !important;
}

/* ICON SIZES */
.chat-trigger-icon svg {
    width: 22px !important;
    height: 22px !important;
}
.chat-header-btn svg {
    width: 18px !important;
    height: 18px !important;
}
.chat-block-icon svg {
    width: 22px !important;
    height: 22px !important;
    color: var(--chat-danger) !important;
}
.chat-btn-rec-cancel svg,
.chat-btn-rec-stop svg {
    width: 16px !important;
    height: 16px !important;
}
.chat-preview-btn-discard svg,
.chat-preview-btn-send svg {
    width: 15px !important;
    height: 15px !important;
}
.chat-btn-action-outline svg,
.chat-btn-action-danger svg {
    width: 16px !important;
    height: 16px !important;
}
.chat-input-btn svg {
    width: 20px !important;
    height: 20px !important;
}
.chat-voice-play-btn svg {
    width: 14px !important;
    height: 14px !important;
}
.chat-login-btn svg {
    width: 18px !important;
    height: 18px !important;
    margin-right: 6px !important;
}
.chat-mod-btn svg {
    width: 14px !important;
    height: 14px !important;
}

/* 1. FLOATING SIDEBAR CHAT TRIGGER BUTTON */
.chat-trigger-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 10px;
    background: linear-gradient(135deg, rgba(26, 24, 42, 0.95), rgba(39, 36, 62, 0.95));
    border: 1px solid var(--chat-border);
    border-right: none;
    border-radius: 16px 0 0 16px;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.45), 0 0 16px var(--chat-accent-glow);
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.chat-trigger-btn:hover {
    padding-left: 14px;
    background: linear-gradient(135deg, rgba(38, 35, 60, 0.98), rgba(55, 50, 88, 0.98));
    border-color: rgba(61, 95, 217, 0.5);
    box-shadow: -8px 0 32px rgba(61, 95, 217, 0.4);
}

.chat-trigger-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    color: #fff;
    transition: transform 0.2s ease;
}

.chat-trigger-btn:hover .chat-trigger-icon {
    transform: scale(1.1);
}

.chat-trigger-icon svg {
    width: 22px;
    height: 22px;
}

.chat-trigger-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--chat-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(61, 95, 217, 0.8);
    animation: chatPulse 2s infinite;
}

.chat-trigger-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: inherit;
}

@keyframes chatPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(61, 95, 217, 0.7); }
    70% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(61, 95, 217, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(61, 95, 217, 0); }
}

/* 2. CHAT BACKDROP */
.chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 7, 14, 0.55);
    backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* 3. CHAT DRAWER */
.chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 410px;
    max-width: 95vw;
    background: var(--chat-bg);
    border-left: 1px solid var(--chat-border);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
    color: var(--chat-text);
}

.chat-drawer.chat-open {
    transform: translateX(0);
}

/* 4. DRAWER HEADER */
.chat-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--chat-border);
    background: rgba(22, 20, 36, 0.7);
    backdrop-filter: blur(10px);
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--chat-success);
    box-shadow: 0 0 8px var(--chat-success);
    animation: chatLiveDot 2s infinite ease-in-out;
}

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

.chat-header-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    color: var(--chat-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-header-btn svg {
    width: 18px;
    height: 18px;
}

.chat-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

/* 5. MESSAGES CONTAINER */
.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

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

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

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

/* Loading state */
.chat-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
}

.chat-spinner-circle {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--chat-accent);
    border-radius: 50%;
    animation: chatSpin 0.7s linear infinite;
}

@keyframes chatSpin {
    to { transform: rotate(360deg); }
}

.chat-empty-notice {
    text-align: center;
    color: var(--chat-text-muted);
    font-size: 13px;
    padding: 40px 16px;
}

/* 6. INDIVIDUAL MESSAGE CARD */
.chat-msg-item {
    display: flex;
    gap: 11px;
    padding: 10px 12px;
    background: var(--chat-card-bg);
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    transition: all 0.2s ease;
    position: relative;
    word-break: break-word;
}

.chat-msg-item:hover {
    background: var(--chat-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.chat-msg-item.chat-msg-mine {
    background: rgba(38, 34, 62, 0.7);
    border-color: rgba(99, 102, 241, 0.25);
}

.chat-msg-item.chat-msg-mentioned {
    background: var(--chat-mention-glow);
    border-color: var(--chat-mention-border);
    box-shadow: 0 0 12px rgba(61, 95, 217, 0.2);
}

a.chat-msg-avatar-wrap,
.chat-msg-avatar-wrap {
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.chat-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: cover;
    background: #1e1d2c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s ease;
    display: block;
}

.chat-msg-avatar:hover {
    transform: scale(1.08);
}

.chat-msg-body {
    flex: 1;
    min-width: 0;
}

.chat-msg-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.chat-msg-name {
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: color 0.15s ease;
}

.chat-msg-name:hover {
    color: var(--chat-accent-hover);
    text-decoration: underline;
}

.chat-msg-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 2px 7px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    line-height: 1.2 !important;
    vertical-align: middle !important;
}

.chat-badge-icon {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.chat-msg-time {
    font-size: 11px;
    color: var(--chat-text-muted);
    margin-left: auto;
    flex-shrink: 0;
}

.chat-msg-content {
    font-size: 13.5px;
    line-height: 1.45;
    color: #e5e5f0;
}

.chat-mention-tag {
    display: inline-block;
    padding: 1px 6px;
    background: var(--chat-mention-bg);
    border: 1px solid var(--chat-mention-border);
    color: #818cf8;
    border-radius: 5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.chat-mention-tag:hover {
    background: rgba(61, 95, 217, 0.35);
    color: #a5b4fc;
}

.chat-msg-deleted {
    font-style: italic;
    color: #71717a;
    font-size: 12.5px;
}

/* Moderation actions on message hover */
.chat-msg-mod-actions {
    position: absolute;
    top: 6px;
    right: 8px;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
}

.chat-msg-item:hover .chat-msg-mod-actions {
    display: flex;
}

.chat-mod-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-mod-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.chat-mod-btn.mod-delete:hover {
    color: var(--chat-danger);
    background: rgba(239, 68, 68, 0.15);
}

.chat-mod-btn.mod-block:hover {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.chat-mod-btn svg {
    width: 14px;
    height: 14px;
}

/* 7. VOICE MESSAGE PLAYER */
.chat-voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(18, 17, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    margin-top: 4px;
    width: fit-content;
    min-width: 200px;
    max-width: 100%;
}

.chat-voice-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--chat-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.chat-voice-play-btn:hover {
    background: var(--chat-accent-hover);
    transform: scale(1.05);
}

.chat-voice-play-btn svg {
    width: 14px;
    height: 14px;
}

.chat-voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    flex: 1;
    cursor: pointer;
    padding: 0 4px;
}

.chat-voice-bar {
    width: 3px;
    height: 100%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    transition: height 0.15s ease, background 0.15s ease;
}

.chat-voice-player.playing .chat-voice-bar.active {
    background: var(--chat-accent);
}

.chat-voice-player.chat-voice-unavailable {
    opacity: 0.6;
    border-color: rgba(239, 68, 68, 0.25);
}

.chat-voice-player.chat-voice-unavailable .chat-voice-play-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    cursor: not-allowed;
    transform: none !important;
}

.chat-voice-player.chat-voice-unavailable .chat-voice-waveform {
    cursor: not-allowed;
}

.chat-voice-duration {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--chat-text-muted);
    font-family: monospace;
    flex-shrink: 0;
}

/* 8. BOTTOM INPUT BAR */
.chat-bottom-bar {
    padding: 8px 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(19, 17, 30, 0.88) 0%, rgba(14, 12, 23, 0.96) 100%);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: relative;
    box-sizing: border-box;
}

/* Guest prompt */
.chat-guest-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    padding: 6px 4px;
}

.chat-guest-prompt p {
    margin: 0;
    font-size: 12.5px;
    color: var(--chat-text-muted);
}

.chat-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 15px;
    background: var(--chat-accent);
    color: #fff;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 3px 12px var(--chat-accent-glow);
}

.chat-login-btn:hover {
    background: var(--chat-accent-hover);
    color: #fff;
    transform: translateY(-1px);
}

.chat-login-btn svg {
    width: 15px;
    height: 15px;
}

/* Block banner */
.chat-block-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.12);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    font-size: 12.5px;
}

.chat-block-icon svg {
    width: 20px;
    height: 20px;
    color: var(--chat-danger);
}

/* Recording Panel */
.chat-rec-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px 4px 12px;
    min-height: 38px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 12px;
    box-sizing: border-box;
    animation: chatFadeIn 0.2s ease;
}

.chat-rec-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-rec-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chat-danger);
    box-shadow: 0 0 8px var(--chat-danger);
    animation: chatPulseRed 1.2s infinite;
}

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

.chat-rec-txt {
    font-size: 12px;
    font-weight: 600;
    color: #fca5a5;
}

.chat-rec-timer {
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    color: #fff;
    margin-left: 2px;
}

.chat-rec-btns {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-btn-rec-cancel,
.chat-btn-rec-stop {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-btn-rec-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.chat-btn-rec-cancel:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.chat-btn-rec-stop {
    background: var(--chat-danger);
    color: #fff;
}

.chat-btn-rec-stop:hover {
    background: var(--chat-danger-hover);
    transform: scale(1.05);
}

.chat-btn-rec-cancel svg,
.chat-btn-rec-stop svg {
    width: 14px;
    height: 14px;
}

/* Voice Preview Panel */
.chat-preview-panel {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px 3px 8px;
    background: rgba(26, 23, 40, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    animation: chatFadeIn 0.2s ease;
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
}

.chat-preview-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--chat-accent);
    color: #fff;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}

.chat-preview-play-btn:hover {
    background: var(--chat-accent-hover);
    transform: scale(1.05);
}

.chat-preview-play-btn svg {
    width: 13px !important;
    height: 13px !important;
}

.chat-preview-track-wrap {
    flex: 1;
    height: 20px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    padding: 0 4px;
    display: flex;
    align-items: center;
}

.chat-prev-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 100%;
    width: 100%;
}

.chat-prev-waveform .chat-voice-bar {
    flex: 1;
    width: auto;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    min-height: 4px;
    transition: background 0.1s ease;
}

.chat-prev-waveform .chat-voice-bar.active {
    background: var(--chat-accent);
}

.chat-preview-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--chat-accent);
    border-radius: 3px;
    transition: width 0.08s linear;
}

.chat-preview-timer {
    font-size: 11px;
    font-family: monospace;
    font-weight: 600;
    color: var(--chat-text-muted);
    min-width: 34px;
    text-align: right;
    flex-shrink: 0;
}

.chat-preview-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.chat-preview-btn-discard,
.chat-preview-btn-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-preview-btn-discard {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.chat-preview-btn-discard:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fff;
}

.chat-preview-btn-send {
    background: var(--chat-accent);
    color: #fff;
}

.chat-preview-btn-send:hover {
    background: var(--chat-accent-hover);
    transform: scale(1.05);
}

.chat-preview-btn-discard svg,
.chat-preview-btn-send svg {
    width: 14px;
    height: 14px;
}

/* Input Row */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(25, 22, 39, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 3px 5px 3px 6px;
    min-height: 38px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chat-input-row:focus-within {
    border-color: rgba(99, 102, 241, 0.65);
    background: rgba(30, 26, 48, 0.96);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.14), 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chat-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    line-height: 18px;
    padding: 6px 8px 6px 12px;
    margin: 0;
    box-sizing: border-box;
}

.chat-input-field::placeholder {
    color: var(--chat-text-muted);
    opacity: 0.75;
    font-size: 12.5px;
    letter-spacing: 0.15px;
}

.chat-input-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.chat-input-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.chat-input-btn svg {
    width: 17px;
    height: 17px;
}

.chat-action-btn[data-mode="send"] {
    background: var(--chat-accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--chat-accent-glow);
}

.chat-action-btn[data-mode="send"]:hover {
    background: var(--chat-accent-hover);
    transform: scale(1.05);
}

.chat-action-btn[data-mode="mic"]:hover {
    color: var(--chat-accent-hover);
    background: rgba(99, 102, 241, 0.12);
}

/* 9. EMOJI PICKER POPUP */
.chat-emoji-popup {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 12px;
    width: 275px;
    background: #171526;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    padding: 8px 10px;
    z-index: 10002;
    animation: chatFadeIn 0.15s ease;
}

.chat-emoji-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--chat-border);
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--chat-text-muted);
}

.chat-emoji-close {
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}

.chat-emoji-close:hover {
    color: #fff;
}

.chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
}

.chat-emoji-grid::-webkit-scrollbar {
    width: 4px;
}

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

.chat-emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    user-select: none;
}

.chat-emoji-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.18);
}

/* 10. MODAL WINDOWS (SETTINGS & BLOCK) */
.chat-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(6, 5, 12, 0.65);
    backdrop-filter: blur(8px);
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: chatFadeIn 0.2s ease;
}

.chat-modal-window {
    background: #171526;
    border: 1px solid var(--chat-border);
    border-radius: 18px;
    width: 460px;
    max-width: 95vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-modal-window.chat-modal-sm {
    width: 380px;
}

.chat-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--chat-border);
    background: rgba(26, 24, 40, 0.6);
}

.chat-modal-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.chat-modal-close {
    background: transparent;
    border: none;
    color: var(--chat-text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.15s ease;
}

.chat-modal-close:hover {
    color: #fff;
}

.chat-modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--chat-border);
    background: rgba(20, 18, 32, 0.5);
}

.chat-tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--chat-text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-tab-btn.active {
    color: #fff;
    border-bottom-color: var(--chat-accent);
    background: rgba(61, 95, 217, 0.08);
}

.chat-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 75vh;
}

.chat-setting-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 18px;
}

.chat-setting-group:last-child {
    margin-bottom: 0;
}

.chat-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.chat-setting-row.volume-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.chat-setting-info label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.chat-setting-info span {
    font-size: 12px;
    color: var(--chat-text-muted);
}

.chat-volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-range-slider {
    flex: 1;
    accent-color: var(--chat-accent);
    height: 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.chat-btn-sm {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--chat-border);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.chat-btn-sm:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Custom switch */
.chat-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.chat-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.chat-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 24px;
}

.chat-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

.chat-switch input:checked + .chat-slider {
    background-color: var(--chat-accent);
}

.chat-switch input:checked + .chat-slider:before {
    transform: translateX(20px);
}

/* Form inputs for admin */
.chat-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.chat-form-row label {
    font-size: 12.5px;
    font-weight: 600;
    color: #d1d5db;
}

.chat-form-input,
.chat-form-select,
.chat-form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(28, 26, 45, 0.8);
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.chat-form-input:focus,
.chat-form-select:focus,
.chat-form-textarea:focus {
    border-color: var(--chat-accent);
}

.chat-btn-submit {
    width: 100%;
    padding: 11px;
    background: var(--chat-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-btn-submit:hover {
    background: var(--chat-accent-hover);
}

.chat-subhead {
    margin: 16px 0 10px;
    font-size: 13.5px;
    font-weight: 700;
    color: #fff;
}

.chat-blocks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.chat-block-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(28, 26, 45, 0.5);
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    font-size: 12.5px;
}

.chat-btn-unblock {
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 6px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-btn-unblock:hover {
    background: var(--chat-danger);
    color: #fff;
}

.chat-target-display {
    display: block;
    padding: 10px 14px;
    background: rgba(61, 95, 217, 0.12);
    border: 1px solid rgba(61, 95, 217, 0.3);
    border-radius: 10px;
    font-weight: 600;
    color: #a5b4fc;
    font-size: 13px;
}

.chat-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.chat-btn-cancel {
    padding: 9px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--chat-border);
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.14);
}

.chat-btn-danger {
    padding: 9px 18px;
    background: var(--chat-danger);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-btn-danger:hover {
    background: var(--chat-danger-hover);
}

/* Quick Admin Action Buttons */
.chat-admin-actions-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.chat-btn-action-outline,
.chat-btn-action-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-btn-action-outline {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    color: #fff;
}

.chat-btn-action-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-btn-action-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

.chat-btn-action-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

/* Today's Logs Modal */
.chat-modal-lg {
    max-width: 650px !important;
    width: 92% !important;
    max-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
}

.chat-logs-body {
    overflow-y: auto !important;
    max-height: calc(80vh - 80px) !important;
    padding: 14px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.chat-log-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-log-time {
    font-family: monospace;
    font-size: 11px;
    color: var(--chat-text-muted);
    flex-shrink: 0;
}

.chat-log-user {
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.chat-log-text {
    color: #e5e5f0;
    word-break: break-word;
    flex: 1;
}

.chat-log-deleted {
    text-decoration: line-through;
    color: var(--chat-danger);
    opacity: 0.7;
}

@keyframes chatFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
    .chat-drawer {
        width: 100vw;
        max-width: 100vw;
    }
    .chat-trigger-btn {
        padding: 10px 7px;
    }
}

/* Toast notifications styling adjustments */
.iziToast {
    min-height: 68px !important;
    height: auto !important;
}
.iziToast .iziToast-body {
    min-height: 48px;
}

/* Uppercase VIP / Admin Chat badges */
.chat-msg-badge {
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
}
