/* ===== Messages Panel ===== */

.unread-badge {
    display: inline-block;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 6px;
}

.messages-slot {
    cursor: pointer;
    position: relative;
}

.messages-slot:hover {
    background: rgba(255, 255, 255, 0.1);
}

.messages-panel {
    position: absolute;
    z-index: 500;
    width: 300px;
    max-height: 420px;
    background: rgba(10, 12, 30, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #eee;
    font-size: 14px;
}

.messages-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    font-weight: bold;
}

.messages-panel-header button {
    background: none;
    border: none;
    color: #ccc;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
}

.messages-panel-header button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ----- New conversation form ----- */

.new-conversation-form {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.new-conversation-form input[type="email"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #f0f0f0;
    font-size: 13px;
    margin-bottom: 8px;
}

.new-conversation-form input[type="email"]::placeholder {
    color: #999;
}

.new-conversation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.new-conversation-actions button {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
}

#newConvoCancelBtn {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

#newConvoCancelBtn:hover {
    background: rgba(255, 255, 255, 0.18);
}

#newConvoStartBtn {
    background-color: #6c5ce7;
    color: white;
}

#newConvoStartBtn:hover {
    background-color: #5a4bd1;
}

.new-convo-error {
    color: #ff6b6b;
    font-size: 12px;
    margin: 6px 0 0;
}

/* ----- Conversation list ----- */

.conversation-list {
    overflow-y: auto;
    flex: 1;
}

.conversation-empty {
    padding: 20px 14px;
    color: #999;
    text-align: center;
    font-size: 13px;
}

.conversation-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.conversation-item-title {
    font-weight: 600;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.conversation-item-title .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c5ce7;
    display: inline-block;
}

.conversation-item-preview {
    color: #999;
    font-size: 12px;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- Thread view ----- */

.conversation-thread {
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.back-to-list {
    background: none;
    border: none;
    color: #ccc;
    text-align: left;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.back-to-list:hover {
    color: white;
}

.thread-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thread-loading {
    color: #999;
    text-align: center;
    font-size: 13px;
}

.thread-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    word-wrap: break-word;
}

.thread-bubble.mine {
    align-self: flex-end;
    background: #6c5ce7;
    color: white;
    border-bottom-right-radius: 4px;
}

.thread-bubble.theirs {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #eee;
    border-bottom-left-radius: 4px;
}

.thread-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.thread-input-row input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: #f0f0f0;
    font-size: 13px;
}

.thread-input-row input::placeholder {
    color: #999;
}

.thread-input-row button {
    padding: 8px 14px;
    background-color: #6c5ce7;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

.thread-input-row button:hover {
    background-color: #5a4bd1;
}
