/*
 * Tsjob PRO — Messaging Styles (ts-pro-messaging.css)
 * Depends on: ts-pro-global.css
 */

/* ─── Messaging shell ────────────────────────────────────────────────────── */
.tspro-messaging {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    border: 1px solid var(--tspro-border);
    border-radius: var(--tspro-radius-lg);
    overflow: hidden;
    min-height: 480px;
    font-family: var(--tspro-font);
}

/* ─── Inbox list ─────────────────────────────────────────────────────────── */
.tspro-inbox-list {
    border-right: 1px solid var(--tspro-border);
    overflow-y: auto;
    max-height: 560px;
    background: var(--tspro-white);
}

.tspro-inbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--tspro-border);
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    text-align: left;
    cursor: pointer;
    transition: background .12s;
}
.tspro-inbox-item:hover,
.tspro-inbox-item.is-active { background: var(--tspro-primary-light); }
.tspro-inbox-item.has-unread .tspro-inbox-item__name { font-weight: 700; }
.tspro-inbox-item.has-unread .tspro-inbox-item__preview { font-weight: 600; color: var(--tspro-text); }

.tspro-inbox-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--tspro-border);
}
.tspro-inbox-item__body { flex: 1; overflow: hidden; }
.tspro-inbox-item__name { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tspro-inbox-item__preview { font-size: 12px; color: var(--tspro-text-muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.tspro-inbox-item__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.tspro-inbox-item__time { font-size: 11px; color: var(--tspro-text-muted); }

/* ─── Conversation pane ──────────────────────────────────────────────────── */
.tspro-conversation-pane {
    display: flex;
    flex-direction: column;
    background: var(--tspro-bg);
}
.tspro-conversation-placeholder { margin: auto; color: var(--tspro-text-muted); font-size: 14px; padding: 40px; }

/* ─── Active conversation ────────────────────────────────────────────────── */
.tspro-conversation {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tspro-conversation__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--tspro-border);
    background: var(--tspro-white);
}
.tspro-conversation__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.tspro-conversation__name { font-size: 14px; font-weight: 600; }

/* ─── Message thread ─────────────────────────────────────────────────────── */
.tspro-thread {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
}

.tspro-message { display: flex; flex-direction: column; max-width: 72%; }
.tspro-message--self { align-self: flex-end; align-items: flex-end; }
.tspro-message--other { align-self: flex-start; align-items: flex-start; }

.tspro-message__bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.tspro-message--self  .tspro-message__bubble { background: var(--tspro-primary); color: #fff; border-bottom-right-radius: 4px; }
.tspro-message--other .tspro-message__bubble { background: var(--tspro-white); border: 1px solid var(--tspro-border); border-bottom-left-radius: 4px; }

.tspro-message__body { margin: 0; }
.tspro-message__time { font-size: 11px; color: var(--tspro-text-muted); margin-top: 3px; }

/* ─── Attachments ────────────────────────────────────────────────────────── */
.tspro-message__attachments { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tspro-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255,255,255,.18);
    border-radius: var(--tspro-radius);
    text-decoration: none;
    font-size: 12px;
    color: inherit;
    border: 1px solid rgba(255,255,255,.3);
}
.tspro-message--other .tspro-attachment { background: var(--tspro-bg); color: var(--tspro-text); border-color: var(--tspro-border); }
.tspro-attachment__name { font-weight: 500; }
.tspro-attachment__size { opacity: .75; }

/* ─── Compose area ───────────────────────────────────────────────────────── */
.tspro-compose-form {
    padding: 12px 16px;
    border-top: 1px solid var(--tspro-border);
    background: var(--tspro-white);
}
.tspro-compose-row { display: flex; gap: 8px; align-items: flex-end; }
.tspro-compose-input {
    flex: 1;
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--tspro-font);
    border: 1px solid var(--tspro-border);
    border-radius: var(--tspro-radius);
    resize: none;
    min-height: 42px;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color .15s;
}
.tspro-compose-input:focus { outline: none; border-color: var(--tspro-primary); }
.tspro-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    color: var(--tspro-text-muted);
    padding: 4px;
    transition: color .12s;
    line-height: 1;
}
.tspro-attach-btn:hover { color: var(--tspro-primary); }
.tspro-compose-send { flex-shrink: 0; }

.tspro-compose-attachments-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* ─── New message compose ────────────────────────────────────────────────── */
.tspro-new-message {
    background: var(--tspro-white);
    border: 1px solid var(--tspro-border);
    border-radius: var(--tspro-radius-lg);
    padding: 20px;
    max-width: 480px;
    box-shadow: var(--tspro-shadow-md);
}
.tspro-new-message__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--tspro-border);
}
.tspro-new-message__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.tspro-new-message__name { font-size: 14px; font-weight: 600; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .tspro-messaging { grid-template-columns: 1fr; }
    .tspro-inbox-list { max-height: 220px; border-right: none; border-bottom: 1px solid var(--tspro-border); }
}
