/* ============================================================
   QTW Family Communications — Plugin Styles
   ============================================================ */

/* ── Shared ─────────────────────────────────────────────────── */
.qtw-comms-intro {
    line-height: 1.65;
    color: #555;
    margin-bottom: 1.5rem;
}
.qtw-comms-section {
    margin-bottom: 1.5rem;
}
.qtw-comms-section h3 {
    font-size: 1rem;
    color: #1b4332;
    margin: 0 0 .75rem;
}

/* ── Channel checkboxes ─────────────────────────────────────── */
.qtw-comms-channels {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}
.qtw-comms-channel {
    display: flex;
    align-items: center;
    gap: .75rem;
    cursor: pointer;
    padding: .6rem .85rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    transition: background .15s;
    max-width: 360px;
}
.qtw-comms-channel:hover { background: #f0f7f4; }
.qtw-comms-channel input { cursor: pointer; }
.qtw-comms-channel__icon { font-size: 1.2rem; }

/* ── Inbox ──────────────────────────────────────────────────── */
.qtw-comms-msg-row {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #dee2e6;
    transition: background .15s;
}
.qtw-comms-msg-row:hover { background: #f8f9fa; }
.qtw-comms-msg-row--unread { background: #f0f7f4; }
.qtw-comms-msg-row--unread strong { font-weight: 700; }
.qtw-comms-msg-type { font-size: 1.3rem; flex-shrink: 0; padding-top: .1rem; }
.qtw-comms-msg-info { flex: 1; min-width: 0; }
.qtw-comms-msg-subject { color: #555; font-size: .9rem; }
.qtw-comms-msg-preview {
    font-size: .85rem;
    color: #888;
    margin: .2rem 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qtw-comms-msg-time { font-size: .8rem; color: #aaa; flex-shrink: 0; white-space: nowrap; }

/* ── Thread view ────────────────────────────────────────────── */
.qtw-comms-thread {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin: 1rem 0;
    max-height: 50vh;
    overflow-y: auto;
    padding: .5rem 0;
}
.qtw-comms-bubble {
    max-width: 75%;
    padding: .75rem 1rem;
    border-radius: 12px;
    line-height: 1.5;
}
.qtw-comms-bubble--sent {
    align-self: flex-end;
    background: #2d6a4f;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}
.qtw-comms-bubble--recv {
    align-self: flex-start;
    background: #f0f7f4;
    border: 1px solid #c8e6c9;
    border-radius: 12px 12px 12px 2px;
}
.qtw-comms-bubble__meta {
    font-size: .75rem;
    opacity: .7;
    margin-bottom: .3rem;
}
.qtw-comms-bubble--sent .qtw-comms-bubble__meta { color: rgba(255,255,255,.75); }

/* ── Reply box ──────────────────────────────────────────────── */
.qtw-comms-reply {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}
.qtw-comms-reply textarea {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: .65rem .85rem;
    font-size: 1rem;
    resize: vertical;
    box-sizing: border-box;
}
.qtw-comms-reply textarea:focus {
    outline: none;
    border-color: #2d6a4f;
    box-shadow: 0 0 0 3px rgba(45,106,79,.1);
}

/* ── Compose ────────────────────────────────────────────────── */
.qtw-comms-compose h3 { color: #1b4332; margin-bottom: 1.25rem; }
.qtw-comms-to-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: .5rem 0 .75rem;
}
.qtw-comms-to-options label {
    display: flex;
    align-items: center;
    gap: .4rem;
    cursor: pointer;
}

/* ── Unread badge ───────────────────────────────────────────── */
.qtw-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e63946;
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 4px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1;
}

/* ── Groups ─────────────────────────────────────────────────── */
.qtw-comms-groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem;
    margin-top: .75rem;
}
.qtw-comms-group-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem;
}
.qtw-comms-group-card strong { color: #1b4332; }
.qtw-comms-group-card p { font-size: .85rem; color: #888; margin: .2rem 0 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .qtw-comms-bubble { max-width: 90%; }
    .qtw-comms-to-options { flex-direction: column; gap: .5rem; }
}