/* ============================================================
   FNLM Direct Messages — pannello "Scrivi a noi" frontend
   ============================================================ */

.fn-dm-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.fn-dm-panel h3 {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 700;
    color: #003580;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fn-dm-total-badge {
    background: #e00;
    color: #fff;
    border-radius: 50%;
    padding: 2px 7px;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* Layout a due colonne */
.fn-dm-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px;
    min-height: 240px;
    max-height: 400px;
}

@media (max-width: 520px) {
    .fn-dm-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        max-height: none;
    }
}

/* Lista ricevitori */
.fn-dm-receivers {
    border-right: 1px solid #eee;
    padding-right: 12px;
    overflow-y: auto;
}

.fn-dm-receiver-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    font-size: .88rem;
    font-weight: 600;
    color: #333;
    border: 1px solid transparent;
}

.fn-dm-receiver-item:hover {
    background: #f0f4ff;
    border-color: #c0d0f0;
}

.fn-dm-receiver-item.active {
    background: #003580;
    color: #fff;
    border-color: #003580;
}

.fn-dm-empty,
.fn-dm-loading {
    font-size: .85rem;
    color: #888;
    padding: 8px 0;
}

/* Thread messaggi */
.fn-dm-thread-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.fn-dm-thread {
    flex: 1;
    overflow-y: auto;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 160px;
    max-height: 300px;
}

.fn-dm-placeholder {
    font-size: .85rem;
    color: #aaa;
    text-align: center;
    margin: auto;
}

/* Messaggi */
.fn-dm-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.fn-dm-msg--mine {
    align-self: flex-end;
    align-items: flex-end;
}

.fn-dm-msg--theirs {
    align-self: flex-start;
    align-items: flex-start;
}

.fn-dm-msg-text {
    background: #003580;
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    padding: 8px 12px;
    font-size: .88rem;
    line-height: 1.4;
    word-break: break-word;
}

.fn-dm-msg--theirs .fn-dm-msg-text {
    background: #f1f3f8;
    color: #222;
    border-radius: 14px 14px 14px 4px;
}

.fn-dm-msg-time {
    font-size: .72rem;
    color: #aaa;
    margin-top: 3px;
    padding: 0 4px;
}

/* Form invio */
.fn-dm-send-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.fn-dm-send-form textarea {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: .88rem;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color .15s;
}

.fn-dm-send-form textarea:focus {
    border-color: #003580;
}

.fn-dm-send-form .fnb-btn {
    background: #003580;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background .15s;
}

.fn-dm-send-form .fnb-btn:hover {
    background: #002060;
}
