/* Q2A Chat Widget Styles */

.q2a-chat-widget-container {
    background: #fff;
    color: #111;
    border: 1px solid #d9dde5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 420px;
    font-size: 13px;
    transition: height 0.2s ease, width 0.2s ease;
}

.q2a-chat-widget-container.q2a-chat-minimized {
    height: auto;
    width: 140px;
}

.q2a-chat-minimized .q2a-chat-widget-open-link {
    display: none;
}

.q2a-chat-widget-header {
    background: linear-gradient(135deg, #2d6cdf 0%, #1e4ba6 100%);
    color: #fff;
    padding: 10px 12px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.q2a-chat-widget-title {
    font-size: 14px;
}

.q2a-chat-widget-open-link {
    margin-left: auto;
    margin-right: 8px;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    transition: all 0.15s;
    display: inline-block;
}

.q2a-chat-widget-open-link:hover {
    color: #ffffff !important;
    text-decoration: none !important;
    background: rgba(255, 255, 255, 0.35);
}

.q2a-chat-widget-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.q2a-chat-widget-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

.q2a-chat-widget-minimize:active {
    transform: scale(0.95);
}

.q2a-chat-widget-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.q2a-chat-widget-channel-row {
    padding: 8px;
    background: #f7f9fc;
    border-bottom: 1px solid #e2e6ef;
}

#q2a-chat-widget-channel {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccd1db;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
}

.q2a-chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    background: #fafbfd;
    border-bottom: 1px solid #e2e6ef;
}

.q2a-chat-widget-empty {
    color: #9aa4b3;
    text-align: center;
    padding: 20px 8px;
    font-style: italic;
}

.q2a-chat-widget-msg-row {
    margin-bottom: 8px;
    padding: 6px;
    background: #fff;
    border-radius: 4px;
    border-left: 3px solid #2d6cdf;
    line-height: 1.4;
}

.q2a-chat-widget-msg-time {
    font-size: 11px;
    color: #9aa4b3;
    margin-right: 6px;
}

.q2a-chat-widget-msg-user {
    font-weight: 600;
    color: #2d6cdf;
    font-size: 12px;
    margin-right: 4px;
}

.q2a-chat-widget-user-link {
    color: #2d6cdf;
    text-decoration: none;
}

.q2a-chat-widget-user-link:hover {
    text-decoration: underline;
}

.q2a-chat-verified {
    display: inline-block;
    margin-left: 2px;
    font-size: 9px;
    color: #fff;
    background: #1da1f2;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    line-height: 12px;
    text-align: center;
    vertical-align: middle;
}

.q2a-chat-widget-msg-text {
    color: #111;
    font-size: 12px;
    margin-top: 3px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.q2a-chat-widget-msg-text a {
    color: #1565c0;
    text-decoration: underline;
    word-break: break-all;
}

.q2a-chat-widget-msg-text a:hover {
    color: #0d47a1;
}

.q2a-chat-inline-img {
    max-width: 220px;
    max-height: 180px;
    border-radius: 6px;
    margin: 4px 0;
    display: block;
    cursor: pointer;
}

/* Emoji animation */
.q2a-chat-emoji-pop {
    display: inline-block;
    animation: q2a-emoji-bounce 0.5s ease;
}
.q2a-chat-emoji-big {
    font-size: 2.2em;
    line-height: 1.2;
}
.q2a-chat-emoji-big .q2a-chat-emoji-pop {
    animation: q2a-emoji-bounce 0.6s ease;
}
@keyframes q2a-emoji-bounce {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.3); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Reactions */
.q2a-chat-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 2px;
}

.q2a-chat-reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 5px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}

.q2a-chat-reaction-badge:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}

.q2a-chat-reaction-badge span {
    font-size: 10px;
    color: #666;
}

.q2a-chat-reaction-mine {
    background: #e3f2fd;
    border-color: #64b5f6;
}

.q2a-chat-react-btn {
    background: #e0e0e0 !important;
    color: #333 !important;
    font-size: 12px !important;
    padding: 1px 4px !important;
    opacity: 0 !important;
}

.q2a-chat-react-btn:hover {
    background: #bbdefb !important;
}

.q2a-chat-widget-msg:hover .q2a-chat-react-btn {
    opacity: 0.7 !important;
}

.q2a-chat-msg-actions {
    display: flex;
    gap: 3px;
    align-items: center;
    margin-top: 2px;
    position: relative;
}

.q2a-chat-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #555;
    opacity: 0;
    transition: opacity 0.15s;
}

.q2a-chat-action-btn:hover {
    background: #e3f2fd;
    color: #1565c0;
    opacity: 1 !important;
}

.q2a-chat-widget-msg-row:hover .q2a-chat-action-btn {
    opacity: 0.7;
}

.q2a-chat-action-del {
    color: #dc3545;
}

.q2a-chat-action-del:hover {
    background: #fde8ea;
    color: #c62828;
}

.q2a-chat-edited-tag {
    display: inline;
    margin-left: 6px;
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.q2a-chat-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    display: flex;
    gap: 1px;
    padding: 3px 5px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.q2a-chat-emoji-pick {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 3px;
    border-radius: 4px;
    line-height: 1;
}

.q2a-chat-emoji-pick:hover {
    background: #e3f2fd;
}

.q2a-chat-widget-input-row {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: #f5f6f8;
    border-top: 1px solid #e2e6ef;
    flex-shrink: 0;
}

#q2a-chat-widget-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ccd1db;
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}

#q2a-chat-widget-input:focus {
    outline: none;
    border-color: #2d6cdf;
    box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.1);
}

.q2a-chat-widget-send-btn {
    padding: 6px 10px;
    background: #2d6cdf;
    border: 1px solid #2d6cdf;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
    flex-shrink: 0;
}

.q2a-chat-widget-send-btn:hover {
    background: #1e4ba6;
    border-color: #1e4ba6;
}

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

/* Scrollbar styling */
.q2a-chat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.q2a-chat-widget-messages::-webkit-scrollbar-track {
    background: #f0f1f4;
    border-radius: 3px;
}

.q2a-chat-widget-messages::-webkit-scrollbar-thumb {
    background: #ccd1db;
    border-radius: 3px;
}

.q2a-chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #9aa4b3;
}

.q2a-chat-widget-login-prompt {
    padding: 8px;
    background: #fef3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    margin: 0 8px 8px 8px;
    font-size: 12px;
    color: #333;
    line-height: 1.4;
}

.q2a-chat-widget-login-prompt a {
    color: #0066cc;
    text-decoration: none;
    font-weight: 600;
}

.q2a-chat-widget-login-prompt a:hover {
    text-decoration: underline;
}

/* Pinned messages bar */
.q2a-chat-widget-pinned {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #e3f2fd;
    border-bottom: 1px solid #90caf9;
    font-size: 12px;
    min-height: 28px;
    max-height: 40px;
    overflow: hidden;
    flex-shrink: 0;
}

.q2a-chat-widget-pin-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.q2a-chat-widget-pin-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.q2a-chat-widget-pin-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
    flex-shrink: 0;
}

.q2a-chat-widget-pin-arrow {
    background: none;
    border: 1px solid #90caf9;
    border-radius: 3px;
    cursor: pointer;
    padding: 1px 4px;
    font-size: 10px;
    color: #1565c0;
    line-height: 1;
}

.q2a-chat-widget-pin-arrow:hover {
    background: #bbdefb;
}

.q2a-chat-widget-pin-count {
    font-size: 10px;
    color: #666;
}

.q2a-chat-pin-btn {
    background: #17a2b8;
    color: #fff;
    font-size: 12px !important;
    padding: 2px 4px !important;
}

/* Dark mode support */
[data-theme="dark"] .q2a-chat-widget-container {
    background: #1a1a1a;
    border-color: #333;
    color: #f1f1f1;
}

[data-theme="dark"] .q2a-chat-widget-channel-row {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] #q2a-chat-widget-channel {
    background: #2a2a2a;
    color: #f1f1f1;
    border-color: #444;
}

[data-theme="dark"] .q2a-chat-widget-messages {
    background: #0f0f0f;
    border-color: #333;
}

[data-theme="dark"] .q2a-chat-widget-msg-row {
    background: #1a1a1a;
    border-left-color: #4a8cff;
}

[data-theme="dark"] .q2a-chat-widget-msg-text {
    color: #f1f1f1;
}

[data-theme="dark"] .q2a-chat-widget-msg-text a {
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-widget-msg-text a:hover {
    color: #90caf9;
}

[data-theme="dark"] .q2a-chat-reaction-badge {
    background: #2a2a2a;
    border-color: #444;
}

[data-theme="dark"] .q2a-chat-reaction-badge:hover {
    background: #1a2a3a;
    border-color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-reaction-badge span {
    color: #aaa;
}

[data-theme="dark"] .q2a-chat-reaction-mine {
    background: #1a2a3a;
    border-color: #4a8cff;
}

[data-theme="dark"] .q2a-chat-react-btn {
    background: #333 !important;
    color: #ccc !important;
}

[data-theme="dark"] .q2a-chat-react-btn:hover {
    background: #2a4a6a !important;
}

[data-theme="dark"] .q2a-chat-action-btn {
    background: #2a2a2a;
    color: #aaa;
}

[data-theme="dark"] .q2a-chat-action-btn:hover {
    background: #1a2a3a;
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-action-del {
    color: #ef5350;
}

[data-theme="dark"] .q2a-chat-action-del:hover {
    background: #3a1a1a;
    color: #ef5350;
}

[data-theme="dark"] .q2a-chat-edited-tag {
    color: #777;
}

[data-theme="dark"] .q2a-chat-emoji-picker {
    background: #1e1e1e;
    border-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .q2a-chat-emoji-pick:hover {
    background: #2a4a6a;
}

[data-theme="dark"] .q2a-chat-widget-msg-time {
    color: #888;
}

[data-theme="dark"] .q2a-chat-widget-msg-user {
    color: #6ab0ff;
}

[data-theme="dark"] .q2a-chat-widget-user-link {
    color: #6ab0ff;
}

[data-theme="dark"] .q2a-chat-widget-empty {
    color: #888;
}

[data-theme="dark"] .q2a-chat-widget-input-row {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] #q2a-chat-widget-input {
    background: #2a2a2a;
    color: #f1f1f1;
    border-color: #444;
}

[data-theme="dark"] #q2a-chat-widget-input:focus {
    border-color: #4a8cff;
    box-shadow: 0 0 0 2px rgba(74, 140, 255, 0.2);
}

[data-theme="dark"] .q2a-chat-widget-messages::-webkit-scrollbar-track {
    background: #1a1a1a;
}

[data-theme="dark"] .q2a-chat-widget-messages::-webkit-scrollbar-thumb {
    background: #444;
}

[data-theme="dark"] .q2a-chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

[data-theme="dark"] .q2a-chat-widget-login-prompt {
    background: #332200;
    border-color: #664400;
    color: #f1f1f1;
}

[data-theme="dark"] .q2a-chat-widget-login-prompt a {
    color: #6ab0ff;
}

/* Admin action buttons */
.q2a-chat-admin-btn {
    display: inline-block;
    border: none;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 0.15s;
}

.q2a-chat-widget-msg-row:hover .q2a-chat-admin-btn {
    opacity: 0.7;
}

.q2a-chat-admin-btn:hover {
    opacity: 1 !important;
}

.q2a-chat-del-btn {
    background: #dc3545;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    float: right;
}

.q2a-chat-kick-btn {
    background: #fd7e14;
    color: #fff;
}

.q2a-chat-ban-btn {
    background: #dc3545;
    color: #fff;
}

/* User level colors */
.q2a-chat-level-superadmin { color: #f9a825 !important; font-weight: bold; }
.q2a-chat-level-admin { color: #e53935 !important; }
.q2a-chat-level-mod { color: #8e24aa !important; }
.q2a-chat-level-editor { color: #1565c0 !important; }
.q2a-chat-level-expert { color: #2e7d32 !important; }
.q2a-chat-level-approved { color: #ef6c00 !important; }
.q2a-chat-level-user { color: #546e7a !important; }

[data-theme="dark"] .q2a-chat-level-superadmin { color: #ffd54f !important; font-weight: bold; }
[data-theme="dark"] .q2a-chat-level-admin { color: #ef5350 !important; }
[data-theme="dark"] .q2a-chat-level-mod { color: #ce93d8 !important; }
[data-theme="dark"] .q2a-chat-level-editor { color: #64b5f6 !important; }
[data-theme="dark"] .q2a-chat-level-expert { color: #81c784 !important; }
[data-theme="dark"] .q2a-chat-level-approved { color: #ffb74d !important; }
[data-theme="dark"] .q2a-chat-level-user { color: #90a4ae !important; }

/* Dark mode pinned bar */
[data-theme="dark"] .q2a-chat-widget-pinned {
    background: #1a2a3a;
    border-color: #2a4a6a;
}

[data-theme="dark"] .q2a-chat-widget-pin-text {
    color: #e0e0e0;
}

[data-theme="dark"] .q2a-chat-widget-pin-arrow {
    border-color: #2a4a6a;
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-widget-pin-arrow:hover {
    background: #2a4a6a;
}

[data-theme="dark"] .q2a-chat-widget-pin-count {
    color: #999;
}

/* Reply quote in widget messages */
.q2a-chat-widget-reply-quote {
    background: #e8f4fd;
    border-left: 2px solid #2d6cdf;
    border-radius: 3px;
    padding: 2px 6px;
    margin: 2px 0;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.q2a-chat-widget-reply-quote-user {
    font-weight: 600;
    color: #1565c0;
    margin-right: 4px;
}

.q2a-chat-widget-reply-quote-text {
    color: #555;
    font-style: italic;
}

[data-theme="dark"] .q2a-chat-widget-reply-quote {
    background: #1a2a3a;
    border-left-color: #4a8cff;
}

[data-theme="dark"] .q2a-chat-widget-reply-quote-user {
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-widget-reply-quote-text {
    color: #aaa;
}

/* Reply button */
.q2a-chat-reply-btn {
    background: #6c757d;
    color: #fff;
    font-size: 12px !important;
    padding: 2px 4px !important;
}

.q2a-chat-reply-btn:hover {
    background: #5a6268 !important;
}

/* Widget reply bar (above input) */
.q2a-chat-widget-reply-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: #e8f4fd;
    border-top: 1px solid #90caf9;
    font-size: 11px;
    flex-shrink: 0;
}

.q2a-chat-widget-reply-bar-icon {
    font-size: 12px;
    color: #1565c0;
    flex-shrink: 0;
}

.q2a-chat-widget-reply-bar-user {
    font-weight: 600;
    color: #1565c0;
    white-space: nowrap;
    flex-shrink: 0;
}

.q2a-chat-widget-reply-bar-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #555;
    font-style: italic;
}

.q2a-chat-widget-reply-bar-cancel {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #999;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}

.q2a-chat-widget-reply-bar-cancel:hover {
    color: #e53935;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar {
    background: #1a2a3a;
    border-top-color: #2a4a6a;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar-icon {
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar-user {
    color: #64b5f6;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar-text {
    color: #aaa;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar-cancel {
    color: #777;
}

[data-theme="dark"] .q2a-chat-widget-reply-bar-cancel:hover {
    color: #ef5350;
}

/* Loading indicator */
.q2a-chat-loading-older {
    text-align: center;
    padding: 6px;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

[data-theme="dark"] .q2a-chat-loading-older {
    color: #666;
}

/* Reply notification banner */
.q2a-chat-widget-reply-notify {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1565c0;
    color: #fff;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    z-index: 50;
    text-align: center;
    animation: q2a-widget-notify-slide 0.3s ease;
    border-radius: 0 0 4px 4px;
}
.q2a-chat-widget-reply-notify:hover {
    background: #0d47a1;
}
.q2a-chat-widget-reply-notify strong {
    font-weight: 600;
}
.q2a-chat-widget-msg-highlight {
    background: #fff9c4 !important;
    transition: background 0.3s ease;
}
@keyframes q2a-widget-notify-slide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .q2a-chat-widget-reply-notify {
    background: #1565c0;
}
[data-theme="dark"] .q2a-chat-widget-reply-notify:hover {
    background: #0d47a1;
}
[data-theme="dark"] .q2a-chat-widget-msg-highlight {
    background: #3a3a1a !important;
}
