/* ── Popup inner styles ── */

.chat-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(79,70,229,0.12);
    background: #fff;
    padding: 2px;
}
.avatar svg {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.header-info {
    flex: 1;
    min-width: 0;
}
.header-info h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}
.header-info .status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #64748b;
}
.header-info .status .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    transition: background 0.25s;
}
.header-info .status.away .dot {
    background: #f59e0b;
}
.header-info .status.offline .dot {
    background: #94a3b8;
}
#close-chat {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: 0.15s;
    line-height: 1;
}
#close-chat:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.chat-messages {
    flex: 1;
    padding: 16px 16px 8px 16px;
    overflow-y: auto;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.chat-messages.drag-over {
    background: #f0f3ff;
    outline: 2px dashed #7c3aed;
    outline-offset: -6px;
}
.chat-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.message {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    animation: msgIn 0.25s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
@keyframes msgIn {
    0% { opacity: 0; transform: translateY(6px) scale(0.96); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.message.nora {
    align-self: flex-start;
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}
.message.system {
    align-self: center;
    background: #fef9c3;
    color: #713f12;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 30px;
    max-width: 90%;
}
.message.file-attachment {
    align-self: flex-end;
    background: #eef2ff;
    color: #1e293b;
    border-bottom-right-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-indicator {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    padding: 10px 14px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}
.typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typeBounce 1.4s infinite both;
}
.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typeBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-8px); background: #4f46e5; }
}

.drop-hint {
    align-self: center;
    font-size: 11px;
    color: #94a3b8;
    background: #f8fafc;
    padding: 3px 14px;
    border-radius: 30px;
    border: 1px dashed #d1d9e6;
}

/* ── THREE‑WIDGET BOTTOM BAR ── */
.chat-input {
    padding: 10px 16px 16px 16px;
    border-top: 1px solid #e9edf4;
    display: flex;
    gap: 8px;
    background: #ffffff;
    flex-shrink: 0;
    align-items: center;
}

.chat-input input {
    flex: 1;
    min-width: 120px;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 30px;
    font-size: 14px;
    outline: none;
    background: #f8fafc;
}
.chat-input input:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}

/* ── Paperclip button (force visible) ── */
.chat-input .btn-upload {
    width: 44px !important;
    height: 44px !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f5f9 !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 30px !important;
    cursor: pointer !important;
    transition: 0.2s;
    color: #475569 !important;
    padding: 0 !important;
    line-height: 1 !important;
}
.chat-input .btn-upload svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    display: block;
}
.chat-input .btn-upload:hover {
    background: #e2e8f0 !important;
    border-color: #7c3aed !important;
    color: #7c3aed !important;
}

.chat-input .btn-send {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    border: none;
    padding: 0 18px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    height: 44px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(79,70,229,0.25);
    flex-shrink: 0;
}
.chat-input .btn-send:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(79,70,229,0.35);
}
.chat-input .btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}